YetiForceCompany/YetiForceCRM

View on GitHub
modules/SSalesProcesses/SSalesProcesses.php

Summary

Maintainability
D
2 days
Test Coverage
F
2%

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

    public function getHierarchyData($id, $salesProcessesInfoBase, $salesProcessesId, &$listviewEntries, $getRawData = false, $getLinks = true)
    {
        \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $salesProcessesId . ') method ...');

        $currentUser = Users_Privileges_Model::getCurrentUserModel();
Severity: Minor
Found in modules/SSalesProcesses/SSalesProcesses.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

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

    public function getParentSales($id, &$parentSSalesProcesses, &$encounteredSalesProcesses, $depthBase = 0)
    {
        \App\Log::trace('Entering getParentSales(' . $id . ') method ...');

        if ($depthBase == App\Config::module('SSalesProcesses', 'MAX_HIERARCHY_DEPTH')) {
Severity: Minor
Found in modules/SSalesProcesses/SSalesProcesses.php - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Function getChildSales has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

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

Cognitive Complexity

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

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

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

Further reading

Method getParentSales has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getParentSales($id, &$parentSSalesProcesses, &$encounteredSalesProcesses, $depthBase = 0)
    {
        \App\Log::trace('Entering getParentSales(' . $id . ') method ...');

        if ($depthBase == App\Config::module('SSalesProcesses', 'MAX_HIERARCHY_DEPTH')) {
Severity: Minor
Found in modules/SSalesProcesses/SSalesProcesses.php - About 1 hr to fix

    Method getChildSales has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      The class SSalesProcesses has 16 fields. Consider redesigning SSalesProcesses to keep the number of fields under 15.
      Open

      class SSalesProcesses extends Vtiger_CRMEntity
      {
          public $table_name = 'u_yf_ssalesprocesses';
          public $table_index = 'ssalesprocessesid';
          protected $lockFields = [];

      TooManyFields

      Since: 0.1

      Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

      Example

      class Person {
         protected $one;
         private $two;
         private $three;
         [... many more fields ...]
      }

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

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

          public function getHierarchyData($id, $salesProcessesInfoBase, $salesProcessesId, &$listviewEntries, $getRawData = false, $getLinks = true)
          {
              \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $salesProcessesId . ') method ...');
      
              $currentUser = Users_Privileges_Model::getCurrentUserModel();
      Severity: Minor
      Found in modules/SSalesProcesses/SSalesProcesses.php - About 1 hr to fix

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

            public function getHierarchyData($id, $salesProcessesInfoBase, $salesProcessesId, &$listviewEntries, $getRawData = false, $getLinks = true)
        Severity: Minor
        Found in modules/SSalesProcesses/SSalesProcesses.php - About 45 mins to fix

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

              public function moduleHandler($moduleName, $eventType)
              {
                  if ('module.postinstall' === $eventType) {
                      \App\Fields\RecordNumber::getInstance($moduleName)->set('prefix', 'S-SP')->set('cur_id', 1)->save();
                      \App\Db::getInstance()->createCommand()->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();
          Severity: Minor
          Found in modules/SSalesProcesses/SSalesProcesses.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 getHierarchyData() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
          Open

              public function getHierarchyData($id, $salesProcessesInfoBase, $salesProcessesId, &$listviewEntries, $getRawData = false, $getLinks = true)
              {
                  \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $salesProcessesId . ') method ...');
          
                  $currentUser = Users_Privileges_Model::getCurrentUserModel();

          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 getParentSales() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
          Open

              public function getParentSales($id, &$parentSSalesProcesses, &$encounteredSalesProcesses, $depthBase = 0)
              {
                  \App\Log::trace('Entering getParentSales(' . $id . ') method ...');
          
                  if ($depthBase == App\Config::module('SSalesProcesses', 'MAX_HIERARCHY_DEPTH')) {

          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 30 to the 15 allowed.
          Open

              public function getHierarchyData($id, $salesProcessesInfoBase, $salesProcessesId, &$listviewEntries, $getRawData = false, $getLinks = true)

          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

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

                  $listviewEntries[$salesProcessesId] = $salesProcessesInfoData;

          UndefinedVariable

          Since: 2.8.0

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

          Example

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

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

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

                          $salesProcessesInfoData[] = $data;

          UndefinedVariable

          Since: 2.8.0

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

          Example

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

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

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

          class SSalesProcesses extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_ssalesprocesses';
              public $table_index = 'ssalesprocessesid';
              protected $lockFields = [];

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

              public function getHierarchyData($id, $salesProcessesInfoBase, $salesProcessesId, &$listviewEntries, $getRawData = false, $getLinks = true)

          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 '205', 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"),

          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 '266', column '22').
          Open

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

          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 $getRawData, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function getHierarchy($id, $getRawData = false, $getLinks = true)

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

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

          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 $getLinks, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function getHierarchyData($id, $salesProcessesInfoBase, $salesProcessesId, &$listviewEntries, $getRawData = false, $getLinks = true)

          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 '268', 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"),

          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($id, $getRawData = false, $getLinks = true)

          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

          Avoid using static access to class 'vtlib\Module' in method 'moduleHandler'.
          Open

                      $modcommentsModuleInstance = vtlib\Module::getInstance('ModComments');

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class 'Users_Privileges_Model' in method 'getHierarchyData'.
          Open

                  $currentUser = Users_Privileges_Model::getCurrentUserModel();

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

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

          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 getChildSales 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];
                              }

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

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

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

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

          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>';
                              }

          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\Field' in method 'getHierarchy'.
          Open

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

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

          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 . ',' . $salesProcessesId . ') method ...');

          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 = '<span>' . $data . '&nbsp;<span class="fas fa-exclamation-circle"></span></span>';
                                      }

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

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

          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('SSalesProcesses', 'COLUMNS_IN_HIERARCHY');

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

                          } else {
                              $parentSSalesProcessesInfo[$columnname] = $row[$columnname];
                          }

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

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

          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 ...');

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

                  if ($depthBase == App\Config::module('SSalesProcesses', 'MAX_HIERARCHY_DEPTH')) {

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

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

          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 'ModComments' in method 'moduleHandler'.
          Open

                              ModComments::addWidgetTo(['SSalesProcesses']);

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

                      CRMEntity::getInstance('ModTracker')->enableTrackingForModule(\App\Module::getModuleId($moduleName));

          StaticAccess

          Since: 1.4.0

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

          Example

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

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

          Avoid using static access to class '\App\Privilege' in method 'getHierarchyData'.
          Open

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

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

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

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

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

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

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

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

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

          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('SSalesProcesses', $colname)) {

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

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

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

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

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

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

          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($salesProcessesInfoBase[$colname]);

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

                              ModComments::addWidgetTo(['SSalesProcesses']);

          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('SSalesProcesses', 'COLUMNS_IN_HIERARCHY');

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

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

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

                  'Assigned To' => 'assigned_user_id',

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

              public $tab_name = ['vtiger_crmentity', 'u_yf_ssalesprocesses', 'u_yf_ssalesprocessescf', 'vtiger_entity_stats'];

          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

                  $salesProcessesList[$baseId] = $this->getChildSales($baseId, $salesProcessesList[$baseId], $salesProcessesList[$baseId]['depth']);

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

                  'LBL_SUBJECT' => 'subject',

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

              public $table_index = 'ssalesprocessesid';

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

              public $table_name = 'u_yf_ssalesprocesses';

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

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

          Noncompliant Code Example

          With the default threshold of 3:

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

          Compliant Solution

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

          Exceptions

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

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

              public $customFieldTable = ['u_yf_ssalesprocessescf', 'ssalesprocessesid'];

          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.

          Saw possibly unextractable annotation for a fragment of comment '* @param string Module name': after string, did not see an element name (will guess based on comment order)
          Open

               * @param string Module name

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

                      \App\Db::getInstance()->createCommand()->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();

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

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

          Argument 1 (moduleNames) is array{0:'SSalesProcesses'} but \ModComments::addWidgetTo() takes string defined at /code/modules/ModComments/ModComments.php:72
          Open

                              ModComments::addWidgetTo(['SSalesProcesses']);

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

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

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

                          $salesProcessesInfoData[] = $data;

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

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

          Call to method getInstance from undeclared class \App\Fields\RecordNumber (Did you mean class \Tests\Base\RecordNumber)
          Open

                      \App\Fields\RecordNumber::getInstance($moduleName)->set('prefix', 'S-SP')->set('cur_id', 1)->save();

          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"),

          Call to undeclared method \CRMEntity::enableTrackingForModule
          Open

                      CRMEntity::getInstance('ModTracker')->enableTrackingForModule(\App\Module::getModuleId($moduleName));

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

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

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

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

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

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

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

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

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

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

          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"),

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

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

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

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

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

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

          Saw possibly unextractable annotation for a fragment of comment '* @param string Event Type': after string, did not see an element name (will guess based on comment order)
          Open

               * @param string Event Type

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

              public function moduleHandler($moduleName, $eventType)
              {
                  if ('module.postinstall' === $eventType) {
                      \App\Fields\RecordNumber::getInstance($moduleName)->set('prefix', 'S-SP')->set('cur_id', 1)->save();
                      \App\Db::getInstance()->createCommand()->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();
          Severity: Major
          Found in modules/SSalesProcesses/SSalesProcesses.php and 2 other locations - About 4 hrs to fix
          modules/SRecurringOrders/SRecurringOrders.php on lines 85..99
          modules/SRequirementsCards/SRequirementsCards.php on lines 72..86

          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 173.

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

          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

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

                  $encounteredSalesProcesses = [$id];

          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

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

              public function getParentSales($id, &$parentSSalesProcesses, &$encounteredSalesProcesses, $depthBase = 0)

          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

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

                          $salesProcessesInfoData[] = $data;

          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

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

                      $modcommentsModuleInstance = vtlib\Module::getInstance('ModComments');

          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

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

              public $def_detailview_recname = 'subject';

          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

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

              public function getHierarchyData($id, $salesProcessesInfoBase, $salesProcessesId, &$listviewEntries, $getRawData = false, $getLinks = true)

          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

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

              public function getParentSales($id, &$parentSSalesProcesses, &$encounteredSalesProcesses, $depthBase = 0)

          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

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

                      $parentSSalesProcessesInfo = [];

          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 SSalesProcesses extends Vtiger_CRMEntity

          A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 9 and the first side effect is on line 7.
          Open

          <?php

          The property $list_fields_name is not named in camelCase.
          Open

          class SSalesProcesses extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_ssalesprocesses';
              public $table_index = 'ssalesprocessesid';
              protected $lockFields = [];

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The property $search_fields is not named in camelCase.
          Open

          class SSalesProcesses extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_ssalesprocesses';
              public $table_index = 'ssalesprocessesid';
              protected $lockFields = [];

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The property $def_basicsearch_col is not named in camelCase.
          Open

          class SSalesProcesses extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_ssalesprocesses';
              public $table_index = 'ssalesprocessesid';
              protected $lockFields = [];

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The property $default_order_by is not named in camelCase.
          Open

          class SSalesProcesses extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_ssalesprocesses';
              public $table_index = 'ssalesprocessesid';
              protected $lockFields = [];

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

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

              public function getHierarchy($id, $getRawData = false, $getLinks = true)

          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 property $table_index is not named in camelCase.
          Open

          class SSalesProcesses extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_ssalesprocesses';
              public $table_index = 'ssalesprocessesid';
              protected $lockFields = [];

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The property $table_name is not named in camelCase.
          Open

          class SSalesProcesses extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_ssalesprocesses';
              public $table_index = 'ssalesprocessesid';
              protected $lockFields = [];

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The property $mandatory_fields is not named in camelCase.
          Open

          class SSalesProcesses extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_ssalesprocesses';
              public $table_index = 'ssalesprocessesid';
              protected $lockFields = [];

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

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

              public function getChildSales($id, &$childSalesProcesses, $depthBase)

          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 property $tab_name is not named in camelCase.
          Open

          class SSalesProcesses extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_ssalesprocesses';
              public $table_index = 'ssalesprocessesid';
              protected $lockFields = [];

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The property $def_detailview_recname is not named in camelCase.
          Open

          class SSalesProcesses extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_ssalesprocesses';
              public $table_index = 'ssalesprocessesid';
              protected $lockFields = [];

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

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

              public function getParentSales($id, &$parentSSalesProcesses, &$encounteredSalesProcesses, $depthBase = 0)

          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($id, $salesProcessesInfoBase, $salesProcessesId, &$listviewEntries, $getRawData = false, $getLinks = true)

          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 property $search_fields_name is not named in camelCase.
          Open

          class SSalesProcesses extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_ssalesprocesses';
              public $table_index = 'ssalesprocessesid';
              protected $lockFields = [];

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The property $tab_name_index is not named in camelCase.
          Open

          class SSalesProcesses extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_ssalesprocesses';
              public $table_index = 'ssalesprocessesid';
              protected $lockFields = [];

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The property $popup_fields is not named in camelCase.
          Open

          class SSalesProcesses extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_ssalesprocesses';
              public $table_index = 'ssalesprocessesid';
              protected $lockFields = [];

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

          The property $default_sort_order is not named in camelCase.
          Open

          class SSalesProcesses extends Vtiger_CRMEntity
          {
              public $table_name = 'u_yf_ssalesprocesses';
              public $table_index = 'ssalesprocessesid';
              protected $lockFields = [];

          CamelCasePropertyName

          Since: 0.2

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

          Example

          class ClassName {
              protected $property_name;
          }

          Source

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

              public $tab_name = ['vtiger_crmentity', 'u_yf_ssalesprocesses', 'u_yf_ssalesprocessescf', 'vtiger_entity_stats'];

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

              public $customFieldTable = ['u_yf_ssalesprocessescf', 'ssalesprocessesid'];

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

              public $table_index = 'ssalesprocessesid';

          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 $table_name = 'u_yf_ssalesprocesses';

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

              protected $lockFields = [];

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

               * Mandatory table for supporting custom fields.

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

              /**

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

              /**

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

              public $tab_name_index = [

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

                              ModComments::addWidgetTo(['SSalesProcesses']);

          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 getHierarchy(' . $id . ') method ...');

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

                  $salesProcessesList = [$baseId => $salesProcessesList[$baseId]];

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

               *

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

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

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

                              // - to show the hierarchy of the Sales

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

                              $data = $salesProcessesDepth . $data;

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

                          $salesProcessesInfoData[] = $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 Recursively get all the upper sales of a given Sales.

          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

                      $modcommentsModuleInstance = vtlib\Module::getInstance('ModComments');

          Line exceeds 120 characters; contains 138 characters
          Open

                  $salesProcessesList[$baseId] = $this->getChildSales($baseId, $salesProcessesList[$baseId], $salesProcessesList[$baseId]['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

                                      } else {

          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

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

          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

              /**

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

               * Mandatory for Saving, Include tablename and tablekey columnname here.

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

               */

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

                  // Format: Field Label => Array(tablename, columnname)

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

              public $def_detailview_recname = 'subject';

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

                          include_once 'modules/ModComments/ModComments.php';

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

               *

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

              {

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

                      }

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

               * @param int   $id                     - Id of the record highest in hierarchy

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

               * @param mixed $getLinks

          Line exceeds 120 characters; contains 154 characters
          Open

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

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

               * Mandatory for Saving, Include tables related to this module.

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

                  'u_yf_ssalesprocesses' => 'ssalesprocessesid',

          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

              // Used when enabling/disabling the mandatory fields for the module.

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

               * Invoked when special actions are performed on the module.

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

                      }

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

                  $listviewEntries = [];

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

                  'u_yf_ssalesprocessescf' => 'ssalesprocessesid',

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

                  'Assigned To' => 'assigned_user_id',

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

              public $relationFields = [];

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

               * @param string Module name

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

              public function moduleHandler($moduleName, $eventType)

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

                  }

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

              }

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

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

          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

                          }

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

                  $listviewEntries[$salesProcessesId] = $salesProcessesInfoData;

          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                        - ssalesprocessesid

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

               * @param array $parentSSalesProcesses     - Array of all the parent sales

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

                  'vtiger_entity_stats' => 'crmid', ];

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

              public $list_fields_name = [

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

              // Refers to vtiger_field.fieldname values.

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

              public $mandatory_fields = ['subject', 'assigned_user_id'];

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

               * @param mixed $moduleName

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

                      \App\Db::getInstance()->createCommand()->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();

          Line exceeds 120 characters; contains 131 characters
          Open

                      \App\Db::getInstance()->createCommand()->update('vtiger_tab', ['customized' => 0], ['name' => $moduleName])->execute();

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

                      CRMEntity::getInstance('ModTracker')->enableTrackingForModule(\App\Module::getModuleId($moduleName));

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

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

          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

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

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

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

          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 getHierarchyData method ...');

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

               * @var string[] List of fields in the RelationListView

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

                  // tablename should not have prefix 'vtiger_'

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

              public $default_sort_order = 'ASC';

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

                  if ('module.postinstall' === $eventType) {

          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($id, $getRawData = false, $getLinks = true)

          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

                                  }

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

                      }

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

              // Column value to use on detail view record text display

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

                          if (class_exists('ModComments')) {

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

               * @param int   $id         - ssalesprocessesid

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

                  $salesProcessesList[$baseId] = $this->getChildSales($baseId, $salesProcessesList[$baseId], $salesProcessesList[$baseId]['depth']);

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

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

          Line exceeds 120 characters; contains 142 characters
          Open

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

          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

              public $default_order_by = '';

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

              /**

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

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

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

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

                      $listColumns = $this->list_fields_name;

          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

                  foreach ($listColumns as $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

              public $search_fields_name = [];

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

              public $popup_fields = ['subject'];

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

               * @param mixed $eventType

          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

              public function getHierarchyData($id, $salesProcessesInfoBase, $salesProcessesId, &$listviewEntries, $getRawData = false, $getLinks = true)

          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

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

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

               * Function to Recursively get all the child sales of a given Sale.

          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

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

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

              // For Alphabetical search

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

               *

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

                  $salesProcessesList = [];

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

                  $encounteredSalesProcesses = [$id];

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

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

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

               *                                      returns All the parent sales of the given Sale in array format

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

               */

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

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

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

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

          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('SSalesProcesses', 'MAX_HIERARCHY_DEPTH')) {

          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

                      $parentSSalesProcesses[$id] = $parentSSalesProcessesInfo;

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

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

          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

                          $childSalesProcesses[$childAccId] = $childSalesProcessesInfo;

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

                  'LBL_SUBJECT' => 'subject',

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

              // For Popup listview and UI type support

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

              public $def_basicsearch_col = 'subject';

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

                      \App\Fields\RecordNumber::getInstance($moduleName)->set('prefix', 'S-SP')->set('cur_id', 1)->save();

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

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

          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

              public function getParentSales($id, &$parentSSalesProcesses, &$encounteredSalesProcesses, $depthBase = 0)

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

                      }

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

                          $listColumns = $this->list_fields_name;

          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('u_#__ssalesprocesses')

          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 getChildSales method ...');

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

              // For Popup window record selection

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

                      if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {

          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 sales hierarchy of the given Sale.

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

                      // Permission to view sales is restricted, avoid showing field values (except sales name)

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

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

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

                          $listviewEntries = $this->getHierarchyData($id, $salesProcessesInfo, $accId, $listviewEntries, $getRawData, $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

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

          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

                      'u_#__ssalesprocesses.*',

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

               * @param int   $id                  - ssalesprocessesid

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

                          $childAccId = $row['ssalesprocessesid'];

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

                  'vtiger_crmentity' => 'crmid',

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

                  'LBL_SUBJECT' => ['ssalesprocesses', 'subject'],

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

                  'Assigned To' => ['vtiger_crmentity', 'assigned_user_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 mixed $getLinks

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

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

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

                  }

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

                  $salesProcessesList = $this->getParentSales($id, $salesProcessesList, $encounteredSalesProcesses);

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

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

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

                      $listColumns = $this->list_fields_name;

          Line exceeds 120 characters; contains 135 characters
          Open

                          $listviewEntries = $this->getHierarchyData($id, $salesProcessesInfo, $accId, $listviewEntries, $getRawData, $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

              {

          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

                      $parentid = $row['parentid'];

          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 ('assigned_user_id' == $columnname) {

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

               *                                   returns All the child sales of the given ssalesprocessesid in array format

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

                          }

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

                  ])->from('u_#__ssalesprocesses')

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

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

          Line exceeds 120 characters; contains 122 characters
          Open

               *                                         returns All the parent Sales of the given ssalesprocessesid in array format

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

                      return $parentSSalesProcesses;

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

                      ->where(['vtiger_crmentity.deleted' => 0, 'u_#__ssalesprocesses.ssalesprocessesid' => $id])

          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

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

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

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

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

                      return $childSalesProcesses;

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

                          $this->getChildSales($childAccId, $childSalesProcesses[$childAccId], $depth);

          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

                      foreach ($listColumns as $columnname) {

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

              public function getChildSales($id, &$childSalesProcesses, $depthBase)

          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

                      $depth = $depthBase + 1;

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

              public $search_fields = [

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

               * @param string Event Type

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

               */

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

               *                          returns Sales hierarchy in array format

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

               * @param array $salesProcessesInfoBase

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

               * @param mixed $getRawData

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

                              if ($salesProcessesId != $id) {

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

                              $salesProcessesDepth = str_repeat(' .. ', $salesProcessesInfoBase['depth']);

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

               *                                         returns All the parent Sales of the given ssalesprocessesid in array format

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

               * @param mixed $depthBase

          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

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

          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

                              $parentSSalesProcessesInfo[$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

                      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

                  }

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

                  // Format: Field Label => fieldname

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

               * @param int   $salesProcessesId       - ssalesprocessesid

          Line exceeds 120 characters; contains 143 characters
          Open

              public function getHierarchyData($id, $salesProcessesInfoBase, $salesProcessesId, &$listviewEntries, $getRawData = false, $getLinks = true)

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

              {

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

                  foreach ($salesProcessesInfoBase as $accId => $salesProcessesInfo) {

          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 getParentSales(' . $id . ') method ...');

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

                      ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = u_#__ssalesprocesses.ssalesprocessesid')

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

                      $listColumns = $this->list_fields_name;

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

                      $dataReader->close();

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

                  }

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

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

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

                          $encounteredSalesProcesses[] = $parentid;

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

                      $parentSSalesProcessesInfo['depth'] = $depth;

          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 = u_#__ssalesprocesses.ssalesprocessesid')

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

                          $this->getParentSales($parentid, $parentSSalesProcesses, $encounteredSalesProcesses, $depthBase + 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

               *

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

               * @param array $childSalesProcesses - Array of all the child sales

          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, 'u_#__ssalesprocesses.parentid' => $id])

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

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

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

                  return $childSalesProcesses;

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

               * @param mixed $encounteredSalesProcesses

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

                          $depth = $parentSSalesProcesses[$parentid]['depth'] + 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

              }

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

               * @param int   $depthBase           - Depth at which the particular sales has to be placed in the hierarchy

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

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

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

                      'u_#__ssalesprocesses.*',

          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

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

          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

                          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

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

          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

                      $parentSSalesProcessesInfo = [];

          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

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

          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

                  if ($row) {

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

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

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

                  return $parentSSalesProcesses;

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

              {

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

              }

          There are no issues that match your filters.

          Category
          Status