YetiForceCompany/YetiForceCRM

View on GitHub
modules/HelpDesk/models/Module.php

Summary

Maintainability
F
3 days
Test Coverage
F
0%

Function getHierarchyData has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function getHierarchyData(int $id, array $baseInfo, int $recordId, array &$listviewEntries, bool $getRawData = false, bool $getLinks = true): array
    {
        \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
        $currentUser = Users_Privileges_Model::getCurrentUserModel();
        $hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('HelpDesk', 'DetailView', $recordId);
Severity: Minor
Found in modules/HelpDesk/models/Module.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 HelpDesk_Module_Model has an overall complexity of 54 which is very high. The configured complexity threshold is 50.
Open

class HelpDesk_Module_Model extends Vtiger_Module_Model
{
    /**
     * Function to get list view query for popup window.
     *
Severity: Minor
Found in modules/HelpDesk/models/Module.php by phpmd

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

    public function getParent(int $id, array &$parent, array &$encountered, int $depthBase = 0): array
    {
        \App\Log::trace('Entering getParent(' . $id . ') method ...');
        if ($depthBase === \App\Config::module('HelpDesk', 'MAX_HIERARCHY_DEPTH')) {
            \App\Log::error('Exiting getParent method ... - exceeded maximum depth of hierarchy');
Severity: Minor
Found in modules/HelpDesk/models/Module.php - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function getChild has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function getChild(int $id, array &$childRow, int $depthBase): array
    {
        \App\Log::trace('Entering getChild(' . $id . ',' . $depthBase . ') method ...');
        if (empty($id) || $depthBase === \App\Config::module('HelpDesk', 'MAX_HIERARCHY_DEPTH')) {
            \App\Log::error('Exiting getChild method ... - exceeded maximum depth of hierarchy');
Severity: Minor
Found in modules/HelpDesk/models/Module.php - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method getParent has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getParent(int $id, array &$parent, array &$encountered, int $depthBase = 0): array
    {
        \App\Log::trace('Entering getParent(' . $id . ') method ...');
        if ($depthBase === \App\Config::module('HelpDesk', 'MAX_HIERARCHY_DEPTH')) {
            \App\Log::error('Exiting getParent method ... - exceeded maximum depth of hierarchy');
Severity: Minor
Found in modules/HelpDesk/models/Module.php - About 1 hr to fix

    Method getChild has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getChild(int $id, array &$childRow, int $depthBase): array
        {
            \App\Log::trace('Entering getChild(' . $id . ',' . $depthBase . ') method ...');
            if (empty($id) || $depthBase === \App\Config::module('HelpDesk', 'MAX_HIERARCHY_DEPTH')) {
                \App\Log::error('Exiting getChild method ... - exceeded maximum depth of hierarchy');
    Severity: Minor
    Found in modules/HelpDesk/models/Module.php - About 1 hr to fix

      Method getHierarchyData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getHierarchyData(int $id, array $baseInfo, int $recordId, array &$listviewEntries, bool $getRawData = false, bool $getLinks = true): array
          {
              \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
              $currentUser = Users_Privileges_Model::getCurrentUserModel();
              $hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('HelpDesk', 'DetailView', $recordId);
      Severity: Minor
      Found in modules/HelpDesk/models/Module.php - About 1 hr to fix

        Method getHierarchyData has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function getHierarchyData(int $id, array $baseInfo, int $recordId, array &$listviewEntries, bool $getRawData = false, bool $getLinks = true): array
        Severity: Minor
        Found in modules/HelpDesk/models/Module.php - About 45 mins to fix

          Function getHierarchy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getHierarchy(int $id, bool $getRawData = false, bool $getLinks = true): array
              {
                  $listviewHeader = [];
                  $listviewEntries = [];
                  if ('Active' === \App\Record::getState($id)) {
          Severity: Minor
          Found in modules/HelpDesk/models/Module.php - About 45 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

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

              public function getChildIds(int $id, &$childIds = []): array
              {
                  $recordsIds = (new App\Db\Query())->select([
                      'vtiger_troubletickets.ticketid',
                  ])->from('vtiger_troubletickets')
          Severity: Minor
          Found in modules/HelpDesk/models/Module.php - About 35 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

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

              public function getParent(int $id, array &$parent, array &$encountered, int $depthBase = 0): array
              {
                  \App\Log::trace('Entering getParent(' . $id . ') method ...');
                  if ($depthBase === \App\Config::module('HelpDesk', 'MAX_HIERARCHY_DEPTH')) {
                      \App\Log::error('Exiting getParent method ... - exceeded maximum depth of hierarchy');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 getChild() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
          Open

              public function getChild(int $id, array &$childRow, int $depthBase): array
              {
                  \App\Log::trace('Entering getChild(' . $id . ',' . $depthBase . ') method ...');
                  if (empty($id) || $depthBase === \App\Config::module('HelpDesk', 'MAX_HIERARCHY_DEPTH')) {
                      \App\Log::error('Exiting getChild method ... - exceeded maximum depth of hierarchy');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 getHierarchyData() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
          Open

              public function getHierarchyData(int $id, array $baseInfo, int $recordId, array &$listviewEntries, bool $getRawData = false, bool $getLinks = true): array
              {
                  \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
                  $currentUser = Users_Privileges_Model::getCurrentUserModel();
                  $hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('HelpDesk', 'DetailView', $recordId);
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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

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

              public function getParent(int $id, array &$parent, array &$encountered, int $depthBase = 0): array
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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

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

              public function getHierarchyData(int $id, array $baseInfo, int $recordId, array &$listviewEntries, bool $getRawData = false, bool $getLinks = true): array
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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

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

              public function getChild(int $id, array &$childRow, int $depthBase): array
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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 HelpDesk_Module_Model has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13.
          Open

          class HelpDesk_Module_Model extends Vtiger_Module_Model
          {
              /**
               * Function to get list view query for popup window.
               *
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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

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

              public function getHierarchy(int $id, bool $getRawData = false, bool $getLinks = true): array
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 '27', column '55').
          Open

                          ['not in', 'vtiger_troubletickets.ticketid', (new App\Db\Query())->select(['relcrmid'])->from('vtiger_crmentityrel')->where(['crmid' => $record])],
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 '162', column '8').
          Open

                      new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END as user_name"),
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 getHierarchy has a boolean flag argument $getLinks, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function getHierarchy(int $id, bool $getRawData = false, bool $getLinks = true): array
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 getHierarchyData has a boolean flag argument $getLinks, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function getHierarchyData(int $id, array $baseInfo, int $recordId, array &$listviewEntries, bool $getRawData = false, bool $getLinks = true): array
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 '28', column '55').
          Open

                          ['not in', 'vtiger_troubletickets.ticketid', (new App\Db\Query())->select(['crmid'])->from('vtiger_crmentityrel')->where(['relcrmid' => $record])],
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 getHierarchyData has a boolean flag argument $getRawData, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function getHierarchyData(int $id, array $baseInfo, int $recordId, array &$listviewEntries, bool $getRawData = false, bool $getLinks = true): array
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 '160', column '15').
          Open

                  $row = (new App\Db\Query())->select([
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 '274', column '22').
          Open

                  $recordsIds = (new App\Db\Query())->select([
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 '223', column '8').
          Open

                      new \yii\db\Expression("CASE when (vtiger_users.user_name NOT LIKE '') THEN $userNameSql ELSE vtiger_groups.groupname END as user_name"),
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 '221', column '22').
          Open

                  $dataReader = (new App\Db\Query())->select([
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Field' in method 'getHierarchy'.
          Open

                          if (\App\Field::getFieldPermission('HelpDesk', $colname)) {
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Privilege' in method 'getHierarchyData'.
          Open

                  $hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('HelpDesk', 'DetailView', $recordId);
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Record' in method 'getHierarchy'.
          Open

                  if ('Active' === \App\Record::getState($id)) {
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 getHierarchyData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  $data = '<strong>' . $data . '</strong>';
                              }
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 'Users_Privileges_Model' in method 'getHierarchyData'.
          Open

                  $currentUser = Users_Privileges_Model::getCurrentUserModel();
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Module' in method 'getParent'.
          Open

                  $userNameSql = App\Module::getSqlForNameInDisplayFormat('Users');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Language' in method 'getParent'.
          Open

                              $parentInfo[$columnname] = App\Language::translate($row['priority'], 'HelpDesk');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Config' in method 'getHierarchyData'.
          Open

                  $listColumns = \App\Config::module('HelpDesk', 'COLUMNS_IN_HIERARCHY');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Log' in method 'getParent'.
          Open

                      \App\Log::error('Exiting getParent method ... - exceeded maximum depth of hierarchy');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Language' in method 'getHierarchy'.
          Open

                              $listviewHeader[] = App\Language::translate($fieldname, 'HelpDesk');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Config' in method 'getParent'.
          Open

                  if ($depthBase === \App\Config::module('HelpDesk', 'MAX_HIERARCHY_DEPTH')) {
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Config' in method 'getHierarchy'.
          Open

                      $listColumns = \App\Config::module('HelpDesk', 'COLUMNS_IN_HIERARCHY');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Log' in method 'getHierarchyData'.
          Open

                  \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Field' in method 'getHierarchyData'.
          Open

                      if (\App\Field::getFieldPermission('HelpDesk', $colname)) {
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 getParent uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                          } else {
                              $parentInfo[$columnname] = $row[$columnname];
                          }
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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

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

                                      } else {
                                          $data = '<span>' . $data . '&nbsp;<span class="fas fa-exclamation-circle"></span></span>';
                                      }
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Log' in method 'getParent'.
          Open

                  \App\Log::trace('Entering getParent(' . $id . ') method ...');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Purifier' in method 'getHierarchyData'.
          Open

                          $data = \App\Purifier::encodeHtml($baseInfo[$colname]);
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Config' in method 'getParent'.
          Open

                      $listColumns = \App\Config::module('HelpDesk', 'COLUMNS_IN_HIERARCHY');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Log' in method 'getChild'.
          Open

                  \App\Log::trace('Entering getChild(' . $id . ',' . $depthBase . ') method ...');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Language' in method 'getParent'.
          Open

                              $parentInfo[$columnname] = App\Language::translate($row['status'], 'HelpDesk');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Log' in method 'getParent'.
          Open

                  \App\Log::trace('Exiting getParent method ...');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Log' in method 'getHierarchyData'.
          Open

                  \App\Log::trace('Exiting getHierarchyData method ...');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 getChildIds uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                      } else {
                          $childIds[] = $recordsIds;
                          $this->getChildIds($recordsIds, $childIds);
                      }
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Config' in method 'getChild'.
          Open

                  if (empty($id) || $depthBase === \App\Config::module('HelpDesk', 'MAX_HIERARCHY_DEPTH')) {
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 getChild uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
          Open

                              } else {
                                  $childSalesProcessesInfo[$columnname] = $row[$columnname];
                              }
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Log' in method 'getChild'.
          Open

                      \App\Log::error('Exiting getChild method ... - exceeded maximum depth of hierarchy');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Module' in method 'getChild'.
          Open

                  $userNameSql = App\Module::getSqlForNameInDisplayFormat('Users');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Language' in method 'getChild'.
          Open

                                  $childSalesProcessesInfo[$columnname] = App\Language::translate($row['priority'], 'HelpDesk');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Privilege' in method 'massUpdateStatus'.
          Open

                      if (\App\Privilege::isPermitted('HelpDesk', 'EditView', $recordId)) {
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Log' in method 'getChild'.
          Open

                  \App\Log::trace('Exiting getChild method ...');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Language' in method 'getChild'.
          Open

                                  $childSalesProcessesInfo[$columnname] = App\Language::translate($row['status'], 'HelpDesk');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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\Config' in method 'getChild'.
          Open

                  $listColumns = \App\Config::module('HelpDesk', 'COLUMNS_IN_HIERARCHY');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 'massUpdateStatus'.
          Open

                          $recordModel = Vtiger_Record_Model::getInstanceById($recordId, 'HelpDesk');
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 "HelpDesk" 16 times.
          Open

                      $listColumns = \App\Config::module('HelpDesk', 'COLUMNS_IN_HIERARCHY');
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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_crmentity.crmid = vtiger_troubletickets.ticketid" 3 times.
          Open

                      ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = vtiger_troubletickets.ticketid')
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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_troubletickets.ticketid" 5 times.
          Open

                          ['not in', 'vtiger_troubletickets.ticketid', (new App\Db\Query())->select(['relcrmid'])->from('vtiger_crmentityrel')->where(['crmid' => $record])],
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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 "ticketstatus" 3 times.
          Open

                          } elseif ('ticketstatus' === $columnname) {
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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_users.id = vtiger_crmentity.smownerid" 3 times.
          Open

                      ->leftJoin('vtiger_users', 'vtiger_users.id = vtiger_crmentity.smownerid')
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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_crmentity" 3 times.
          Open

                      ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = vtiger_troubletickets.ticketid')
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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_groups.groupid = vtiger_crmentity.smownerid" 3 times.
          Open

                      ->leftJoin('vtiger_groups', 'vtiger_groups.groupid = vtiger_crmentity.smownerid')
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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 "depth" 5 times.
          Open

                      $rows[$baseId] = $this->getChild($baseId, $rows[$baseId], $rows[$baseId]['depth']);
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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_crmentity.deleted" 3 times.
          Open

                      ->where(['vtiger_crmentity.deleted' => 0, 'vtiger_troubletickets.ticketid' => $id])
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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 ") method ..." 3 times.
          Open

                  \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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_groups" 3 times.
          Open

                      ->leftJoin('vtiger_groups', 'vtiger_groups.groupid = vtiger_crmentity.smownerid')
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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 "COLUMNS_IN_HIERARCHY" 4 times.
          Open

                      $listColumns = \App\Config::module('HelpDesk', 'COLUMNS_IN_HIERARCHY');
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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_troubletickets" 3 times.
          Open

                  ])->from('vtiger_troubletickets')
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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_users" 3 times.
          Open

                      ->leftJoin('vtiger_users', 'vtiger_users.id = vtiger_crmentity.smownerid')
          Severity: Critical
          Found in modules/HelpDesk/models/Module.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.

          Avoid unused parameters such as '$field'.
          Open

              public function getQueryByModuleField($sourceModule, $field, $record, App\QueryGenerator $queryGenerator)
          Severity: Minor
          Found in modules/HelpDesk/models/Module.php by phpmd

          UnusedFormalParameter

          Since: 0.2

          Avoid passing parameters to methods or constructors and then not using those parameters.

          Example

          class Foo
          {
              private function bar($howdy)
              {
                  // $howdy is not used
              }
          }

          Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

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

                  \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

          Saw an @param annotation for childRow, but it was not found in the param list of function getChildIds(int $id, array &$childIds = null) : array
          Open

               * @param array $childRow
          Severity: Info
          Found in modules/HelpDesk/models/Module.php by phan

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

                      \App\Log::error('Exiting getChild method ... - exceeded maximum depth of hierarchy');
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

          Call to method addNativeCondition from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
          Open

                      $queryGenerator->addNativeCondition([
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

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

                  \App\Log::trace('Entering getParent(' . $id . ') method ...');
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

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

                      new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END as user_name"),
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

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

                  $recordsIds = (new App\Db\Query())->select([
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

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

                          ['not in', 'vtiger_troubletickets.ticketid', (new App\Db\Query())->select(['crmid'])->from('vtiger_crmentityrel')->where(['relcrmid' => $record])],
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

          Reference to undeclared property \CRMEntity->list_fields_name
          Open

                      $listColumns = $this->getEntityInstance()->list_fields_name;
          Severity: Minor
          Found in modules/HelpDesk/models/Module.php by phan

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

                  \App\Log::trace('Entering getChild(' . $id . ',' . $depthBase . ') method ...');
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

          Reference to undeclared property \CRMEntity->list_fields_name
          Open

                          $listColumns = $this->getEntityInstance()->list_fields_name;
          Severity: Minor
          Found in modules/HelpDesk/models/Module.php by phan

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

                  \App\Log::trace('Exiting getHierarchyData method ...');
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

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

                  $dataReader = (new App\Db\Query())->select([
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

          Reference to undeclared property \CRMEntity->list_fields_name
          Open

                      $listColumns = $this->getEntityInstance()->list_fields_name;
          Severity: Minor
          Found in modules/HelpDesk/models/Module.php by phan

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

                          ['not in', 'vtiger_troubletickets.ticketid', (new App\Db\Query())->select(['relcrmid'])->from('vtiger_crmentityrel')->where(['crmid' => $record])],
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

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

                  \App\Log::trace('Exiting getChild method ...');
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

          Saw an @param annotation for depthBase, but it was not found in the param list of function getChildIds(int $id, array &$childIds = null) : array
          Open

               * @param int   $depthBase
          Severity: Info
          Found in modules/HelpDesk/models/Module.php by phan

          Parameter $queryGenerator has undeclared type \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
          Open

              public function getQueryByModuleField($sourceModule, $field, $record, App\QueryGenerator $queryGenerator)
          Severity: Minor
          Found in modules/HelpDesk/models/Module.php by phan

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

                  $row = (new App\Db\Query())->select([
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

          Reference to undeclared property \CRMEntity->list_fields_name
          Open

                          $listColumns = $this->getEntityInstance()->list_fields_name;
          Severity: Minor
          Found in modules/HelpDesk/models/Module.php by phan

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

                      new \yii\db\Expression("CASE when (vtiger_users.user_name NOT LIKE '') THEN $userNameSql ELSE vtiger_groups.groupname END as user_name"),
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

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

                      \App\Log::error('Exiting getParent method ... - exceeded maximum depth of hierarchy');
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

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

                  \App\Log::trace('Exiting getParent method ...');
          Severity: Critical
          Found in modules/HelpDesk/models/Module.php by phan

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

                  foreach ($listColumns as $colname) {
                      if (\App\Field::getFieldPermission('HelpDesk', $colname)) {
                          $data = \App\Purifier::encodeHtml($baseInfo[$colname]);
                          if (false === $getRawData && 'ticket_no' === $colname) {
                              if ($recordId != $id) {
          Severity: Major
          Found in modules/HelpDesk/models/Module.php and 3 other locations - About 4 hrs to fix
          modules/IStorages/IStorages.php on lines 131..153
          modules/MultiCompany/MultiCompany.php on lines 125..147
          modules/Project/Project.php on lines 187..207

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 178.

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

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

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

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

          Refactorings

          Further Reading

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

                          foreach ($listColumns as $columnname) {
                              if ('assigned_user_id' === $columnname) {
                                  $childSalesProcessesInfo[$columnname] = $row['user_name'];
                              } elseif ('ticket_title' === $columnname) {
                                  $childSalesProcessesInfo[$columnname] = $row['title'];
          Severity: Major
          Found in modules/HelpDesk/models/Module.php and 1 other location - About 2 hrs to fix
          modules/HelpDesk/models/Module.php on lines 185..197

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 137.

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

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

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

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

          Refactorings

          Further Reading

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

                      foreach ($listColumns as $columnname) {
                          if ('assigned_user_id' === $columnname) {
                              $parentInfo[$columnname] = $row['user_name'];
                          } elseif ('ticket_title' === $columnname) {
                              $parentInfo[$columnname] = $row['title'];
          Severity: Major
          Found in modules/HelpDesk/models/Module.php and 1 other location - About 2 hrs to fix
          modules/HelpDesk/models/Module.php on lines 240..252

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 137.

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

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

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

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

          Refactorings

          Further Reading

          Avoid excessively long variable names like $childSalesProcessesInfo. Keep variable name length under 20.
          Open

                          $childSalesProcessesInfo = [];
          Severity: Minor
          Found in modules/HelpDesk/models/Module.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

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

          class HelpDesk_Module_Model extends Vtiger_Module_Model

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

              public function getHierarchy(int $id, bool $getRawData = false, bool $getLinks = true): array
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 class HelpDesk_Module_Model is not named in CamelCase.
          Open

          class HelpDesk_Module_Model extends Vtiger_Module_Model
          {
              /**
               * Function to get list view query for popup window.
               *
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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

              public function getChild(int $id, array &$childRow, int $depthBase): array
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 $id. Configured minimum length is 3.
          Open

              public function getHierarchyIds(int $id, string $selectedRecords = 'all'): array
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 $id. Configured minimum length is 3.
          Open

              public function getHierarchyData(int $id, array $baseInfo, int $recordId, array &$listviewEntries, bool $getRawData = false, bool $getLinks = true): array
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 $id. Configured minimum length is 3.
          Open

              public function getParent(int $id, array &$parent, array &$encountered, int $depthBase = 0): array
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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 $id. Configured minimum length is 3.
          Open

              public function getChildIds(int $id, &$childIds = []): array
          Severity: Minor
          Found in modules/HelpDesk/models/Module.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

               */

          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

                      $encountered = [$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

               * @param bool  $getLinks

          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 $recordIds ?? [];

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

              public function getHierarchyData(int $id, array $baseInfo, int $recordId, array &$listviewEntries, bool $getRawData = false, bool $getLinks = true): 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

                  $infoData = [];

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

                              $data = $rowDepth . $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

                      $recordIds[] = $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

                  if (empty($listColumns)) {

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

                          $data = \App\Purifier::encodeHtml($baseInfo[$colname]);

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

                          'and',

          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 getHierarchy(int $id, bool $getRawData = false, bool $getLinks = true): array

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

                  return ['header' => $listviewHeader, 'entries' => $listviewEntries];

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

               *

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

                  $recordIds = array_merge($recordIds, $this->getChildIds($id));

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

               * @param int   $recordId

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

                      $listColumns = $this->getEntityInstance()->list_fields_name;

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

                  foreach ($listColumns as $colname) {

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

                                          $data = '<a href="index.php?module=HelpDesk&action=DetailView&record=' . $recordId . '">' . $data . '</a>';

          Line exceeds 120 characters; contains 139 characters
          Open

                                          $data = '<a href="index.php?module=HelpDesk&action=DetailView&record=' . $recordId . '">' . $data . '</a>';

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

                      if (\is_array($rowInfo) && (int) $accId) {

          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 \App\QueryGenerator $queryGenerator

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

                  }

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

               * @param int    $id

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

              /**

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

               * @param array $baseInfo

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

                          if (false === $getRawData && 'ticket_no' === $colname) {

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

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

                          $infoData[] = $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

               * Function to get records hierarchy in array format.

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

                      $listColumns = \App\Config::module('HelpDesk', 'COLUMNS_IN_HIERARCHY');

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

                      if (empty($listColumns)) {

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

                  foreach ($baseInfo as $accId => $rowInfo) {

          Line exceeds 120 characters; contains 124 characters
          Open

                          $listviewEntries = $this->getHierarchyData($id, $rowInfo, $accId, $listviewEntries, $getRawData, $getLinks);

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

               * Function to get list view query for popup window.

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

                          ['not in', 'vtiger_troubletickets.ticketid', (new App\Db\Query())->select(['crmid'])->from('vtiger_crmentityrel')->where(['relcrmid' => $record])],

          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

                      $baseId = current(array_keys($rows));

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

                      $rows[$baseId] = $this->getChild($baseId, $rows[$baseId], $rows[$baseId]['depth']);

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

                  $encountered = [$id];

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

               * @param array $listviewEntries

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

                                          $data = '<span>' . $data . '&nbsp;<span class="fas fa-exclamation-circle"></span></span>';

          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

              {

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

                          ['not in', 'vtiger_troubletickets.ticketid', (new App\Db\Query())->select(['relcrmid'])->from('vtiger_crmentityrel')->where(['crmid' => $record])],

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

               * @param bool $getLinks

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

                          $listColumns = $this->getEntityInstance()->list_fields_name;

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

                  }

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

               * @param string $selectedRecords

          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 getHierarchyIds(int $id, string $selectedRecords = 'all'): array

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

                      $id = key($this->getParent($id, $rows, $encountered));

          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

                  \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');

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

                                      if ($hasRecordViewAccess) {

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

               * @param string              $sourceModule   Parent module

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

               * @param string              $record         parent 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

                      $rows = $this->getParent($id, $rows, $encountered);

          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 = $recordIds = [];

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

                  $hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('HelpDesk', 'DetailView', $recordId);

          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

                  $listviewHeader = [];

          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

               * @throws ReflectionException

          Line exceeds 120 characters; contains 127 characters
          Open

                  $hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('HelpDesk', 'DetailView', $recordId);

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

                              }

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

                  $listviewEntries[$recordId] = $infoData;

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

                  if (\in_array($sourceModule, ['Assets', 'Project', 'ServiceContracts', 'Services'])) {

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

                      $queryGenerator->addNativeCondition([

          Line exceeds 120 characters; contains 163 characters
          Open

                          ['not in', 'vtiger_troubletickets.ticketid', (new App\Db\Query())->select(['relcrmid'])->from('vtiger_crmentityrel')->where(['crmid' => $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

                          if (\App\Field::getFieldPermission('HelpDesk', $colname)) {

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

               * @param bool  $getRawData

          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              $field          parent fieldname

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

                  $listColumns = \App\Config::module('HelpDesk', 'COLUMNS_IN_HIERARCHY');

          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 getQueryByModuleField($sourceModule, $field, $record, App\QueryGenerator $queryGenerator)

          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 ($listColumns as $fieldname => $colname) {

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

               */

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

                  $currentUser = Users_Privileges_Model::getCurrentUserModel();

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

                                  $data = '<strong>' . $data . '</strong>';

          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 ('all' === $selectedRecords) {

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

               *

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

                                  }

          Line exceeds 120 characters; contains 163 characters
          Open

                          ['not in', 'vtiger_troubletickets.ticketid', (new App\Db\Query())->select(['crmid'])->from('vtiger_crmentityrel')->where(['relcrmid' => $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

               * @param bool $getRawData

          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

                  $listviewEntries = [];

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

                  if ('Active' === \App\Record::getState($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

               * Function to return hierarchy ids of given parent 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

                                  if ($getLinks) {

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

                              $rowDepth = str_repeat(' .. ', $baseInfo['depth']);

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

                          $listviewEntries = $this->getHierarchyData($id, $rowInfo, $accId, $listviewEntries, $getRawData, $getLinks);

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

                          } elseif ('ticket_title' === $columnname) {

          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

                  $userNameSql = App\Module::getSqlForNameInDisplayFormat('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

              /**

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

                  $recordsIds = (new App\Db\Query())->select([

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

                      ->where(['and', ['vtiger_crmentity.deleted' => 0], ['vtiger_troubletickets.parentid' => $id], ['not', ['vtiger_troubletickets.ticketid' => $id]]])

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

                              $listviewHeader[] = App\Language::translate($fieldname, 'HelpDesk');

          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 = [$baseId => $rows[$baseId]];

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

                      $this->getHierarchyData($id, $rows[$baseId], $baseId, $listviewEntries, $getRawData, $getLinks);

          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

               * Function to create array of all the records in the hierarchy.

          Line exceeds 120 characters; contains 158 characters
          Open

              public function getHierarchyData(int $id, array $baseInfo, int $recordId, array &$listviewEntries, bool $getRawData = false, bool $getLinks = true): array

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

                      if (\App\Field::getFieldPermission('HelpDesk', $colname)) {

          Line exceeds 120 characters; contains 122 characters
          Open

                                          $data = '<span>' . $data . '&nbsp;<span class="fas fa-exclamation-circle"></span></span>';

          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

                          $encountered[] = $parentid;

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

                          } elseif ('ticketstatus' === $columnname) {

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

                              $parentInfo[$columnname] = App\Language::translate($row['priority'], 'HelpDesk');

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

              {

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

                      ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = vtiger_troubletickets.ticketid')

          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

                      if ('' !== $parentid && 0 != $parentid && !\in_array($parentid, $encountered)) {

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

                  return $parent;

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

              public function getChild(int $id, array &$childRow, int $depthBase): array

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

                  if (empty($id) || $depthBase === \App\Config::module('HelpDesk', 'MAX_HIERARCHY_DEPTH')) {

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

                  $listColumns = \App\Config::module('HelpDesk', 'COLUMNS_IN_HIERARCHY');

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

                  }

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

                      $depth = $depthBase + 1;

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

                          $childSalesProcessesInfo['depth'] = $depth;

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

                              if ('assigned_user_id' === $columnname) {

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

                                  $childSalesProcessesInfo[$columnname] = App\Language::translate($row['priority'], 'HelpDesk');

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

               * @param array $childRow

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

              public function getChildIds(int $id, &$childIds = []): array

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

                              $childIds[] = $recordId;

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

                  return \is_array($childIds) ? $childIds : [$childIds];

          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 Recursively get all the upper records of a given.

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

               *

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

                              $parentInfo[$columnname] = $row['user_name'];

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

               * @param array $childRow

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

                          $childRow[$childAccId] = $childSalesProcessesInfo;

          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

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

               * @param int[] $encountered

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

              public function getParent(int $id, array &$parent, array &$encountered, int $depthBase = 0): array

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

                      return $parent;

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

                      $parentid = $row['parentid'];

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

                      if (isset($parent[$parentid])) {

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

               * Function to Recursively get all the child records of a given record.

          Line exceeds 120 characters; contains 149 characters
          Open

                      new \yii\db\Expression("CASE when (vtiger_users.user_name NOT LIKE '') THEN $userNameSql ELSE vtiger_groups.groupname END as user_name"),

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

                                  $childSalesProcessesInfo[$columnname] = $row['user_name'];

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

                              } elseif ('ticketstatus' === $columnname) {

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

                              } elseif ('ticketpriorities' === $columnname) {

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

                      ->leftJoin('vtiger_users', 'vtiger_users.id = vtiger_crmentity.smownerid')

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

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

                  $userNameSql = App\Module::getSqlForNameInDisplayFormat('Users');

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

                      ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = vtiger_troubletickets.ticketid')

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

                              $parentInfo[$columnname] = $row['title'];

          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

                      $parentInfo = [];

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

                      }

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

                      \App\Log::error('Exiting getChild method ... - exceeded maximum depth of hierarchy');

          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

                  \App\Log::trace('Entering getChild(' . $id . ',' . $depthBase . ') method ...');

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

                  $dataReader = (new App\Db\Query())->select([

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

                  if ($dataReader->count() > 0) {

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

                          $childSalesProcessesInfo = [];

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

                      ->leftJoin('vtiger_groups', 'vtiger_groups.groupid = vtiger_crmentity.smownerid')

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

                          foreach ($listColumns as $columnname) {

          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

                              } elseif ('ticket_title' === $columnname) {

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

                  if (!empty($recordsIds)) {

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

               * @param string $status

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

                  \App\Log::trace('Entering getParent(' . $id . ') method ...');

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

                      \App\Log::error('Exiting getParent method ... - exceeded maximum depth of hierarchy');

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

                      $depth = 0;

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

                      $parentInfo['depth'] = $depth;

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

                      'vtiger_troubletickets.*',

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

                  ])->from('vtiger_troubletickets')

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

                                  $childSalesProcessesInfo[$columnname] = $row[$columnname];

          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

                              $this->getChildIds($recordId, $childIds);

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

                          }

          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 $recordsType

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

                  }

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

                      'vtiger_troubletickets.*',

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

                      ->leftJoin('vtiger_groups', 'vtiger_groups.groupid = vtiger_crmentity.smownerid')

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

                      $listColumns = \App\Config::module('HelpDesk', 'COLUMNS_IN_HIERARCHY');

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

                      foreach ($listColumns as $columnname) {

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

                          if ('assigned_user_id' === $columnname) {

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

                  }

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

                  \App\Log::trace('Exiting getParent method ...');

          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

                  if (empty($listColumns)) {

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

                          $childAccId = $row['ticketid'];

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

                                  $childSalesProcessesInfo[$columnname] = $row['title'];

          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

               * Function to mass update status for given parent 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 ($depthBase === \App\Config::module('HelpDesk', 'MAX_HIERARCHY_DEPTH')) {

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

                  }

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

                          $listColumns = $this->getEntityInstance()->list_fields_name;

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

                          }

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

               * @return array

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

                      ->leftJoin('vtiger_groups', 'vtiger_groups.groupid = vtiger_crmentity.smownerid')

          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

                  \App\Log::trace('Exiting getChild method ...');

          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

                      'vtiger_troubletickets.ticketid',

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

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

                  $row = (new App\Db\Query())->select([

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

                      new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END as user_name"),

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

                          } elseif ('ticketpriorities' === $columnname) {

          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_users', 'vtiger_users.id = vtiger_crmentity.smownerid')

          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

                      ->leftJoin('vtiger_users', 'vtiger_users.id = vtiger_crmentity.smownerid')

          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

                      $parent[$id] = $parentInfo;

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

                          $this->getChild($childAccId, $childRow[$childAccId], $depth);

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

               * @param int   $depthBase

          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

              /**

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

                      $listColumns = $this->getEntityInstance()->list_fields_name;

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

               */

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

                      if (\App\Privilege::isPermitted('HelpDesk', 'EditView', $recordId)) {

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

                                  $childSalesProcessesInfo[$columnname] = App\Language::translate($row['status'], 'HelpDesk');

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

              public function massUpdateStatus(int $recordId, string $recordsType, string $status): bool

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

                          $recordModel = Vtiger_Record_Model::getInstanceById($recordId, 'HelpDesk');

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

               * @param array $parent

          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

                      return $childRow;

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

                  return $childRow;

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

               * @param array $childIds

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

               * @param int   $depthBase

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

                          $childIds[] = $recordsIds;

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

                          $this->getChildIds($recordsIds, $childIds);

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

                              $parentInfo[$columnname] = $row[$columnname];

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

               * @param int   $id

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

                      }

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

                          $recordModel->save();

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

               * @param int   $depthBase

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

                  ])->from('vtiger_troubletickets')

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

                      if (\is_array($recordsIds)) {

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

                  foreach ($this->getHierarchyIds($recordId, $recordsType) as $recordId) {

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

                  \App\Log::trace('Exiting getHierarchyData method ...');

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

              }

          Line exceeds 120 characters; contains 149 characters
          Open

                      new \yii\db\Expression("CASE when (vtiger_users.user_name not like '') THEN $userNameSql ELSE vtiger_groups.groupname END as user_name"),

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

                  ])->from('vtiger_troubletickets')

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

                          $this->getParent($parentid, $parent, $encountered, $depthBase + 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

              {

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

                      ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = vtiger_troubletickets.ticketid')

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

               *

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

                          $recordModel->set('ticketstatus', $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

                      ->where(['vtiger_crmentity.deleted' => 0, 'vtiger_troubletickets.ticketid' => $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

                          $depth = $parent[$parentid]['depth'] + 1;

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

                      if (empty($listColumns)) {

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

                              $parentInfo[$columnname] = App\Language::translate($row['status'], 'HelpDesk');

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

                      new \yii\db\Expression("CASE when (vtiger_users.user_name NOT LIKE '') THEN $userNameSql ELSE vtiger_groups.groupname END as user_name"),

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

                      ->where(['vtiger_crmentity.deleted' => 0, 'vtiger_troubletickets.parentid' => $id])

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

                      ->createCommand()->query();

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

               * Function to Recursively get all the child records id of a given record.

          Line exceeds 120 characters; contains 158 characters
          Open

                      ->where(['and', ['vtiger_crmentity.deleted' => 0], ['vtiger_troubletickets.parentid' => $id], ['not', ['vtiger_troubletickets.ticketid' => $id]]])

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

                      ->column();

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

                          foreach ($recordsIds as $recordId) {

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

              }

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

          class HelpDesk_Module_Model extends Vtiger_Module_Model

          There are no issues that match your filters.

          Category
          Status