YetiForceCompany/YetiForceCRM

View on GitHub
modules/Accounts/Accounts.php

Summary

Maintainability
D
2 days
Test Coverage
F
0%

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

    public function getHierarchyData($id, $accountInfoBase, $accountId, &$listViewEntries)
    {
        \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $accountId . ') method ...');
        $hasRecordViewAccess = \App\Privilege::isPermitted('Accounts', 'DetailView', $accountId);
        foreach ($this->hierarchyFields as &$field) {
Severity: Minor
Found in modules/Accounts/Accounts.php - About 3 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 __getChildAccounts has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

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

Cognitive Complexity

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

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

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

Further reading

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

    public function __getParentAccounts($id, &$parentAccounts, &$encounteredAccounts, $depthBase = 0)
    {
        \App\Log::trace('Entering __getParentAccounts(' . $id . ') method ...');
        if ($depthBase == App\Config::module('Accounts', 'MAX_HIERARCHY_DEPTH')) {
            \App\Log::error('Exiting __getParentAccounts method ... - exceeded maximum depth of hierarchy');
Severity: Minor
Found in modules/Accounts/Accounts.php - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method __getParentAccounts has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Method __getChildAccounts has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

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

      class Accounts extends CRMEntity
      {
          public $table_name = 'vtiger_account';
          public $table_index = 'accountid';
          public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
      Severity: Minor
      Found in modules/Accounts/Accounts.php by phpmd

      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 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getHierarchyData($id, $accountInfoBase, $accountId, &$listViewEntries)
          {
              \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $accountId . ') method ...');
              $hasRecordViewAccess = \App\Privilege::isPermitted('Accounts', 'DetailView', $accountId);
              foreach ($this->hierarchyFields as &$field) {
      Severity: Minor
      Found in modules/Accounts/Accounts.php - About 1 hr to fix

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

            public function getHierarchyData($id, $accountInfoBase, $accountId, &$listViewEntries)
            {
                \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $accountId . ') method ...');
                $hasRecordViewAccess = \App\Privilege::isPermitted('Accounts', 'DetailView', $accountId);
                foreach ($this->hierarchyFields as &$field) {
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        CyclomaticComplexity

        Since: 0.1

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

        Example

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

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

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

            public function __getParentAccounts($id, &$parentAccounts, &$encounteredAccounts, $depthBase = 0)
            {
                \App\Log::trace('Entering __getParentAccounts(' . $id . ') method ...');
                if ($depthBase == App\Config::module('Accounts', 'MAX_HIERARCHY_DEPTH')) {
                    \App\Log::error('Exiting __getParentAccounts method ... - exceeded maximum depth of hierarchy');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        CyclomaticComplexity

        Since: 0.1

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

        Example

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

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

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

            public function getHierarchyData($id, $accountInfoBase, $accountId, &$listViewEntries)
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

        See

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

            public function __getParentAccounts($id, &$parentAccounts, &$encounteredAccounts, $depthBase = 0)
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

        See

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

            public function __getChildAccounts($id, &$childAccounts, $depthBase)
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

        See

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

                $listViewEntries[$accountId] = $accountInfoData;
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        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 '$accountInfoData' which will lead to PHP notices.
        Open

                        $accountInfoData[] = ['data' => $data, 'fieldname' => $fieldName, 'rawData' => $rawData];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        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

        Missing class import via use statement (line '265', column '22').
        Open

                $dataReader = (new App\Db\Query())
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        MissingImport

        Since: 2.7.0

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

        Example

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

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

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

                $row = (new App\Db\Query())->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        MissingImport

        Since: 2.7.0

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

        Example

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

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

        Missing class import via use statement (line '266', column '80').
        Open

                    ->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        MissingImport

        Since: 2.7.0

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

        Example

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

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

        Missing class import via use statement (line '207', column '106').
        Open

                $row = (new App\Db\Query())->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        MissingImport

        Since: 2.7.0

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

        Example

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

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

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

            public function getAccountHierarchy($id, $listColumns = false)
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        BooleanArgumentFlag

        Since: 1.4.0

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

        Example

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

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

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

            public function setRelationTables($secModule = false)
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        BooleanArgumentFlag

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class '\App\Field' in method 'getAccountHierarchy'.
        Open

                    if (\App\Field::getFieldPermission('Accounts', $fieldName)) {
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                            } else {
                                $childAccountInfo[$fieldName] = $row[$field['columnname']];
                            }
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        ElseExpression

        Since: 1.4.0

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

        Example

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

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

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

                    \App\Log::error('Exiting __getChildAccounts method ... - exceeded maximum depth of hierarchy');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                $userNameSql = App\Module::getSqlForNameInDisplayFormat('Users');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class '\App\Field' in method 'getAccountHierarchy'.
        Open

                    $field = \App\Field::getFieldInfo($fieldName, 'Accounts');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                            $fieldModel = Vtiger_Field_Model::getInstanceFromFieldId($field['fieldid']);
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class '\App\Fields\SharedOwner' in method '__getChildAccounts'.
        Open

                                $sharedOwners = \App\Fields\SharedOwner::getById($childAccId);
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $accountId . ') method ...');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                    if (\App\Field::getFieldPermission('Accounts', $fieldName)) {
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                        $data = \App\Purifier::encodeHtml($accountInfoBase[$fieldName]);
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                \App\Log::trace('Exiting getHierarchyData method ...');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                $userNameSql = App\Module::getSqlForNameInDisplayFormat('Users');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                \App\Log::trace('Exiting getAccountHierarchy method ...');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                \App\Log::trace('Exiting __getChildAccounts method ...');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                                } else {
                                    $data = '<span>' . $data . '&nbsp;<span class="fas fa-exclamation-circle"></span></span>';
                                }
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        ElseExpression

        Since: 1.4.0

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

        Example

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

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

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

                \App\Log::trace('Entering __getChildAccounts(' . $id . ',' . $depthBase . ') method ...');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                $hasRecordViewAccess = \App\Privilege::isPermitted('Accounts', 'DetailView', $accountId);
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class 'App\Config' in method '__getChildAccounts'.
        Open

                if (empty($id) || $depthBase == App\Config::module('Accounts', 'MAX_HIERARCHY_DEPTH')) {
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class 'App\Config' in method 'getAccountHierarchy'.
        Open

                $listColumns = $listColumns ?: App\Config::module('Accounts', 'COLUMNS_IN_HIERARCHY');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                            } else {
                                $data = '<strong>' . $data . '</strong>';
                            }
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        ElseExpression

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class 'App\Config' in method '__getParentAccounts'.
        Open

                if ($depthBase == App\Config::module('Accounts', 'MAX_HIERARCHY_DEPTH')) {
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                        } else {
                            $parentAccountInfo[$fieldName] = $row[$field['columnname']];
                        }
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        ElseExpression

        Since: 1.4.0

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

        Example

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

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

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

                    \App\Log::error('Exiting __getParentAccounts method ... - exceeded maximum depth of hierarchy');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class '\App\Fields\SharedOwner' in method '__getParentAccounts'.
        Open

                            $sharedOwners = \App\Fields\SharedOwner::getById($row['accountid']);
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                \App\Log::trace('Exiting __getParentAccounts method ...');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                \App\Log::trace('Entering getAccountHierarchy(' . $id . ') method ...');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                \App\Log::trace('Entering __getParentAccounts(' . $id . ') method ...');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                $accountsList[$baseId] = $this->__getChildAccounts($baseId, $accountsList[$baseId], $accountsList[$baseId]['depth']);
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

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

            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

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

                    $fieldName = $field['fieldname'];
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

        Define a constant instead of duplicating this literal "vtiger_account" 17 times.
        Open

            public $table_name = 'vtiger_account';
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

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

                        } elseif ('assigned_user_id' !== $fieldName && 'shownerid' !== $fieldName) {
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

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

                \App\Log::trace('Entering getAccountHierarchy(' . $id . ') method ...');
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

        Define a constant instead of duplicating this literal "vtiger_crmentity" 6 times.
        Open

            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

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

                $listColumns = $listColumns ?: App\Config::module('Accounts', 'COLUMNS_IN_HIERARCHY');
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

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

            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

        Define a constant instead of duplicating this literal "accountname" 6 times.
        Open

                'Account Name' => 'accountname',
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

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

                $row = (new App\Db\Query())->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

        Remove this commented out code.
        Open

         * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
        Severity: Major
        Found in modules/Accounts/Accounts.php by sonar-php

        Programmers should not comment out code as it bloats programs and reduces readability.

        Unused code should be deleted and can be retrieved from source control history if required.

        See

        • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
        • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
        • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
        • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

        Define a constant instead of duplicating this literal "crmid" 6 times.
        Open

            public $tab_name_index = ['vtiger_crmentity' => 'crmid', 'vtiger_account' => 'accountid', 'vtiger_accountaddress' => 'accountaddressid', 'vtiger_accountscf' => 'accountid', 'vtiger_entity_stats' => 'crmid'];
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

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

                'Assigned To' => 'assigned_user_id',
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

        Define a constant instead of duplicating this literal "accountid" 14 times.
        Open

            public $table_index = 'accountid';
        Severity: Critical
        Found in modules/Accounts/Accounts.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

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

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

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

                $row = (new App\Db\Query())->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])
        Severity: Critical
        Found in modules/Accounts/Accounts.php by phan

        Reference to undeclared class \App\Fields\Owner in callable \App\Fields\Owner::getLabel
        Open

                                $sharedOwners = implode(',', array_map('\App\Fields\Owner::getLabel', $sharedOwners));
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phan

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

                \App\Log::trace('Entering getAccountHierarchy(' . $id . ') method ...');
        Severity: Critical
        Found in modules/Accounts/Accounts.php by phan

        Saw an @param annotation for depth, but it was not found in the param list of function __getChildAccounts(int $id, array &$childAccounts, mixed $depthBase)
        Open

             * @param int   $depth         - Depth at which the particular account has to be placed in the hierarchy
        Severity: Info
        Found in modules/Accounts/Accounts.php by phan

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

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

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

                \App\Log::trace('Exiting __getParentAccounts method ...');
        Severity: Critical
        Found in modules/Accounts/Accounts.php by phan

        Reference to undeclared property \Accounts->hierarchyFields
        Open

                    foreach ($this->hierarchyFields as &$field) {
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phan

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

                $dataReader = (new App\Db\Query())
        Severity: Critical
        Found in modules/Accounts/Accounts.php by phan

        Reference to undeclared property \Accounts->hierarchyFields
        Open

                foreach ($this->hierarchyFields as &$field) {
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phan

        Reference to undeclared class \App\Fields\Owner in callable \App\Fields\Owner::getLabel
        Open

                                    $sharedOwners = implode(',', array_map('\App\Fields\Owner::getLabel', $sharedOwners));
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phan

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

                        $accountInfoData[] = ['data' => $data, 'fieldname' => $fieldName, 'rawData' => $rawData];
        Severity: Info
        Found in modules/Accounts/Accounts.php by phan

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

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

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

                \App\Log::trace('Exiting __getChildAccounts method ...');
        Severity: Critical
        Found in modules/Accounts/Accounts.php by phan

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

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

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

                $row = (new App\Db\Query())->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])
        Severity: Critical
        Found in modules/Accounts/Accounts.php by phan

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

                \App\Log::trace('Entering __getParentAccounts(' . $id . ') method ...');
        Severity: Critical
        Found in modules/Accounts/Accounts.php by phan

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

                    ->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])
        Severity: Critical
        Found in modules/Accounts/Accounts.php by phan

        Reference to undeclared property \Accounts->hierarchyFields (Did you mean $hierarchyFields)
        Open

                $this->hierarchyFields = $hierarchyFields;
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phan

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

                \App\Log::trace('Exiting getAccountHierarchy method ...');
        Severity: Critical
        Found in modules/Accounts/Accounts.php by phan

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

                $row = (new App\Db\Query())->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])
        Severity: Critical
        Found in modules/Accounts/Accounts.php by phan

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

                    ->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])
        Severity: Critical
        Found in modules/Accounts/Accounts.php by phan

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

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

        Reference to undeclared property \Accounts->hierarchyFields
        Open

                        foreach ($this->hierarchyFields as &$field) {
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phan

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

                $row = (new App\Db\Query())->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])
                    ->from('vtiger_account')
                    ->innerJoin('vtiger_crmentity', 'vtiger_account.accountid = vtiger_crmentity.crmid')
                    ->innerJoin('vtiger_accountaddress', 'vtiger_accountaddress.accountaddressid = vtiger_account.accountid')
                    ->leftJoin('vtiger_groups', 'vtiger_crmentity.smownerid = vtiger_groups.groupid')
        Severity: Major
        Found in modules/Accounts/Accounts.php and 1 other location - About 1 hr to fix
        modules/Accounts/Accounts.php on lines 265..272

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

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

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

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

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

        Refactorings

        Further Reading

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

                $dataReader = (new App\Db\Query())
                    ->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])
                    ->from('vtiger_account')
                    ->innerJoin('vtiger_crmentity', 'vtiger_account.accountid = vtiger_crmentity.crmid')
                    ->innerJoin('vtiger_accountaddress', 'vtiger_account.accountid = vtiger_accountaddress.accountaddressid')
        Severity: Major
        Found in modules/Accounts/Accounts.php and 1 other location - About 1 hr to fix
        modules/Accounts/Accounts.php on lines 207..213

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

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

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

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

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

        Refactorings

        Further Reading

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

                        if ('accountname' == $fieldName) {
                            if ($accountId != $id) {
                                if ($hasRecordViewAccess) {
                                    $data = '<a href="index.php?module=Accounts&view=Detail&record=' . $accountId . '">' . $data . '</a>';
                                } else {
        Severity: Major
        Found in modules/Accounts/Accounts.php and 1 other location - About 1 hr to fix
        modules/OSSEmployees/OSSEmployees.php on lines 108..123

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

        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 $emailTemplate_defaultFields. Keep variable name length under 20.
        Open

            public $emailTemplate_defaultFields = ['accountname', 'account_type', 'industry', 'annualrevenue', 'phone', 'email1', 'rating', 'website', 'fax'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        LongVariable

        Since: 0.2

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

        Example

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

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

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

        class Accounts extends CRMEntity

        The property $entity_table is not named in camelCase.
        Open

        class Accounts extends CRMEntity
        {
            public $table_name = 'vtiger_account';
            public $table_index = 'accountid';
            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

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

        class Accounts extends CRMEntity
        {
            public $table_name = 'vtiger_account';
            public $table_index = 'accountid';
            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        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 Accounts extends CRMEntity
        {
            public $table_name = 'vtiger_account';
            public $table_index = 'accountid';
            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

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

        class Accounts extends CRMEntity
        {
            public $table_name = 'vtiger_account';
            public $table_index = 'accountid';
            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        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 Accounts extends CRMEntity
        {
            public $table_name = 'vtiger_account';
            public $table_index = 'accountid';
            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        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 Accounts extends CRMEntity
        {
            public $table_name = 'vtiger_account';
            public $table_index = 'accountid';
            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        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 __getChildAccounts($id, &$childAccounts, $depthBase)
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        ShortVariable

        Since: 0.2

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

        Example

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

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

        The property $def_basicsearch_col is not named in camelCase.
        Open

        class Accounts extends CRMEntity
        {
            public $table_name = 'vtiger_account';
            public $table_index = 'accountid';
            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        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 Accounts extends CRMEntity
        {
            public $table_name = 'vtiger_account';
            public $table_index = 'accountid';
            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        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 Accounts extends CRMEntity
        {
            public $table_name = 'vtiger_account';
            public $table_index = 'accountid';
            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

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

        class Accounts extends CRMEntity
        {
            public $table_name = 'vtiger_account';
            public $table_index = 'accountid';
            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        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 getAccountHierarchy($id, $listColumns = false)
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        ShortVariable

        Since: 0.2

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

        Example

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

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

        The property $list_fields_name is not named in camelCase.
        Open

        class Accounts extends CRMEntity
        {
            public $table_name = 'vtiger_account';
            public $table_index = 'accountid';
            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        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 Accounts extends CRMEntity
        {
            public $table_name = 'vtiger_account';
            public $table_index = 'accountid';
            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        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_name is not named in camelCase.
        Open

        class Accounts extends CRMEntity
        {
            public $table_name = 'vtiger_account';
            public $table_index = 'accountid';
            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        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_index is not named in camelCase.
        Open

        class Accounts extends CRMEntity
        {
            public $table_name = 'vtiger_account';
            public $table_index = 'accountid';
            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        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 getHierarchyData($id, $accountInfoBase, $accountId, &$listViewEntries)
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        ShortVariable

        Since: 0.2

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

        Example

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

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

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

            public function __getParentAccounts($id, &$parentAccounts, &$encounteredAccounts, $depthBase = 0)
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        ShortVariable

        Since: 0.2

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

        Example

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

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

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

            /**

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

                'Account Name' => 'accountname',

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

            public $relationFields = [];

        Line exceeds 120 characters; contains 150 characters
        Open

            public $emailTemplate_defaultFields = ['accountname', 'account_type', 'industry', 'annualrevenue', 'phone', 'email1', 'rating', 'website', 'fax'];

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

             * @return array with table names and fieldnames storing relations between module and this module

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

                    'Documents' => ['vtiger_senotesrel' => ['crmid', 'notesid'], 'vtiger_account' => 'accountid'],

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

            /**

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

             * @param bool|string $secModule secondary module name

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

                    'Products' => ['vtiger_seproductsrel' => ['crmid', 'productid'], 'vtiger_account' => 'accountid'],

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

                        $listViewHeader[] = $fieldLabel;

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

                $this->hierarchyFields = $hierarchyFields;

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

                            $fieldModel = Vtiger_Field_Model::getInstanceFromFieldId($field['fieldid']);

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

            //Default Fields for Email Templates -- Pavani

        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

            }

        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

                $hierarchyFields = [];

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

                    $field = \App\Field::getFieldInfo($fieldName, 'Accounts');

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

                }

        Line exceeds 120 characters; contains 133 characters
        Open

                // Get the accounts hierarchy from the top most account in the hierarch of the current account, including the current account

        Line exceeds 120 characters; contains 125 characters
        Open

                $accountsList[$baseId] = $this->__getChildAccounts($baseId, $accountsList[$baseId], $accountsList[$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

                        $data = \App\Purifier::encodeHtml($accountInfoBase[$fieldName]);

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

                                    $data = '<a href="index.php?module=Accounts&view=Detail&record=' . $accountId . '">' . $data . '</a>';

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

                        } elseif ('assigned_user_id' !== $fieldName && 'shownerid' !== $fieldName) {

        Line exceeds 120 characters; contains 131 characters
        Open

            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];

        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

            public $search_fields_name = [];

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

            /**

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

                    'HelpDesk' => ['vtiger_troubletickets' => ['parent_id', 'ticketid'], 'vtiger_account' => 'accountid'],

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

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

             *                           returns Account hierarchy in array format

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

                    $hierarchyFields[] = $field;

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

                $accountsList = $this->__getParentAccounts($id, $accountsList, $encounteredAccounts);

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

                    $rawData = '';

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

                'Vat ID' => 'vat_id',

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

                'Vat ID' => ['vtiger_account' => 'vat_id'],

        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

                return $relTables[$secModule];

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

             *

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

                $encounteredAccounts = [$id];

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

                $accountsList[$baseId] = $this->__getChildAccounts($baseId, $accountsList[$baseId], $accountsList[$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

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

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

                            } else {

        Line exceeds 120 characters; contains 211 characters
        Open

            public $tab_name_index = ['vtiger_crmentity' => 'crmid', 'vtiger_account' => 'accountid', 'vtiger_accountaddress' => 'accountaddressid', 'vtiger_accountscf' => 'accountid', 'vtiger_entity_stats' => 'crmid'];

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

            public $customFieldTable = ['vtiger_accountscf', 'accountid'];

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

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

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

                }

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

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

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

                $hasRecordViewAccess = \App\Privilege::isPermitted('Accounts', 'DetailView', $accountId);

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

                foreach ($this->hierarchyFields as &$field) {

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

                    $fieldName = $field['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

                'Assigned To' => 'assigned_user_id',

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

                'Type' => ['vtiger_account' => 'accounttype'],

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

            public $emailTemplate_defaultFields = ['accountname', 'account_type', 'industry', 'annualrevenue', 'phone', 'email1', 'rating', 'website', 'fax'];

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

            public $def_basicsearch_col = 'accountname';

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

                    'OSSMailView' => ['vtiger_ossmailview_relation' => ['crmid', 'ossmailviewid'], 'vtiger_account' => 'accountid'],

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

             * @param mixed $listColumns

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

            public function getAccountHierarchy($id, $listColumns = false)

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

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

        Line exceeds 120 characters; contains 130 characters
        Open

                                    $data = '<a href="index.php?module=Accounts&view=Detail&record=' . $accountId . '">' . $data . '</a>';

        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

            public $table_index = 'accountid';

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

            public $entity_table = 'vtiger_crmentity';

        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

            ];

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

             * @param int   $accountId       - accountid

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

            public $table_name = 'vtiger_account';

        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

            public $column_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

                    $listColumns = $this->list_fields_name;

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

            public function getHierarchyData($id, $accountInfoBase, $accountId, &$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

                        if ('accountname' == $fieldName) {

        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

                                } else {

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

            public $mandatory_fields = ['assigned_user_id', 'createdtime', 'modifiedtime', 'accountname'];

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

            public function setRelationTables($secModule = false)

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

                $relTables = [

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

                    'Assets' => ['vtiger_assets' => ['parent_id', 'assetsid'], 'vtiger_account' => 'accountid'],

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

            {

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

                $listViewHeader = [];

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

             */

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

                    if (\App\Field::getFieldPermission('Accounts', $fieldName)) {

        Line exceeds 120 characters; contains 122 characters
        Open

         * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Accounts/Accounts.php,v 1.53 2005/04/28 08:06:45 rank Exp $

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

                'Type' => 'accounttype',

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

                'Assigned To' => ['vtiger_crmentity' => 'smownerid'],

        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

            // Refers to vtiger_field.fieldname values.

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

            {

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

                    'Contacts' => ['vtiger_contactdetails' => ['parentid', 'contactid'], 'vtiger_account' => 'accountid'],

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

                    'Campaigns' => ['vtiger_campaign_records' => ['crmid', 'campaignid'], 'vtiger_account' => 'accountid'],

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

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

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

                $accountsList = [$baseId => $accountsList[$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

            //Added these variables which are used as default order by and sortorder in ListView

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

             * Function to get the relation tables for related modules.

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

             */

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

                    return $relTables;

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

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

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

                // Get the accounts hierarchy (list of child accounts) based on the current account

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

             * @param array $accountInfoBase

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

             *                               returns All the parent accounts of the given accountid in array format

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

                            if ($accountId != $id) {

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

                            $accountDepth = str_repeat(' .. ', $accountInfoBase['depth']);

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

                            $data = $accountDepth . $data;

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

            public $tab_name = ['vtiger_crmentity', 'vtiger_account', 'vtiger_accountaddress', 'vtiger_accountscf', 'vtiger_entity_stats'];

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

                'Account Name' => ['vtiger_account' => 'accountname'],

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

            public $default_order_by = '';

        Line exceeds 120 characters; contains 124 characters
        Open

                    'OSSMailView' => ['vtiger_ossmailview_relation' => ['crmid', 'ossmailviewid'], 'vtiger_account' => 'accountid'],

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

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

             * @param array $listViewEntries

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

                            $rawData = $data;

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

                            $data = $fieldModel->getDisplayValue($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

             * @param mixed $encounteredAccounts

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

                if ($row) {

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

            /**

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

                            $listViewEntries = $this->getHierarchyData($id, $accountInfo, $accId, $listViewEntries);

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

             *                                   returns All the parent accounts of the given accountid in array format

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

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

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

                        if ('assigned_user_id' == $fieldName) {

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

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

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

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

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

                        $childAccountInfo = [];

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

                            } elseif ('shownerid' == $fieldName) {

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

                return $childAccounts;

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

                'FL_STATUS' => 'accounts_status',

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

                'FL_STATUS' => ['vtiger_account' => 'accounts_status'],

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

                    'Project' => ['vtiger_project' => ['linktoaccountscontacts', 'projectid'], 'vtiger_account' => 'accountid'],

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

                    if (\App\Field::getFieldPermission('Accounts', $fieldName)) {

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

                $accountsList = [];

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

                return ['header' => $listViewHeader, 'entries' => $listViewEntries];

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

            }

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

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

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

                                }

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

             *

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

                    if ('' != $parentId && 0 != $parentId && !\in_array($parentId, $encounteredAccounts)) {

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

                            if (!empty($sharedOwners)) {

        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

                return $parentAccounts;

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

                }

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

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

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

                            if ('assigned_user_id' == $fieldName) {

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

                                $sharedOwners = \App\Fields\SharedOwner::getById($childAccId);

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

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

            ];

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

             */

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

                if (false === $secModule) {

        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

                // Get the accounts hierarchy from the top most account in the hierarch of the current account, including the current account

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

                            // - to show the hierarchy of the Accounts

        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 ($accountInfoBase as $accId => $accountInfo) {

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

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

        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

             * @param array $childAccounts - Array of all the child accounts

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

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

        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

             */

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

                            $fieldName = $field['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

            public $tab_name_index = ['vtiger_crmentity' => 'crmid', 'vtiger_account' => 'accountid', 'vtiger_accountaddress' => 'accountaddressid', 'vtiger_accountscf' => 'accountid', 'vtiger_entity_stats' => 'crmid'];

        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

                }

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

                $this->getHierarchyData($id, $accountsList[$baseId], $baseId, $listViewEntries);

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

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

        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

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

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

                        } elseif ('shownerid' == $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

                            $parentAccountInfo[$fieldName] = $row[$field['columnname']];

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

             * @param int   $id            - accountid

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

             *                             returns All the child accounts of the given accountid in array format

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

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

        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

                                if (!empty($sharedOwners)) {

        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 275 characters
        Open

                $row = (new App\Db\Query())->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])

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

             * Function to Recursively get all the child accounts of a given Account.

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

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

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

                    }

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

                return $listViewEntries;

        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

                }

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

                    ->where(['vtiger_crmentity.deleted' => 0, 'vtiger_account.accountid' => $id])->one();

        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

                    ->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])

        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

                }

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

                        $childAccounts[$childAccId] = $childAccountInfo;

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

                    ->where(['vtiger_crmentity.deleted' => 0, 'vtiger_account.parentid' => $id])->createCommand()->query();

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

                                $childAccountInfo[$fieldName] = $row[$field['columnname']];

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

                    }

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

            }

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

             * @param int   $id                  - accountid

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

            public function __getParentAccounts($id, &$parentAccounts, &$encounteredAccounts, $depthBase = 0)

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

                    return $parentAccounts;

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

                $row = (new App\Db\Query())->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])

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

                    ->from('vtiger_account')

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

                        $encounteredAccounts[] = $parentId;

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

                        $this->__getParentAccounts($parentId, $parentAccounts, $encounteredAccounts, $depthBase + 1);

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

                    $parentAccountInfo = [];

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

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

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

             *

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

                                    $childAccountInfo[$fieldName] = $sharedOwners;

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

                        $this->__getChildAccounts($childAccId, $childAccounts[$childAccId], $depth);

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

                        $depth = $parentAccounts[$parentId]['depth'] + 1;

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

                                $sharedOwners = implode(',', array_map('\App\Fields\Owner::getLabel', $sharedOwners));

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

                                $parentAccountInfo[$fieldName] = $sharedOwners;

        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

                        $childAccId = $row['accountid'];

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

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

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

                    }

        Line exceeds 120 characters; contains 252 characters
        Open

                    ->select(['vtiger_account.*', 'vtiger_accountaddress.*', 'user_name' => new \yii\db\Expression('CASE when (vtiger_users.user_name not like ' . App\Db::getInstance()->quoteValue('') . ") THEN $userNameSql ELSE vtiger_groups.groupname END")])

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

                    ->from('vtiger_account')

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

                                $childAccountInfo[$fieldName] = $row['user_name'];

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

             * @param array $parentAccounts      - Array of all the parent accounts

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

             */

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

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

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

                    ->innerJoin('vtiger_crmentity', 'vtiger_account.accountid = vtiger_crmentity.crmid')

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

                    $parentAccountInfo['depth'] = $depth;

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

                        $fieldName = $field['fieldname'];

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

                            $sharedOwners = \App\Fields\SharedOwner::getById($row['accountid']);

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

                        }

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

                    return $childAccounts;

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

                        foreach ($this->hierarchyFields as &$field) {

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

                                    $sharedOwners = implode(',', array_map('\App\Fields\Owner::getLabel', $sharedOwners));

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

                }

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

                        $accountInfoData[] = ['data' => $data, 'fieldname' => $fieldName, 'rawData' => $rawData];

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

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

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

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

                    foreach ($this->hierarchyFields as &$field) {

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

                    ->innerJoin('vtiger_accountaddress', 'vtiger_account.accountid = vtiger_accountaddress.accountaddressid')

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

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

            /**

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

                    $parentAccounts[$id] = $parentAccountInfo;

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

            public function __getChildAccounts($id, &$childAccounts, $depthBase)

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

                if (empty($id) || $depthBase == App\Config::module('Accounts', 'MAX_HIERARCHY_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

                    }

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

            {

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

                    ->innerJoin('vtiger_accountaddress', 'vtiger_accountaddress.accountaddressid = vtiger_account.accountid')

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

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

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

                        $childAccountInfo['depth'] = $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

                $listViewEntries[$accountId] = $accountInfoData;

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

                if (\is_array($accountInfoBase)) {

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

             * Function to Recursively get all the upper accounts of a given Account.

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

                    }

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

                    if (isset($parentAccounts[$parentId])) {

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

                            $parentAccountInfo[$fieldName] = $row['user_name'];

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

                    ->innerJoin('vtiger_crmentity', 'vtiger_account.accountid = vtiger_crmentity.crmid')

        The method __getChildAccounts is not named in camelCase.
        Open

            public function __getChildAccounts($id, &$childAccounts, $depthBase)
            {
                \App\Log::trace('Entering __getChildAccounts(' . $id . ',' . $depthBase . ') method ...');
                if (empty($id) || $depthBase == App\Config::module('Accounts', 'MAX_HIERARCHY_DEPTH')) {
                    \App\Log::error('Exiting __getChildAccounts method ... - exceeded maximum depth of hierarchy');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        CamelCaseMethodName

        Since: 0.2

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

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        The method __getParentAccounts is not named in camelCase.
        Open

            public function __getParentAccounts($id, &$parentAccounts, &$encounteredAccounts, $depthBase = 0)
            {
                \App\Log::trace('Entering __getParentAccounts(' . $id . ') method ...');
                if ($depthBase == App\Config::module('Accounts', 'MAX_HIERARCHY_DEPTH')) {
                    \App\Log::error('Exiting __getParentAccounts method ... - exceeded maximum depth of hierarchy');
        Severity: Minor
        Found in modules/Accounts/Accounts.php by phpmd

        CamelCaseMethodName

        Since: 0.2

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

        Example

        class ClassName {
            public function get_name() {
            }
        }

        Source

        There are no issues that match your filters.

        Category
        Status