YetiForceCompany/YetiForceCRM

View on GitHub
modules/ModTracker/models/Record.php

Summary

Maintainability
D
2 days
Test Coverage
F
30%

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

<?php
/* +***********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
Severity: Minor
Found in modules/ModTracker/models/Record.php - About 6 hrs to fix

    ModTracker_Record_Model has 38 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ModTracker_Record_Model extends Vtiger_Record_Model
    {
        const UPDATE = 0;
        const DELETE = 1;
        const CREATE = 2;
    Severity: Minor
    Found in modules/ModTracker/models/Record.php - About 5 hrs to fix

      Function getInventoryChanges has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getInventoryChanges()
          {
              if (!isset($this->inventoryChanges)) {
                  $changes = [];
                  if ($this->isCreate() || $this->isUpdate() || $this->isTransferEdit()) {
      Severity: Minor
      Found in modules/ModTracker/models/Record.php - About 4 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

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

      class ModTracker_Record_Model extends Vtiger_Record_Model
      {
          const UPDATE = 0;
          const DELETE = 1;
          const CREATE = 2;
      Severity: Minor
      Found in modules/ModTracker/models/Record.php by phpmd

      Function getUnreviewed has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getUnreviewed($recordsId, $userId = false, $sort = false)
          {
              if (false === $userId) {
                  $userId = \App\User::getCurrentUserId();
              }
      Severity: Minor
      Found in modules/ModTracker/models/Record.php - About 1 hr 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 getLastRelation has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getLastRelation($sourceIds, $sourceModule)
          {
              $colors = Vtiger_HistoryRelation_Widget::$colors;
              if (!\is_array($sourceIds)) {
                  $sourceIds = [$sourceIds];
      Severity: Minor
      Found in modules/ModTracker/models/Record.php - About 1 hr 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 getFieldInstances has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getFieldInstances()
          {
              $fieldInstances = [];
              if ($this->isCreate() || $this->isUpdate() || $this->isTransferEdit()) {
                  $dataReader = (new \App\Db\Query())->from('vtiger_modtracker_detail')->where(['id' => $this->get('id')])->createCommand()->query();
      Severity: Minor
      Found in modules/ModTracker/models/Record.php - About 1 hr 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 getUnreviewed has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getUnreviewed($recordsId, $userId = false, $sort = false)
          {
              if (false === $userId) {
                  $userId = \App\User::getCurrentUserId();
              }
      Severity: Minor
      Found in modules/ModTracker/models/Record.php - About 1 hr to fix

        Method getInventoryChanges has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getInventoryChanges()
            {
                if (!isset($this->inventoryChanges)) {
                    $changes = [];
                    if ($this->isCreate() || $this->isUpdate() || $this->isTransferEdit()) {
        Severity: Minor
        Found in modules/ModTracker/models/Record.php - About 1 hr to fix

          The method getUnreviewed() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
          Open

              public static function getUnreviewed($recordsId, $userId = false, $sort = false)
              {
                  if (false === $userId) {
                      $userId = \App\User::getCurrentUserId();
                  }
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          CyclomaticComplexity

          Since: 0.1

          Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

          Example

          // Cyclomatic Complexity = 11
          class Foo {
          1   public function example() {
          2       if ($a == $b) {
          3           if ($a1 == $b1) {
                          fiddle();
          4           } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                          fiddle();
                      }
          5       } elseif ($c == $d) {
          6           while ($c == $d) {
                          fiddle();
                      }
          7        } elseif ($e == $f) {
          8           for ($n = 0; $n < $h; $n++) {
                          fiddle();
                      }
                  } else {
                      switch ($z) {
          9               case 1:
                              fiddle();
                              break;
          10              case 2:
                              fiddle();
                              break;
          11              case 3:
                              fiddle();
                              break;
                          default:
                              fiddle();
                              break;
                      }
                  }
              }
          }

          Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

          The method getInventoryChanges() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
          Open

              public function getInventoryChanges()
              {
                  if (!isset($this->inventoryChanges)) {
                      $changes = [];
                      if ($this->isCreate() || $this->isUpdate() || $this->isTransferEdit()) {
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          CyclomaticComplexity

          Since: 0.1

          Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

          Example

          // Cyclomatic Complexity = 11
          class Foo {
          1   public function example() {
          2       if ($a == $b) {
          3           if ($a1 == $b1) {
                          fiddle();
          4           } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                          fiddle();
                      }
          5       } elseif ($c == $d) {
          6           while ($c == $d) {
                          fiddle();
                      }
          7        } elseif ($e == $f) {
          8           for ($n = 0; $n < $h; $n++) {
                          fiddle();
                      }
                  } else {
                      switch ($z) {
          9               case 1:
                              fiddle();
                              break;
          10              case 2:
                              fiddle();
                              break;
          11              case 3:
                              fiddle();
                              break;
                          default:
                              fiddle();
                              break;
                      }
                  }
              }
          }

          Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

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

          class ModTracker_Record_Model extends 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.

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

              public function getInventoryChanges()
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by sonar-php

          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

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

          class ModTracker_Record_Model extends Vtiger_Record_Model
          {
              const UPDATE = 0;
              const DELETE = 1;
              const CREATE = 2;
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 '499', column '16').
          Open

                      $row = (new \App\Db\Query())->from('vtiger_modtracker_relations')->where(['id' => $this->get('id')])->one();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 getTotalRecordCount has a boolean flag argument $type, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public static function getTotalRecordCount($recordId, $type = false)
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

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

          The method getUnreviewed has a boolean flag argument $sort, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public static function getUnreviewed($recordsId, $userId = false, $sort = false)
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

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

          The method isReviewed has a boolean flag argument $userId, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function isReviewed($userId = false)
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

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

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

                  $data = (new \App\Db\Query())->from('u_#__timeline')->where(['crmid' => $sourceIds, 'userid' => \App\User::getCurrentUserId()])->createCommand()->queryAllByGroup(1);
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 unsetReviewed has a boolean flag argument $userId, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public static function unsetReviewed($recordId, $userId = false, $exception = false)
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

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

          The method unsetReviewed has a boolean flag argument $exception, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public static function unsetReviewed($recordId, $userId = false, $exception = false)
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

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

          Missing class import via use statement (line '170', column '17').
          Open

                  $query = (new \App\Db\Query())->select(['crmid', 'u' => 'last_reviewed_users'])->from('vtiger_modtracker_basic')
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 setLastRelation has a boolean flag argument $byUser, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public static function setLastRelation($sourceId, $sourceModule, $byUser = false)
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

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

          The method getUnreviewed has a boolean flag argument $userId, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public static function getUnreviewed($recordsId, $userId = false, $sort = false)
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

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

          Missing class import via use statement (line '91', column '15').
          Open

                  $row = (new App\Db\Query())->select(['last_reviewed_users', 'id'])
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 '509', column '15').
          Open

                  return (new \App\Db\Query())->from('vtiger_modtracker_basic')->where(['crmid' => $recordId])->andWhere($where)->count();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 '69', column '17').
          Open

                  $query = (new \App\Db\Query())
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 '116', column '16').
          Open

                  $query = new \App\Db\Query();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 '147', column '29').
          Open

                  $lastReviewedUsers = (new \App\Db\Query())->select(['last_reviewed_users'])->from('vtiger_modtracker_basic')
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 '441', column '26').
          Open

                          $fieldInstance = new ModTracker_Field_Model();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 '463', column '18').
          Open

                          $data = (new \App\Db\Query())->select(['changes'])->from('u_#__modtracker_inv')->where(['id' => $this->get('id')])->scalar();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 '431', column '23').
          Open

                      $dataReader = (new \App\Db\Query())->from('vtiger_modtracker_detail')->where(['id' => $this->get('id')])->createCommand()->query();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 '624', column '17').
          Open

                  $query = (new \App\Db\Query())
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 '15').
          Open

                  $time = new DateTimeField($time);
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 '500', column '28').
          Open

                      $relationInstance = new ModTracker_Relation_Model();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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

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

                      $userId = \App\User::getCurrentUserId();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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_Inventory_Model' in method 'getInventoryChanges'.
          Open

                          $inventoryModel = Vtiger_Inventory_Model::getInstance($this->getParent()->getModuleName());
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 'getModifiedBy'.
          Open

                  return \App\User::getUserModel($this->get('whodid'));
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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_Module_Model' in method 'getModule'.
          Open

                      return Vtiger_Module_Model::getInstance($this->getModuleName());
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 'addConvertToAccountRelation'.
          Open

                      'last_reviewed_users' => '#' . App\User::getCurrentUserRealId() . '#',
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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_Record_Model' in method 'setParent'.
          Open

                  $this->parent = Vtiger_Record_Model::getInstanceById($id, $moduleName);
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 'setLastRelation'.
          Open

                  $db = \App\Db::getInstance();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 'getLastRelation'.
          Open

                  $data = (new \App\Db\Query())->from('u_#__timeline')->where(['crmid' => $sourceIds, 'userid' => \App\User::getCurrentUserId()])->createCommand()->queryAllByGroup(1);
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 assigning values to variables in if clauses and the like (line '438', column '11').
          Open

              public function getFieldInstances()
              {
                  $fieldInstances = [];
                  if ($this->isCreate() || $this->isUpdate() || $this->isTransferEdit()) {
                      $dataReader = (new \App\Db\Query())->from('vtiger_modtracker_detail')->where(['id' => $this->get('id')])->createCommand()->query();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          IfStatementAssignment

          Since: 2.7.0

          Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

          Example

          class Foo
          {
              public function bar($flag)
              {
                  if ($foo = 'bar') { // possible typo
                      // ...
                  }
                  if ($baz = 0) { // always false
                      // ...
                  }
              }
          }

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

          Avoid using static access to class '\vtlib\Functions' in method 'getInventoryChanges'.
          Open

                              if (!\vtlib\Functions::getCRMRecordMetadata($changed['item'])) {
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 'setLastRelation'.
          Open

                  $userId = \App\User::getCurrentUserId();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 'isNewChange'.
          Open

                      $userId = App\User::getCurrentUserId();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 'Users_Record_Model' in method 'isReviewed'.
          Open

                      $currentUser = Users_Record_Model::getCurrentUserModel();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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_HistoryRelation_Widget' in method 'setLastRelation'.
          Open

                  $query = Vtiger_HistoryRelation_Widget::getQuery($sourceId, $sourceModule, Vtiger_HistoryRelation_Widget::getActions());
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 'getInventoryChanges'.
          Open

                          $data = $data ? \App\Json::decode($data) : [];
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 getLastRelation uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                      } else {
                          $type['color'] = false;
                      }
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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\Fields\Owner' in method 'getModifierName'.
          Open

                  return \App\Fields\Owner::getUserLabel($this->get('whodid'));
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 'Users_Record_Model' in method 'unsetReviewed'.
          Open

                      $currentUser = Users_Record_Model::getCurrentUserModel();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 'addConvertToAccountRelation'.
          Open

                  $db = \App\Db::getInstance();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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_HistoryRelation_Widget' in method 'setLastRelation'.
          Open

                  $query = Vtiger_HistoryRelation_Widget::getQuery($sourceId, $sourceModule, Vtiger_HistoryRelation_Widget::getActions());
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 'addConvertToAccountRelation'.
          Open

                  self::unsetReviewed($sourceId, \App\User::getCurrentUserRealId(), $id);
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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 "module" 3 times.
          Open

                      $recordInstance->setData($row)->setParent($row['crmid'], $row['module']);
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by sonar-php

          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 "crmid" 15 times.
          Open

                      ->where(['crmid' => $parentRecordId])
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by sonar-php

          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 "OSSMailView" 3 times.
          Open

                      case 'OSSMailView':
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by sonar-php

          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 "fieldname" 3 times.
          Open

                          if ('record_id' === $row['fieldname'] || 'record_module' === $row['fieldname']) {
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by sonar-php

          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 "postvalue" 5 times.
          Open

                          $row['postvalue'] = html_entity_decode((string) $row['postvalue']);
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by sonar-php

          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 "userid" 3 times.
          Open

                      $where['userid'] = $userId;
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by sonar-php

          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 "status" 10 times.
          Open

                      ->andWhere(['<>', 'status', self::DISPLAYED])
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by sonar-php

          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 "changedon" 6 times.
          Open

                      ->orderBy(['changedon' => SORT_DESC]);
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by sonar-php

          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 "whodid" 3 times.
          Open

                  return \App\User::getUserModel($this->get('whodid'));
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by sonar-php

          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 "vtiger_modtracker_basic" 10 times.
          Open

                      ->from('vtiger_modtracker_basic')
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by sonar-php

          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 "prevalue" 5 times.
          Open

                          $row['prevalue'] = html_entity_decode((string) $row['prevalue']);
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by sonar-php

          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 "u_#__timeline" 3 times.
          Open

                  $db->createCommand()->delete('u_#__timeline', $where)->execute();
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by sonar-php

          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 "last_reviewed_users" 11 times.
          Open

                  $row = (new App\Db\Query())->select(['last_reviewed_users', 'id'])
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by sonar-php

          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.

          Reference to undeclared property \ModTracker_Record_Model->parent
          Open

                  $this->parent = Vtiger_Record_Model::getInstanceById($id, $moduleName);
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phan

          Reference to undeclared property \ModTracker_Record_Model->parent
          Open

                  return $this->parent;
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phan

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

                  $data = (new \App\Db\Query())->from('u_#__timeline')->where(['crmid' => $sourceIds, 'userid' => \App\User::getCurrentUserId()])->createCommand()->queryAllByGroup(1);
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                      'last_reviewed_users' => '#' . App\User::getCurrentUserRealId() . '#',
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                  $query->select(['last_reviewed_users', 'id'])->from('vtiger_modtracker_basic')->where(['crmid' => $recordId])
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                      $userId = App\User::getCurrentUserId();
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                  return \App\User::getUserModel($this->get('whodid'));
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                          $data = (new \App\Db\Query())->select(['changes'])->from('u_#__modtracker_inv')->where(['id' => $this->get('id')])->scalar();
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

          Return type of getModifiedBy() is undeclared type \App\User (Did you mean class \Tests\App\User)
          Open

              public function getModifiedBy()
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phan

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

                  self::unsetReviewed($sourceId, \App\User::getCurrentUserRealId(), $id);
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                      $row = (new \App\Db\Query())->from('vtiger_modtracker_relations')->where(['id' => $this->get('id')])->one();
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                  $data = (new \App\Db\Query())->from('u_#__timeline')->where(['crmid' => $sourceIds, 'userid' => \App\User::getCurrentUserId()])->createCommand()->queryAllByGroup(1);
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                      $query->andWhere(['<>', 'id', $exception]);
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                  $query = (new \App\Db\Query())->select(['crmid', 'u' => 'last_reviewed_users'])->from('vtiger_modtracker_basic')
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                  $userId = \App\User::getCurrentUserId();
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                      return App\Db::getInstance()->createCommand()->update('vtiger_modtracker_basic', ['last_reviewed_users' => $value], ['id' => $row['id']])->execute();
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                  $db->createCommand()->insert('u_#__timeline', [
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

          Reference to undeclared property \ModTracker_Record_Model->inventoryChanges
          Open

                  return $this->inventoryChanges;
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phan

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

                  $db->createCommand()->insert('vtiger_modtracker_basic', [
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

          Returning type false but setLastRelation() is declared to return array
          Open

                      return false;
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phan

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

                  $query = (new \App\Db\Query())
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                  $query = (new \App\Db\Query())
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                  $lastReviewedUsers = (new \App\Db\Query())->select(['last_reviewed_users'])->from('vtiger_modtracker_basic')
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

          Reference to undeclared property \ModTracker_Record_Model->parent
          Open

                  if (empty($this->parent)) {
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phan

          Reference to undeclared property \ModTracker_Record_Model->inventoryChanges
          Open

                      $this->inventoryChanges = $changes;
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phan

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

                      $userId = \App\User::getCurrentUserId();
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                  return \App\Fields\Owner::getUserLabel($this->get('whodid'));
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                  return (new \App\Db\Query())->from('vtiger_modtracker_basic')->where(['crmid' => $recordId])->andWhere($where)->count();
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                      \App\Db::getInstance()->createCommand()
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                  $row = (new App\Db\Query())->select(['last_reviewed_users', 'id'])
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                      $dataReader = (new \App\Db\Query())->from('vtiger_modtracker_detail')->where(['id' => $this->get('id')])->createCommand()->query();
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

          Reference to undeclared property \ModTracker_Record_Model->inventoryChanges
          Open

                  if (!isset($this->inventoryChanges)) {
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phan

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

                  $data = $query->limit(1)->one();
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

                  $db->createCommand()->delete('u_#__timeline', $where)->execute();
          Severity: Critical
          Found in modules/ModTracker/models/Record.php by phan

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

          class ModTracker_Record_Model extends Vtiger_Record_Model

          The class ModTracker_Record_Model is not named in CamelCase.
          Open

          class ModTracker_Record_Model extends Vtiger_Record_Model
          {
              const UPDATE = 0;
              const DELETE = 1;
              const CREATE = 2;
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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

                  $id = $db->getLastInsertID('vtiger_modtracker_basic_id_seq');
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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

          The parameter $current_user is not named in camelCase.
          Open

              public static function addConvertToAccountRelation($sourceModule, $sourceId, $current_user)
              {
                  $db = \App\Db::getInstance();
                  $db->createCommand()->insert('vtiger_modtracker_basic', [
                      'crmid' => $sourceId,
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          CamelCaseParameterName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name parameters.

          Example

          class ClassName {
              public function doSomething($user_name) {
              }
          }

          Source

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

              public function setParent($id, $moduleName)
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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();
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          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

              const LINK = 4;

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

              /**

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

                  12 => 'LBL_TRANSFER_UNLINK',

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

                  13 => 'LBL_TRANSFER_LINK',

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

                  }

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

                  1 => 'LBL_DELETED',

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

               * @param int                 $parentRecordId

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

                  $recordInstances = [];

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

                  while ($row = $dataReader->read()) {

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

                  $dataReader->close();

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

                  0 => 'LBL_UPDATED',

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

                  3 => 'LBL_ACTIVE',

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

                  9 => 'LBL_REMOVED',

          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 (!empty($startWith)) {

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

                  2 => 'LBL_CREATED',

          Line exceeds 120 characters; contains 130 characters
          Open

              public static function getUpdates(int $parentRecordId, Vtiger_Paging_Model $pagingModel, string $type, ?int $startWith = null)

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

                  $where = self::getConditionByType($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

              const DELETE = 1;

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

               * @var 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

              public static function getUpdates(int $parentRecordId, Vtiger_Paging_Model $pagingModel, string $type, ?int $startWith = null)

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

                  11 => 'LBL_TRANSFER_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

                      ->limit($pageLimit)

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

                      $query->andWhere(['>=', 'id', $startWith]);

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

                      $recordInstance = new self();

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

              const CREATE = 2;

          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 history of updates on a record.

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

                      ->orderBy(['changedon' => SORT_DESC]);

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

              const TRANSFER_DELETE = 11;

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

              const TRANSFER_LINK = 13;

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

              const SHOW_HIDDEN_DATA = 14;

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

                  4 => 'LBL_ADDED',

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

               * @param string              $type

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

               * @param int|null            $startWith

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

                  7 => 'LBL_DISPLAYED',

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

               */

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

                      ->andWhere($where)

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

                      $recordInstance->setData($row)->setParent($row['crmid'], $row['module']);

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

               * Status labels.

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

               * @return self[] - list of  ModTracker_Record_Model

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

                      ->from('vtiger_modtracker_basic')

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

                      ->offset($startIndex)

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

              const UPDATE = 0;

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

              const UNLINK = 5;

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

              const TRANSFER_EDIT = 10;

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

                  8 => 'LBL_ARCHIVED',

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

                      $recordInstances[] = $recordInstance;

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

              const ACTIVE = 3;

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

               *

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

                  5 => 'LBL_UNLINK',

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

                  10 => 'LBL_TRANSFER_EDIT',

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

                  14 => 'LBL_SHOW_HIDDEN_DATA',

          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 Vtiger_Paging_Model $pagingModel

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

                  $startIndex = $pagingModel->getStartIndex();

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

              public static function setLastReviewed($recordId)

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

              const REMOVED = 9;

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

                  $pageLimit = $pagingModel->getPageLimit();

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

                      ->where(['crmid' => $parentRecordId])

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

              const CONVERTTOACCOUNT = 6;

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

              const DISPLAYED = 7;

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

              const ARCHIVED = 8;

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

              const TRANSFER_UNLINK = 12;

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

              public static $statusLabel = [

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

                  $dataReader = $query->createCommand()->query();

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

                  6 => 'LBL_CONVERTED_FROM_LEAD',

          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

                  return $recordInstances;

          Line exceeds 120 characters; contains 160 characters
          Open

                          ->update('vtiger_modtracker_basic', ['last_reviewed_users' => '#' . implode('#', array_filter($lastReviewedUsers)) . '#'], ['id' => $row['id']])

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

                          ->orderBy('vtiger_modtracker_basic.crmid ,vtiger_modtracker_basic.id DESC');

          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 (empty($this->parent)) {

          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 (!$userId) {

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

                      $query->andWhere(['<>', 'id', $exception]);

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

                      $lastReviewedUsers = array_filter(explode('#', $row['last_reviewed_users']));

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

                      $value = empty($lastReviewedUsers) ? '' : '#' . implode('#', array_filter($lastReviewedUsers)) . '#';

          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 isNewChange(int $recordId, int $userId = 0): bool

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

                  if (0 === $userId) {

          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 ($exception) {

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

               * @param bool      $sort

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

               */

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

                  $unreviewed = [];

          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

                          } elseif (!isset($row['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

                      case 'Documents':

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

              public static function unsetReviewed($recordId, $userId = false, $exception = false)

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

                      return false === strpos($lastReviewedUsers, "#$userId#");

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

                              ++$mails;

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

                          return 'file.php?module=Documents&action=DownloadFile&record=' . $this->get('crmid');

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

                      ->from('vtiger_modtracker_basic')

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

                      \App\Db::getInstance()->createCommand()

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

               * @param bool|int  $userId

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

                          ->leftJoin('vtiger_modtracker_relations', 'vtiger_modtracker_basic.id = vtiger_modtracker_relations.id')

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

                      $unreviewed[$crmId]['m'] = $mails;

          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

                      ->where(['crmid' => $recordId])

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

                      ->orderBy(['changedon' => SORT_DESC, 'id' => SORT_DESC])

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

               * @param int $userId

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

                  $lastReviewedUsers = (new \App\Db\Query())->select(['last_reviewed_users'])->from('vtiger_modtracker_basic')

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

                  }

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

                      $unreviewed[$crmId]['a'] = $all;

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

                  return $unreviewed;

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

               * Function to get the name of the module to which the record belongs.

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

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

          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 int $recordId

          Line exceeds 120 characters; contains 123 characters
          Open

                          ->leftJoin('vtiger_ossmailview', 'vtiger_modtracker_relations.targetid = vtiger_ossmailview.ossmailviewid')

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

                  while ($row = $dataReader->read()) {

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

               * Function to get the name of the module to which the record belongs.

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

              {

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

                          $action = 'view=Detail';

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

                      $userId = $currentUser->getRealId();

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

                      return App\Db::getInstance()->createCommand()->update('vtiger_modtracker_basic', ['last_reviewed_users' => $value], ['id' => $row['id']])->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

                  return true;

          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

                      $userId = \App\User::getCurrentUserId();

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

                  }

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

                      $changes[$row['crmid']][] = $row;

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

                  foreach ($changes as $crmId => $rows) {

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

                          if (false !== strpos($row['u'], "#$userId#")) {

          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

                      unset($lastReviewedUsers[$key]);

          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

              /**

          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

               * Gets unreviewed entries.

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

                  $query = (new \App\Db\Query())->select(['crmid', 'u' => 'last_reviewed_users'])->from('vtiger_modtracker_basic')

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

                  $dataReader->close();

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

                      foreach ($rows as $row) {

          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('module');

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

                  $row = (new App\Db\Query())->select(['last_reviewed_users', 'id'])

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

                          ->execute();

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

                      ->andWhere(['<>', 'status', self::DISPLAYED])->andWhere(['like', 'last_reviewed_users', "#$userId#"])->orderBy(['changedon' => SORT_DESC, 'id' => SORT_DESC])->limit(1);

          Line exceeds 120 characters; contains 161 characters
          Open

                      return App\Db::getInstance()->createCommand()->update('vtiger_modtracker_basic', ['last_reviewed_users' => $value], ['id' => $row['id']])->execute();

          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

              public static function getUnreviewed($recordsId, $userId = false, $sort = false)

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

                  $dataReader = $query->createCommand()->query();

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

                              ++$all;

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

                      $lastReviewedUsers = explode('#', $row['last_reviewed_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

                      return $row['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

              public function getModule(): Vtiger_Module_Model

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

                      ->where(['crmid' => $recordId])

          Line exceeds 120 characters; contains 124 characters
          Open

                      ->andWhere(['<>', 'status', self::DISPLAYED])->orderBy(['changedon' => SORT_DESC, 'id' => SORT_DESC])->scalar();

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

                      return Vtiger_Module_Model::getInstance($this->getModuleName());

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

               * @return string - Record Detail View Url

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

                  if (false !== $lastReviewedUsers) {

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

               *

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

                          ->leftJoin('vtiger_ossmailview', 'vtiger_modtracker_relations.targetid = vtiger_ossmailview.ossmailviewid')

          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 Detail View url for the 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

              /**

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

                  if (false === $userId) {

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

                  }

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

                      ->where(['crmid' => $recordsId])

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

                          $action = 'view=preview';

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

                      ->andWhere(['<>', 'status', self::DISPLAYED])

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

                  if ($row) {

          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

                      $query->addSelect(['vtiger_ossmailview.type'])

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

                          if (isset($row['type']) && 1 === (int) $row['type']) {

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

               * @return string - Record Module Name

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

                  $moduleName = $this->getModuleName();

          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

                      $currentUser = Users_Record_Model::getCurrentUserModel();

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

                  $query->select(['last_reviewed_users', 'id'])->from('vtiger_modtracker_basic')->where(['crmid' => $recordId])

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

               * Checks if is new changes.

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

                      $userId = App\User::getCurrentUserId();

          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

                  $changes = [];

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

                      $all = $mails = 0;

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

                  switch ($moduleName) {

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

                      ->limit(1)

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

                      $lastReviewedUsers[] = Users_Record_Model::getCurrentUserModel()->getRealId();

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

                          ->update('vtiger_modtracker_basic', ['last_reviewed_users' => '#' . implode('#', array_filter($lastReviewedUsers)) . '#'], ['id' => $row['id']])

          Line exceeds 120 characters; contains 180 characters
          Open

                      ->andWhere(['<>', 'status', self::DISPLAYED])->andWhere(['like', 'last_reviewed_users', "#$userId#"])->orderBy(['changedon' => SORT_DESC, 'id' => SORT_DESC])->limit(1);

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

                      ->andWhere(['<>', 'status', self::DISPLAYED])->orderBy(['changedon' => SORT_DESC, 'id' => SORT_DESC])->scalar();

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

                  if ($sort) {

          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 getModuleName(): string

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

                      case 'OSSMailView':

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

                      ->one();

          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

                  $row = $query->one();

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

                  if ($row) {

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

                      $key = array_search($userId, $lastReviewedUsers);

          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|int[] $recordsId

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

                      ->andWhere(['not in', 'status', [self::DISPLAYED, self::SHOW_HIDDEN_DATA]]);

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

               * @return Vtiger_Module_Model

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

              public function getDetailViewUrl()

          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 $this->checkStatus(self::UNLINK);

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

                  return $this->checkStatus(self::DISPLAYED);

          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 check if status is Transfer.

          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 isTransferLink()

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

              public function isTransferUnLink()

          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 bool

          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

                  }

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

                  return false !== strpos($reviewed, "#$userId#");

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

               * Get status label.

          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 check if status is Transfer.

          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

              public function getModifierName()

          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 checkStatus($callerStatus)

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

                  return $this->checkStatus(self::CONVERTTOACCOUNT);

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

              public function isCreate()

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

              public function isUpdate()

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

                  return $this->checkStatus(self::UPDATE);

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

              public function isRelationUnLink()

          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

                  $time = new DateTimeField($time);

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

              public function isRelationLink()

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

              public function isDisplayed()

          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

                          break;

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

               * Undocumented function.

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

                  return $this;

          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

               * @param string $moduleName

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

                  if ($status == $callerStatus) {

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

              public function isConvertToAccount()

          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 bool

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

               * Get the modifier object.

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

                  return \App\User::getUserModel($this->get('whodid'));

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

                  return "index.php?module=$moduleName&$action&record=" . $this->get('crmid');

          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 check if status is Transfer.

          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 isTransferEdit()

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

                  return $this->checkStatus(static::TRANSFER_EDIT);

          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 (empty($reviewed)) {

          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 setParent($id, $moduleName)

          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

              /**

          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 isReviewed($userId = 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

                  $time = $this->getActivityTime();

          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

               *

          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->checkStatus(self::CREATE);

          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

                  return $this->checkStatus(static::TRANSFER_DELETE);

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

              public function isShowHiddenData()

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

                  return $this->checkStatus(static::SHOW_HIDDEN_DATA);

          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 (false === $userId) {

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

              {

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

                      $userId = $currentUser->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

              public function getDisplayActivityTime()

          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 \in_array($this->get('status'), [1, 3, 8]);

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

                      $currentUser = Users_Record_Model::getCurrentUserModel();

          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\Fields\Owner::getUserLabel($this->get('whodid'));

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

                  return $this->parent;

          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

               * Has changed state.

          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 static::$statusLabel[$this->get('status')];

          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 int    $id

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

              public function getParent()

          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->checkStatus(self::LINK);

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

                  return $this->checkStatus(static::TRANSFER_LINK);

          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->checkStatus(static::TRANSFER_UNLINK);

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

               * Function check if status is Transfer.

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

              public function isTransferDelete()

          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 getModifiedBy()

          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

                  $reviewed = $this->get('last_reviewed_users');

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

              public function getStatusLabel()

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

               * @return \App\User

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

               * Get name for modifier by.

          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 bool

          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

              public function isChangeState()

          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

          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->parent = Vtiger_Record_Model::getInstanceById($id, $moduleName);

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

                  $status = $this->get('status');

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

               * Function check if status is Transfer.

          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

              }

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

               * @return string|bool

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

                  $fieldInstances = [];

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

                              $changes[$key]['historyState'] = empty($changed['prevalue']) ? 'LBL_INV_ADDED' : (empty($changed['postvalue']) ? 'LBL_INV_DELETED' : 'LBL_INV_UPDATED');

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

                                  if ($inventoryModel->isField($fieldName)) {

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

                                      $changes[$key]['data'][$fieldName]['field'] = $inventoryModel->getField($fieldName);

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

              public function getRelationInstance()

          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 $time->getFullcalenderDateTimevalue();

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

                          if (!($fieldModel = $this->getModule()->getFieldByName($row['fieldname']))) {

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

               * Gets inventory changes.

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

                              if (!\vtlib\Functions::getCRMRecordMetadata($changed['item'])) {

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

                                      $changes[$key]['data'][$fieldName]['field'] = $inventoryModel->getField($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

                      $row = (new \App\Db\Query())->from('vtiger_modtracker_relations')->where(['id' => $this->get('id')])->one();

          Line exceeds 120 characters; contains 128 characters
          Open

                  return (new \App\Db\Query())->from('vtiger_modtracker_basic')->where(['crmid' => $recordId])->andWhere($where)->count();

          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 false;

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

              public function getActivityTime()

          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

                      'module' => $sourceModule,

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

                  $query = Vtiger_HistoryRelation_Widget::getQuery($sourceId, $sourceModule, Vtiger_HistoryRelation_Widget::getActions());

          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

                          $fieldInstance->setData($row)->setParent($this->getParent())->setFieldInstance($fieldModel);

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

                      $dataReader->close();

          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 (!isset($this->inventoryChanges)) {

          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 (new \App\Db\Query())->from('vtiger_modtracker_basic')->where(['crmid' => $recordId])->andWhere($where)->count();

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

                          $where = ['not in', 'status', [self::DISPLAYED, self::SHOW_HIDDEN_DATA]];

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

                  $db->createCommand()->insert('vtiger_modtracker_basic', [

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

                      'status' => 6,

          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 getFieldInstances()

          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

                                      $changes[$key]['data'][$fieldName]['postvalue'] = $value;

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

              public static function getConditionByType($type)

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

                      case 'changes':

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

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

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

                      'last_reviewed_users' => '#' . App\User::getCurrentUserRealId() . '#',

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

               * Function sets the closest time-wise related record from selected modules.

          Line exceeds 120 characters; contains 128 characters
          Open

                  $query = Vtiger_HistoryRelation_Widget::getQuery($sourceId, $sourceModule, Vtiger_HistoryRelation_Widget::getActions());

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

               *

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

                      while ($row = $dataReader->read()) {

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

                          $row['prevalue'] = html_entity_decode((string) $row['prevalue']);

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

              }

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

               * @throws \App\Exceptions\AppException

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

                      if ($this->isCreate() || $this->isUpdate() || $this->isTransferEdit()) {

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

              }

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

                  ])->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

                  $userId = \App\User::getCurrentUserId();

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

                  if (!$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

              public function getInventoryChanges()

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

                              $changes[$key]['item'] = $changed['item'];

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

                              foreach ($changed['postvalue'] as $fieldName => $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 \ModTracker_Relation_Model

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

                      $relationInstance->setData($row)->setParent($this);

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

              {

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

                  $where = self::getConditionByType($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

                  self::unsetReviewed($sourceId, \App\User::getCurrentUserRealId(), $id);

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

              public static function setLastRelation($sourceId, $sourceModule, $byUser = 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

                  $where = ['crmid' => $sourceId];

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

                  if ($byUser) {

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

              /**

          Line exceeds 120 characters; contains 143 characters
          Open

                      $dataReader = (new \App\Db\Query())->from('vtiger_modtracker_detail')->where(['id' => $this->get('id')])->createCommand()->query();

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

                          $fieldInstances[] = $fieldInstance;

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

                                  continue;

          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->inventoryChanges;

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

                  if ($this->isRelationLink() || $this->isRelationUnLink() || $this->isTransferLink() || $this->isTransferUnLink()) {

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

                  return $relationInstance;

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

                      'crmid' => $sourceId,

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

                      $where['userid'] = $userId;

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

              {

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

                          $fieldInstance = new ModTracker_Field_Model();

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

                          $inventoryModel = Vtiger_Inventory_Model::getInstance($this->getParent()->getModuleName());

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

               * Function return modtracker relation 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

                  $where = [];

          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

              public static function addConvertToAccountRelation($sourceModule, $sourceId, $current_user)

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

                  $data = $query->limit(1)->one();

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

                              continue;

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

                      $changes = [];

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

                          $data = $data ? \App\Json::decode($data) : [];

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

                              $changes[$key]['data'] = [];

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

                              foreach ($changed['prevalue'] as $fieldName => $value) {

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

                                  if ($inventoryModel->isField($fieldName)) {

          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

                      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

                  }

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

                  if ($this->isCreate() || $this->isUpdate() || $this->isTransferEdit()) {

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

                          }

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

                      $relationInstance = new ModTracker_Relation_Model();

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

                      case 'review':

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

                  return $where;

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

               * @param int    $sourceId

          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 $rows;

          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 \ModTracker_Field_Model[]

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

                      $dataReader = (new \App\Db\Query())->from('vtiger_modtracker_detail')->where(['id' => $this->get('id')])->createCommand()->query();

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

                  return $fieldInstances;

          Line exceeds 120 characters; contains 141 characters
          Open

                          $data = (new \App\Db\Query())->select(['changes'])->from('u_#__modtracker_inv')->where(['id' => $this->get('id')])->scalar();

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

                          foreach ($data as $key => $changed) {

          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 getTotalRecordCount($recordId, $type = false)

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

                      'changedon' => date('Y-m-d H:i:s'),

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

               * @param string $sourceModule

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

                  $type = $data ? $data['type'] : '';

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

               * @param string $sourceModule

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

               * @param int    $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

                  $dataReader = $query->createCommand()->query();

          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

                              }

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

                      $this->inventoryChanges = $changes;

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

                  switch ($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

               *

          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

               */

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

                          if ($result) {

          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['type'] = 'OSSMailView';

          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

                          $data = (new \App\Db\Query())->select(['changes'])->from('u_#__modtracker_inv')->where(['id' => $this->get('id')])->scalar();

          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

                  $id = $db->getLastInsertID('vtiger_modtracker_basic_id_seq');

          Line exceeds 120 characters; contains 173 characters
          Open

                  $data = (new \App\Db\Query())->from('u_#__timeline')->where(['crmid' => $sourceIds, 'userid' => \App\User::getCurrentUserId()])->createCommand()->queryAllByGroup(1);

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

                      if (isset($colors[$type['type']])) {

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

               * Function return Modtracker Field Model.

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

                          $row['postvalue'] = html_entity_decode((string) $row['postvalue']);

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

                          if ('record_id' === $row['fieldname'] || 'record_module' === $row['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

                                      $changes[$key]['data'][$fieldName]['prevalue'] = $value;

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

                                  }

          Line exceeds 120 characters; contains 123 characters
          Open

                  if ($this->isRelationLink() || $this->isRelationUnLink() || $this->isTransferLink() || $this->isTransferUnLink()) {

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

                          $where = ['status' => [self::DISPLAYED, self::SHOW_HIDDEN_DATA]];

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

                      'whodid' => $current_user,

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

               * @param bool   $byUser

          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->createCommand()->insert('u_#__timeline', [

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

                  $data = (new \App\Db\Query())->from('u_#__timeline')->where(['crmid' => $sourceIds, 'userid' => \App\User::getCurrentUserId()])->createCommand()->queryAllByGroup(1);

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

                  }

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

                  $dataReader->close();

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

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

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

                              continue;

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

               */

          Line exceeds 120 characters; contains 172 characters
          Open

                              $changes[$key]['historyState'] = empty($changed['prevalue']) ? 'LBL_INV_ADDED' : (empty($changed['postvalue']) ? 'LBL_INV_DELETED' : 'LBL_INV_UPDATED');

          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

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

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

                      'userid' => $userId,

          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

                      $reSearch = array_diff_key(array_flip($sourceIds), $data);

          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

               * @param string $fieldName

          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

              public static function getFieldHistory(int $record, string $fieldName): array

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

                      ->from('vtiger_modtracker_detail')

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

                      ->leftJoin('vtiger_modtracker_basic', 'vtiger_modtracker_detail.id = vtiger_modtracker_basic.id')

          Line exceeds 120 characters; contains 171 characters
          Open

                      ->where(['vtiger_modtracker_basic.crmid' => $record, 'vtiger_modtracker_detail.fieldname' => $fieldName])->orderBy(['vtiger_modtracker_basic.id' => SORT_ASC]);

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

                      $rows[] = $row;

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

               * Function gets the closest time-wise related record from database.

          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

                      $sourceIds = [$sourceIds];

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

                          $type['color'] = 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

                      if (false !== strpos($type['type'], 'OSSMailView')) {

          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 field history.

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

                  while ($row = $dataReader->read()) {

          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

                      ->where(['vtiger_modtracker_basic.crmid' => $record, 'vtiger_modtracker_detail.fieldname' => $fieldName])->orderBy(['vtiger_modtracker_basic.id' => SORT_ASC]);

          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 (array_keys($reSearch) as $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

                      'crmid' => $sourceId,

          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' => $type,

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

                  return [$sourceId => $type];

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

              public static function getLastRelation($sourceIds, $sourceModule)

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

                  return $data;

          Line exceeds 120 characters; contains 134 characters
          Open

                      ->select(['vtiger_modtracker_basic.changedon', 'vtiger_modtracker_detail.prevalue', 'vtiger_modtracker_detail.postvalue'])

          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->createCommand()->delete('u_#__timeline', $where)->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

                              $data[key($result)]['type'] = current($result);

          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

                  $rows = [];

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

                  ])->execute();

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

               * @param int    $sourceIds

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

                  $colors = Vtiger_HistoryRelation_Widget::$colors;

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

                  if (!\is_array($sourceIds)) {

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

                  foreach ($data as $id => &$type) {

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

                          $type['color'] = $colors[$type['type']];

          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

                  if (\count($data) !== \count($sourceIds)) {

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

                          $result = self::setLastRelation($id, $sourceModule, true);

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

                      ->select(['vtiger_modtracker_basic.changedon', 'vtiger_modtracker_detail.prevalue', 'vtiger_modtracker_detail.postvalue'])

          Class name "ModTracker_Record_Model" is not in camel caps format
          Open

          class ModTracker_Record_Model extends Vtiger_Record_Model

          The variable $current_user is not named in camelCase.
          Open

              public static function addConvertToAccountRelation($sourceModule, $sourceId, $current_user)
              {
                  $db = \App\Db::getInstance();
                  $db->createCommand()->insert('vtiger_modtracker_basic', [
                      'crmid' => $sourceId,
          Severity: Minor
          Found in modules/ModTracker/models/Record.php by phpmd

          CamelCaseVariableName

          Since: 0.2

          It is considered best practice to use the camelCase notation to name variables.

          Example

          class ClassName {
              public function doSomething() {
                  $data_module = new DataModule();
              }
          }

          Source

          There are no issues that match your filters.

          Category
          Status