YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/AutomaticAssignment/models/Record.php

Summary

Maintainability
D
2 days
Test Coverage
C
70%

File Record.php has 308 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Automatic Assignment Record Model Class.
 *
Severity: Minor
Found in modules/Settings/AutomaticAssignment/models/Record.php - About 3 hrs to fix

    The class Settings_AutomaticAssignment_Record_Model has an overall complexity of 68 which is very high. The configured complexity threshold is 50.
    Open

    class Settings_AutomaticAssignment_Record_Model extends Settings_Vtiger_Record_Model
    {
        /** @var array Record changes */
        protected $changes = [];
    
    

    Settings_AutomaticAssignment_Record_Model has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Settings_AutomaticAssignment_Record_Model extends Settings_Vtiger_Record_Model
    {
        /** @var array Record changes */
        protected $changes = [];
    
    
    Severity: Minor
    Found in modules/Settings/AutomaticAssignment/models/Record.php - About 2 hrs to fix

      Function saveToDb has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public function saveToDb()
          {
              $db = \App\Db::getInstance('admin');
              $tablesData = $this->getId() ? array_intersect_key($this->getData(), $this->changes) : array_intersect_key($this->getData(), array_flip($this->getModule()->getEditableFields()));
              if ($tablesData) {
      Severity: Minor
      Found in modules/Settings/AutomaticAssignment/models/Record.php - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method getValuesToSave has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getValuesToSave(array $data): array
          {
              if (!$this->getId()) {
                  $forSave[$this->getModule()->baseTable] = [];
              }
      Severity: Minor
      Found in modules/Settings/AutomaticAssignment/models/Record.php - About 1 hr to fix

        Method getInstanceById has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getInstanceById(int $id)
            {
                $db = App\Db::getInstance('admin');
                $instance = self::getCleanInstance();
                $baseTable = $instance->getTable();
        Severity: Minor
        Found in modules/Settings/AutomaticAssignment/models/Record.php - About 1 hr to fix

          Function getValuesToSave has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getValuesToSave(array $data): array
              {
                  if (!$this->getId()) {
                      $forSave[$this->getModule()->baseTable] = [];
                  }
          Severity: Minor
          Found in modules/Settings/AutomaticAssignment/models/Record.php - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function setDataFromRequest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function setDataFromRequest(App\Request $request)
              {
                  foreach ($this->getModule()->getEditableFields() as $fieldName) {
                      if ($request->has($fieldName)) {
                          switch ($fieldName) {
          Severity: Minor
          Found in modules/Settings/AutomaticAssignment/models/Record.php - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function getInstanceById has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getInstanceById(int $id)
              {
                  $db = App\Db::getInstance('admin');
                  $instance = self::getCleanInstance();
                  $baseTable = $instance->getTable();
          Severity: Minor
          Found in modules/Settings/AutomaticAssignment/models/Record.php - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed.
          Open

              public function saveToDb()

          Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

          See

          Class "Settings_AutomaticAssignment_Record_Model" has 25 methods, which is greater than 20 authorized. Split it into smaller classes.
          Open

          class Settings_AutomaticAssignment_Record_Model extends Settings_Vtiger_Record_Model

          A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

          Reduce the number of returns of this function 4, down to the maximum allowed 3.
          Open

              public function getDisplayValue(string $name)

          Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

          Noncompliant Code Example

          With the default threshold of 3:

          function myFunction(){ // Noncompliant as there are 4 return statements
            if (condition1) {
              return true;
            } else {
              if (condition2) {
                return false;
              } else {
                return true;
              }
            }
            return false;
          }
          

          Avoid using undefined variables such as '$forSave' which will lead to PHP notices.
          Open

                      $forSave[$this->getModule()->baseTable] = [];

          UndefinedVariable

          Since: 2.8.0

          Detects when a variable is used that has not been defined before.

          Example

          class Foo
          {
              private function bar()
              {
                  // $message is undefined
                  echo $message;
              }
          }

          Source https://phpmd.org/rules/cleancode.html#undefinedvariable

          Avoid using undefined variables such as '$forSave' which will lead to PHP notices.
          Open

                              $forSave[$fieldModel->getTableName()][$fieldModel->getColumnName()] = $value;

          UndefinedVariable

          Since: 2.8.0

          Detects when a variable is used that has not been defined before.

          Example

          class Foo
          {
              private function bar()
              {
                  // $message is undefined
                  echo $message;
              }
          }

          Source https://phpmd.org/rules/cleancode.html#undefinedvariable

          Avoid using undefined variables such as '$forSave' which will lead to PHP notices.
          Open

                  return $forSave;

          UndefinedVariable

          Since: 2.8.0

          Detects when a variable is used that has not been defined before.

          Example

          class Foo
          {
              private function bar()
              {
                  // $message is undefined
                  echo $message;
              }
          }

          Source https://phpmd.org/rules/cleancode.html#undefinedvariable

          Avoid using undefined variables such as '$forSave' which will lead to PHP notices.
          Open

                                  $forSave[$table] = [];

          UndefinedVariable

          Since: 2.8.0

          Detects when a variable is used that has not been defined before.

          Example

          class Foo
          {
              private function bar()
              {
                  // $message is undefined
                  echo $message;
              }
          }

          Source https://phpmd.org/rules/cleancode.html#undefinedvariable

          Avoid using undefined variables such as '$forSave' which will lead to PHP notices.
          Open

                                  $forSave[$tables[$type]]['values'][] = [$id, $type];

          UndefinedVariable

          Since: 2.8.0

          Detects when a variable is used that has not been defined before.

          Example

          class Foo
          {
              private function bar()
              {
                  // $message is undefined
                  echo $message;
              }
          }

          Source https://phpmd.org/rules/cleancode.html#undefinedvariable

          Avoid using undefined variables such as '$forSave' which will lead to PHP notices.
          Open

                                  $forSave[$tables[$type]]['names'] = ['member', 'type'];

          UndefinedVariable

          Since: 2.8.0

          Detects when a variable is used that has not been defined before.

          Example

          class Foo
          {
              private function bar()
              {
                  // $message is undefined
                  echo $message;
              }
          }

          Source https://phpmd.org/rules/cleancode.html#undefinedvariable

          The class Settings_AutomaticAssignment_Record_Model has a coupling between objects value of 22. Consider to reduce the number of dependencies under 13.
          Open

          class Settings_AutomaticAssignment_Record_Model extends Settings_Vtiger_Record_Model
          {
              /** @var array Record changes */
              protected $changes = [];
          
          

          CouplingBetweenObjects

          Since: 1.1.0

          A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

          Example

          class Foo {
              /**
               * @var \foo\bar\X
               */
              private $x = null;
          
              /**
               * @var \foo\bar\Y
               */
              private $y = null;
          
              /**
               * @var \foo\bar\Z
               */
              private $z = null;
          
              public function setFoo(\Foo $foo) {}
              public function setBar(\Bar $bar) {}
              public function setBaz(\Baz $baz) {}
          
              /**
               * @return \SplObjectStorage
               * @throws \OutOfRangeException
               * @throws \InvalidArgumentException
               * @throws \ErrorException
               */
              public function process(\Iterator $it) {}
          
              // ...
          }

          Source https://phpmd.org/rules/design.html#couplingbetweenobjects

          Missing class import via use statement (line '260', column '32').
          Open

                              ->select(['member' => new \yii\db\Expression('CONCAT(type,\':\', member)')])

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '251', column '16').
          Open

                  $data = (new App\Db\Query())

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '456', column '21').
          Open

                      $handlers = (new \App\Db\Query())->from('vtiger_eventhandlers')

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '259', column '19').
          Open

                          $query = (new App\Db\Query())

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '412', column '23').
          Open

                  $isDuplicate = (new App\Db\Query())

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Missing class import via use statement (line '449', column '19').
          Open

                  $modules = (new \App\Db\Query())->select(['vtiger_tab.name'])

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          The method getInstanceById uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                          } else {
                              $queryAll = $query;
                          }

          ElseExpression

          Since: 1.4.0

          An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

          Example

          class Foo
          {
              public function bar($flag)
              {
                  if ($flag) {
                      // one branch
                  } else {
                      // another branch
                  }
              }
          }

          Source https://phpmd.org/rules/cleancode.html#elseexpression

          Avoid using static access to class 'App\Db' in method 'save'.
          Open

                  $db = App\Db::getInstance('admin');

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\Cache' in method 'getCleanInstance'.
          Open

                  if (\App\Cache::staticHas($cacheName, $key)) {

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class 'Vtiger_Link_Model' in method 'getRecordLinks'.
          Open

                      $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\Cache' in method 'getCleanInstance'.
          Open

                      return clone \App\Cache::staticGet($cacheName, $key);

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\Db' in method 'saveToDb'.
          Open

                  $db = \App\Db::getInstance('admin');

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class 'Settings_Vtiger_Module_Model' in method 'getCleanInstance'.
          Open

                  $moduleInstance = Settings_Vtiger_Module_Model::getInstance('Settings:AutomaticAssignment');

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          The method saveToDb uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                          } else {
                              $db->createCommand()->delete($tableName, ['id' => $this->getId()])->execute();
                              if ($tableData) {
                                  $names = $tableData['names'];
                                  $names[] = 'id';

          ElseExpression

          Since: 1.4.0

          An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

          Example

          class Foo
          {
              public function bar($flag)
              {
                  if ($flag) {
                      // one branch
                  } else {
                      // another branch
                  }
              }
          }

          Source https://phpmd.org/rules/cleancode.html#elseexpression

          Avoid using static access to class 'App\Db' in method 'getInstanceById'.
          Open

                  $db = App\Db::getInstance('admin');

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class 'Settings_Groups_Record_Model' in method 'getDefaultOwner'.
          Open

                  return Settings_Groups_Record_Model::getInstance($owner) ? $owner : 0;

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\EventHandler' in method 'updateHandler'.
          Open

                          \App\EventHandler::update($data, $handlers[$type]['eventhandler_id']);

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\Language' in method 'getDisplayValue'.
          Open

                          return empty($this->get($name)) ? 'LBL_SYSTEM' : \App\Language::translate(\App\PrivilegeUtil::getRoleName($this->get($name)));

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\Log' in method 'save'.
          Open

                      \App\Log::error($ex->__toString());

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class 'App\Db' in method 'delete'.
          Open

                  $db = App\Db::getInstance('admin');

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\Module' in method 'getDisplayValue'.
          Open

                          $moduleName = \App\Module::getModuleName($this->get($name));

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          The method updateHandler uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                      } else {
                          \App\EventHandler::registerHandler($type, $handlerClass, implode(',', $modules), '', 1, true, 0, \App\EventHandler::SYSTEM);
                      }

          ElseExpression

          Since: 1.4.0

          An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

          Example

          class Foo
          {
              public function bar($flag)
              {
                  if ($flag) {
                      // one branch
                  } else {
                      // another branch
                  }
              }
          }

          Source https://phpmd.org/rules/cleancode.html#elseexpression

          Avoid using static access to class '\App\PrivilegeUtil' in method 'getDisplayValue'.
          Open

                          return empty($this->get($name)) ? 'LBL_SYSTEM' : \App\Language::translate(\App\PrivilegeUtil::getRoleName($this->get($name)));

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\Fields\Owner' in method 'getDefaultOwner'.
          Open

                  if ('Users' === \App\Fields\Owner::getType($owner)) {

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\EventHandler' in method 'updateHandler'.
          Open

                      \App\EventHandler::deleteHandler($handlerClass);

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\Cache' in method 'getCleanInstance'.
          Open

                  \App\Cache::staticSave($cacheName, $key, clone $instance);

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class 'App\Language' in method 'validate'.
          Open

                          'message' => App\Language::translate('LBL_DUPLICATE', $this->getModule()->getName(true))

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\Json' in method 'setDataFromRequest'.
          Open

                                  $value = \App\Json::encode(\App\Condition::getConditionsFromRequest($request->getArray($fieldName, \App\Purifier::TEXT)));

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\Db' in method 'updateHandler'.
          Open

                  $db = \App\Db::getInstance('admin');

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          The method updateHandler uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                  } else {
                      $type = 'EntityBeforeSave';
                      $handlers = (new \App\Db\Query())->from('vtiger_eventhandlers')
                          ->where(['handler_class' => $handlerClass, 'event_name' => $type])
                          ->indexBy('event_name')->all();

          ElseExpression

          Since: 1.4.0

          An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

          Example

          class Foo
          {
              public function bar($flag)
              {
                  if ($flag) {
                      // one branch
                  } else {
                      // another branch
                  }
              }
          }

          Source https://phpmd.org/rules/cleancode.html#elseexpression

          Avoid using static access to class '\App\EventHandler' in method 'updateHandler'.
          Open

                          \App\EventHandler::registerHandler($type, $handlerClass, implode(',', $modules), '', 1, true, 0, \App\EventHandler::SYSTEM);

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\Language' in method 'getDisplayValue'.
          Open

                          return \App\Language::translate($moduleName, $moduleName);

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\User' in method 'getDefaultOwner'.
          Open

                      return \App\User::isExists($owner) ? $owner : 0;

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\Condition' in method 'setDataFromRequest'.
          Open

                                  $value = \App\Json::encode(\App\Condition::getConditionsFromRequest($request->getArray($fieldName, \App\Purifier::TEXT)));

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Avoid using static access to class '\App\Language' in method 'getDisplayValue'.
          Open

                          return \App\Language::translate($label, $this->getModule()->getName(true));

          StaticAccess

          Since: 1.4.0

          Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

          Example

          class Foo
          {
              public function bar()
              {
                  Bar::baz();
              }
          }

          Source https://phpmd.org/rules/cleancode.html#staticaccess

          Define a constant instead of duplicating this literal "tabid" 3 times.
          Open

                      case 'tabid':

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal "values" 3 times.
          Open

                                  foreach ($tableData['values'] as &$values) {

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal "members" 3 times.
          Open

                          case 'members':

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal "admin" 5 times.
          Open

                  $db = App\Db::getInstance('admin');

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Define a constant instead of duplicating this literal "subject" 4 times.
          Open

                  return $this->get('subject');

          Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

          On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

          Noncompliant Code Example

          With the default threshold of 3:

          function run() {
            prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
            execute('action1');
            release('action1');
          }
          

          Compliant Solution

          ACTION_1 = 'action1';
          
          function run() {
            prepare(ACTION_1);
            execute(ACTION_1);
            release(ACTION_1);
          }
          

          Exceptions

          To prevent generating some false-positives, literals having less than 5 characters are excluded.

          Call to undeclared method \App\Db::createCommand
          Open

                              $db->createCommand()->insert($tableName, $tableData)->execute();

          Call to undeclared method \App\Db::createCommand
          Open

                              $db->createCommand()->update($tableName, $tableData, [$baseTableIndex => $this->getId()])->execute();

          Returning type ?array|?array<string>&gt;|?array<string>&gt;|?array<string>|?array<string>}&gt;|?array<string></string></string></string></string></string> but getValuesToSave() is declared to return array
          Open

                  return $forSave;

          Reference to undeclared property \Settings_AutomaticAssignment_Record_Model->module
          Open

                  return $this->module;

          Call to method error from undeclared class \App\Log
          Open

                      \App\Log::error($ex->__toString());

          Call to undeclared method \App\Db\Query::select
          Open

                          $query = (new App\Db\Query())

          Call to method __construct from undeclared class \yii\db\Expression
          Open

                              ->select(['member' => new \yii\db\Expression('CONCAT(type,\':\', member)')])

          Call to undeclared method \App\Db\Query::select
          Open

                  $modules = (new \App\Db\Query())->select(['vtiger_tab.name'])

          Return type of getInstanceById() is undeclared type \self
          Open

              public static function getInstanceById(int $id)

          Call to undeclared method \App\Db\Query::from
          Open

                      $handlers = (new \App\Db\Query())->from('vtiger_eventhandlers')

          Call to undeclared method \App\Db\Query::from
          Open

                  $isDuplicate = (new App\Db\Query())

          Call to undeclared method \App\Db::createCommand
          Open

                      $result = $db->createCommand()->delete($this->getTable(), ['id' => $recordId])->execute();

          Call to method isExists from undeclared class \App\User (Did you mean class \Tests\App\User)
          Open

                      return \App\User::isExists($owner) ? $owner : 0;

          Call to undeclared method \App\Db::createCommand
          Open

                                  $db->createCommand()->batchInsert($tableName, $names, $tableData['values'])->execute();

          Reference to undeclared property \Settings_AutomaticAssignment_Record_Model->module
          Open

                  $instance->module = $moduleInstance;

          Call to undeclared method \App\Db::beginTransaction
          Open

                  $transaction = $db->beginTransaction();

          Call to undeclared method \App\Db\Query::from
          Open

                  $data = (new App\Db\Query())

          Reference to undeclared property \Settings_AutomaticAssignment_Record_Model->module
          Open

                  return $this->module = $moduleModel;

          Variable $forSave was undeclared, but array fields are being added to it.
          Open

                      $forSave[$this->getModule()->baseTable] = [];

          Return type of getCleanInstance() is undeclared type \self
          Open

              public static function getCleanInstance()

          Call to undeclared method \App\Db::createCommand
          Open

                              $db->createCommand()->delete($tableName, ['id' => $this->getId()])->execute();

          Call to method getType from undeclared class \App\Fields\Owner
          Open

                  if ('Users' === \App\Fields\Owner::getType($owner)) {

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

              public function getRecordLinks(): array
              {
                  $links = [];
                  $recordLinks = [
                      [
          Severity: Major
          Found in modules/Settings/AutomaticAssignment/models/Record.php and 3 other locations - About 1 hr to fix
          modules/Settings/BusinessHours/models/Record.php on lines 242..265
          modules/Settings/Groups/models/Record.php on lines 420..443
          modules/Settings/TreesManager/models/Record.php on lines 97..120

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 117.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              public static function getCleanInstance()
              {
                  $cacheName = __CLASS__;
                  $key = 'Clean';
                  if (\App\Cache::staticHas($cacheName, $key)) {
          Severity: Major
          Found in modules/Settings/AutomaticAssignment/models/Record.php and 1 other location - About 1 hr to fix
          modules/Settings/TreesManager/models/Record.php on lines 407..420

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 103.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

              public function set($key, $value)
              {
                  if ($this->getId() && !\in_array($key, ['id']) && (\array_key_exists($key, $this->value) && $this->value[$key] != $value)) {
                      $this->changes[$key] = $this->get($key);
                  }
          Severity: Major
          Found in modules/Settings/AutomaticAssignment/models/Record.php and 2 other locations - About 1 hr to fix
          modules/Settings/Companies/models/Record.php on lines 69..75
          modules/Settings/PickListDependency/models/Record.php on lines 234..240

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 102.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Avoid excessively long class names like Settings_AutomaticAssignment_Record_Model. Keep class name length under 40.
          Open

          class Settings_AutomaticAssignment_Record_Model extends Settings_Vtiger_Record_Model
          {
              /** @var array Record changes */
              protected $changes = [];
          
          

          LongClassName

          Since: 2.9

          Detects when classes or interfaces are declared with excessively long names.

          Example

          class ATooLongClassNameThatHintsAtADesignProblem {
          
          }
          
          interface ATooLongInterfaceNameThatHintsAtADesignProblem {
          
          }

          Source https://phpmd.org/rules/naming.html#longclassname

          Each class must be in a namespace of at least one level (a top-level vendor name)
          Open

          class Settings_AutomaticAssignment_Record_Model extends Settings_Vtiger_Record_Model

          The class Settings_AutomaticAssignment_Record_Model is not named in CamelCase.
          Open

          class Settings_AutomaticAssignment_Record_Model extends Settings_Vtiger_Record_Model
          {
              /** @var array Record changes */
              protected $changes = [];
          
          

          CamelCaseClassName

          Since: 0.2

          It is considered best practice to use the CamelCase notation to name classes.

          Example

          class class_name {
          }

          Source

          Avoid variables with short names like $id. Configured minimum length is 3.
          Open

                                  [$type, $id] = explode(':', $member);

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $db. Configured minimum length is 3.
          Open

                  $db = \App\Db::getInstance('admin');

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $db. Configured minimum length is 3.
          Open

                  $db = App\Db::getInstance('admin');

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $id. Configured minimum length is 3.
          Open

              public static function getInstanceById(int $id)

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $db. Configured minimum length is 3.
          Open

                  $db = App\Db::getInstance('admin');

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $db. Configured minimum length is 3.
          Open

                  $db = App\Db::getInstance('admin');

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Avoid variables with short names like $db. Configured minimum length is 3.
          Open

                  $db = \App\Db::getInstance('admin');

          ShortVariable

          Since: 0.2

          Detects when a field, local, or parameter has a very short name.

          Example

          class Something {
              private $q = 15; // VIOLATION - Field
              public static function main( array $as ) { // VIOLATION - Formal
                  $r = 20 + $this->q; // VIOLATION - Local
                  for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                      $r += $this->q;
                  }
              }
          }

          Source https://phpmd.org/rules/naming.html#shortvariable

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to set the id of the record.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to get table name.

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $this->get('id');

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $this->module;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function setModule($moduleModel)

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $this->set('id', (int) $value);

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return string

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

              protected $changes = [];

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $this->get('subject');

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to get Module instance.

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to get table primary key.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return string

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return Settings_AutomaticAssignment_Module_Model

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $this->getModule()->getEditViewUrl() . '&record=' . $this->getId();

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return int Role Id

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param int $value - id value

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getModule()

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Set module Instance.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return Settings_AutomaticAssignment_Module_Model

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $this->module = $moduleModel;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getTable()

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $this->getModule()->baseTable;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /** @var array Record changes */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return string

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return string

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $this->getModule()->baseIndex;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getEditViewUrl()

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to get the Id.

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getName()

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getTableIndex()

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getId()

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function setId($value)

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to get the Role Name.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function removes record.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param Settings_AutomaticAssignment_Module_Model $moduleModel

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to get the Edit View Url.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function delete()

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $this->updateHandler();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $transaction = $db->beginTransaction();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $transaction->commit();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              $db->createCommand()->delete($tableName, ['id' => $this->getId()])->execute();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          'linkurl' => 'javascript:Settings_AutomaticAssignment_List_Js.deleteById(' . $this->getId() . ')',

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to save.

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          'linkclass' => 'btn text-white btn-danger btn-sm'

          Line exceeds 120 characters; contains 186 characters
          Open

                  $tablesData = $this->getId() ? array_intersect_key($this->getData(), $this->changes) : array_intersect_key($this->getData(), array_flip($this->getModule()->getEditableFields()));

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              $this->setId((int) $db->getLastInsertID("{$baseTable}_id_seq"));

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function formats data for saving.

          Line exceeds 120 characters; contains 132 characters
          Open

                  if ($this->getId() && !\in_array($key, ['id']) && (\array_key_exists($key, $this->value) && $this->value[$key] != $value)) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getRecordLinks(): array

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      [

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $this->updateHandler();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      \App\Log::error($ex->__toString());

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              $members = $fieldModel->getEditViewDisplayValue($value);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->from($baseTable)

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return !empty($result);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  } catch (\Throwable $ex) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Save data to the database.

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $db = \App\Db::getInstance('admin');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          } elseif ($baseTable === $tableName) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          'linkicon' => 'yfi yfi-full-editing-view',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $db = App\Db::getInstance('admin');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  try {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          if (!$this->getId() && $baseTable === $tableName) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $names = $tableData['names'];

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

              private function getValuesToSave(array $data): array

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  foreach ($data as $fieldName => $value) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return parent::set($key, $value);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if ($recordId) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      switch ($fieldName) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  \App\PrivilegeUtil::MEMBER_TYPE_ROLE_AND_SUBORDINATES => 's_#__auto_assign_roles'

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          'linklabel' => 'LBL_DELETE_RECORD',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  ];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              break;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $forSave;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $baseTable = $instance->getTable();

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return bool

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      throw $ex;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              $db->createCommand()->insert($tableName, $tableData)->execute();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              if ($tableData) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param array $data

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $forSave[$tables[$type]]['names'] = ['member', 'type'];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $data = (new App\Db\Query())

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if ($tablesData) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  foreach ($tableData['values'] as &$values) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $this->changes[$key] = $this->get($key);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $links = [];

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return \self

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public static function getInstanceById(int $id)

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          } else {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $db->createCommand()->batchInsert($tableName, $names, $tableData['values'])->execute();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  \App\PrivilegeUtil::MEMBER_TYPE_GROUPS => 's_#__auto_assign_groups',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              ];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $forSave[$table] = [];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              $forSave[$fieldModel->getTableName()][$fieldModel->getColumnName()] = $value;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param int $id

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              foreach ($tables as $table) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              foreach ($members as $member) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /** {@inheritdoc} */

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          'linkclass' => 'btn btn-primary btn-sm'

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ],

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $recordId = $this->getId();

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function save()

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $this->saveToDb();

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function saveToDb()

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  \App\PrivilegeUtil::MEMBER_TYPE_ROLES => 's_#__auto_assign_roles',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $forSave[$tables[$type]]['values'][] = [$id, $type];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      [

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          'linklabel' => 'LBL_EDIT_RECORD',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          'linkurl' => $this->getEditViewUrl(),

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          'linktype' => 'LISTVIEWRECORD',

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $db = App\Db::getInstance('admin');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $db = App\Db::getInstance('admin');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $transaction->rollBack();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      foreach ($this->getValuesToSave($tablesData) as $tableName => $tableData) {

          Line exceeds 120 characters; contains 121 characters
          Open

                              $db->createCommand()->update($tableName, $tableData, [$baseTableIndex => $this->getId()])->execute();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                      $values[] = $this->getId();

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if (!$this->getId()) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $fieldModel = $this->getFieldInstanceByName($fieldName);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          case 'members':

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ],

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to get the instance, given id.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $baseTableIndex = $this->getModule()->baseIndex;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  \App\PrivilegeUtil::MEMBER_TYPE_USERS => 's_#__auto_assign_users',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  [$type, $id] = explode(':', $member);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              break;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /** {@inheritdoc} */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function set($key, $value)

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  foreach ($recordLinks as $recordLink) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $result = $db->createCommand()->delete($this->getTable(), ['id' => $recordId])->execute();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $baseTable = $this->getModule()->baseTable;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              $db->createCommand()->update($tableName, $tableData, [$baseTableIndex => $this->getId()])->execute();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $forSave[$this->getModule()->baseTable] = [];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if ($this->getId() && !\in_array($key, ['id']) && (\array_key_exists($key, $this->value) && $this->value[$key] != $value)) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $tablesData = $this->getId() ? array_intersect_key($this->getData(), $this->changes) : array_intersect_key($this->getData(), array_flip($this->getModule()->getEditableFields()));

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $recordLinks = [

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $names[] = 'id';

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          'linktype' => 'LISTVIEWRECORD',

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return array

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          'linkicon' => 'fas fa-trash-alt',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $links;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $baseIndex = $instance->getTableIndex();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              $tables = [

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          default:

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $instance = self::getCleanInstance();

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if (\App\Cache::staticHas($cacheName, $key)) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Default owner.

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $owner = $this->get('assign');

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $fieldModel->getUITypeModel()->validate($value, true);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $value = $fieldModel->getDBValue($value);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $moduleInstance = Settings_Vtiger_Module_Model::getInstance('Settings:AutomaticAssignment');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $moduleName = \App\Module::getModuleName($this->get($name));

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $label = empty($this->get($name)) ? 'PLL_INACTIVE' : 'PLL_ACTIVE';

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $fieldInstance->getDisplayValue($this->get($name));

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return (bool) $this->get('active');

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      return false;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if ($this->has($name)) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->where([$baseIndex => $id])

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if ($data) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to get the clean instance.

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return string

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      return \App\User::isExists($owner) ? $owner : 0;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              default:

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              ->from($tableName)

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  switch ($name) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function isRefreshTab($name)

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $cacheName = __CLASS__;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      return clone \App\Cache::staticGet($cacheName, $key);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $instance;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return bool

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if ('Users' === \App\Fields\Owner::getType($owner)) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return Settings_Groups_Record_Model::getInstance($owner) ? $owner : 0;

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function defines whether given tab in edit view should be refreshed after saving.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return Vtiger_Field_Model

          Line exceeds 120 characters; contains 146 characters
          Open

                                  $value = \App\Json::encode(\App\Condition::getConditionsFromRequest($request->getArray($fieldName, \App\Purifier::TEXT)));

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $queryAll = null;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              ->where(["{$tableName}.{$index}" => $id]);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              case 'record_limit_conditions':

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $this->set($fieldName, $value);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $response[] = [

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $fieldName ? ($this->changes[$fieldName] ?? null) : $this->changes;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          \App\EventHandler::registerHandler($type, $handlerClass, implode(',', $modules), '', 1, true, 0, \App\EventHandler::SYSTEM);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->one($db);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              $queryAll = $query;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $data['members'] = $instance->getFieldInstanceByName('members')->getUITypeModel()->getDBValue($members);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function to get the Display Value, for the current field type with given DB Insert Value.

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          return \App\Language::translate($moduleName, $moduleName);

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param string $name

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param App\Request $request

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  break;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function validate()

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $response = [];

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param string $fieldName

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          ->indexBy('event_name')->all();

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      foreach ($customTables as $tableName => $index) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          return \App\Language::translate($label, $this->getModule()->getName(true));

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $fieldInstance = $this->getFieldInstanceByName($name);

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return int

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return bool

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param string $name

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $fieldModel = $this->getModule()->getFieldInstanceByName($name);

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  break;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $fieldModel = $this->getFieldInstanceByName($fieldName);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Update activate/remove handler.

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if (!$modules) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $data = ['include_modules' => implode(',', $modules), 'is_active' => 1];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $customTables = $instance->getModule()->customFieldTable;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getDisplayValue(string $name)

          Line exceeds 120 characters; contains 142 characters
          Open

                          return empty($this->get($name)) ? 'LBL_SYSTEM' : \App\Language::translate(\App\PrivilegeUtil::getRoleName($this->get($name)));

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if (\in_array($name, ['conditions', 'assign', 'value', 'roleid'])) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function setDataFromRequest(App\Request $request)

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              case 'conditions':

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  break;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return \self

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $instance->module = $moduleInstance;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          break;

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public static function getCleanInstance()

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return true;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $fieldModel->set('fieldvalue', $this->get($name) ?? '');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $value = \App\Json::encode(\App\Condition::getConditionsFromRequest($request->getArray($fieldName, \App\Purifier::TEXT)));

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $fieldUITypeModel = $fieldModel->getUITypeModel();

          Spaces must be used to indent lines; tabs are not allowed
          Open

              }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      default:

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getDefaultOwner()

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  foreach ($this->getModule()->getEditableFields() as $fieldName) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      if ($request->has($fieldName)) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          switch ($fieldName) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              case 'default_assign':

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $fieldModel = $this->getFieldInstanceByName($fieldName);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->exists();

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function updateHandler()

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $type = 'EntityBeforeSave';

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          if ($queryAll) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          } else {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $instance = new self();

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      case 'tabid':

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      case 'state':

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          return empty($this->get($name)) ? 'LBL_SYSTEM' : \App\Language::translate(\App\PrivilegeUtil::getRoleName($this->get($name)));

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function isActive()

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function returns field instances for given name.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Sets data from request.

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $value = $request->getByType($fieldName, $fieldModel->get('purifyType'));

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $members = $queryAll->column($db);

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

               */

          Spaces must be used to indent lines; tabs are not allowed
          Open

              {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $handlerClass = 'Vtiger_AutoAssign_Handler';

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $modules = (new \App\Db\Query())->select(['vtiger_tab.name'])

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @param string $name

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $fieldModel;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $value = $request->getByType($fieldName, $fieldModel->get('purifyType'));

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          'message' => App\Language::translate('LBL_DUPLICATE', $this->getModule()->getName(true))

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          $query = (new App\Db\Query())

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              ->select(['member' => new \yii\db\Expression('CONCAT(type,\':\', member)')])

          Spaces must be used to indent lines; tabs are not allowed
          Open

                              $queryAll->union($query, true);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $instance->setData($data);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $instance;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $key = 'Clean';

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  \App\Cache::staticSave($cacheName, $key, clone $instance);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      case 'roleid':

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Function checks if record is active.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               *

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getFieldInstanceByName($name)

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

                                  $fieldUITypeModel->validate($value, true);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $isDuplicate = (new App\Db\Query())

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->where(['subject' => $this->get('subject'), 'tabid' => $this->get('tabid')])

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  return $response;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      if (isset($handlers[$type])) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          \App\EventHandler::update($data, $handlers[$type]['eventhandler_id']);

          Line exceeds 120 characters; contains 140 characters
          Open

                          \App\EventHandler::registerHandler($type, $handlerClass, implode(',', $modules), '', 1, true, 0, \App\EventHandler::SYSTEM);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->where(['and', ["{$tableName}.state" => 1], ["{$tableName}.handler" => 1]])->distinct()->column($db);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          ->where(['handler_class' => $handlerClass, 'event_name' => $type])

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return mixed

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      }

          Spaces must be used to indent lines; tabs are not allowed
          Open

              /**

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $tableName = $this->getModule()->baseTable;

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      $handlers = (new \App\Db\Query())->from('vtiger_eventhandlers')

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->from($this->getModule()->baseTable)

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          'result' => false,

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ];

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  }

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * Get pervious value by field.

          Spaces must be used to indent lines; tabs are not allowed
          Open

               * @return void

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  } else {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->andWhere(['not', [$this->getModule()->baseIndex => $this->getId()]])

          Spaces must be used to indent lines; tabs are not allowed
          Open

                          'hoverField' => 'subject',

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      } else {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  $db = \App\Db::getInstance('admin');

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      \App\EventHandler::deleteHandler($handlerClass);

          Spaces must be used to indent lines; tabs are not allowed
          Open

                  if ($isDuplicate) {

          Spaces must be used to indent lines; tabs are not allowed
          Open

                      ->from($tableName)->innerJoin('vtiger_tab', "{$tableName}.tabid=vtiger_tab.tabid")

          Spaces must be used to indent lines; tabs are not allowed
          Open

              public function getPreviousValue(string $fieldName = '')

          Class name "Settings_AutomaticAssignment_Record_Model" is not in camel caps format
          Open

          class Settings_AutomaticAssignment_Record_Model extends Settings_Vtiger_Record_Model

          There are no issues that match your filters.

          Category
          Status