YetiForceCompany/YetiForceCRM

View on GitHub
modules/OSSEmployees/OSSEmployees.php

Summary

Maintainability
D
1 day
Test Coverage
F
3%

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

    public function getEmployeeHierarchy($id)
    {
        \App\Log::trace('Entering getEmployeeHierarchy(' . $id . ') method ...');

        $listViewHeader = [];
Severity: Minor
Found in modules/OSSEmployees/OSSEmployees.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

    public function __getChildEmployees($id, &$childAccounts, $depth)
    {
        $userNameSql = App\Module::getSqlForNameInDisplayFormat('Users');
        $dataReader = (new App\Db\Query())
            ->select(['vtiger_ossemployees.*', '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/OSSEmployees/OSSEmployees.php - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Method getEmployeeHierarchy has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getEmployeeHierarchy($id)
    {
        \App\Log::trace('Entering getEmployeeHierarchy(' . $id . ') method ...');

        $listViewHeader = [];
Severity: Minor
Found in modules/OSSEmployees/OSSEmployees.php - About 1 hr to fix

    The class OSSEmployees has 18 fields. Consider redesigning OSSEmployees to keep the number of fields under 15.
    Open

    class OSSEmployees extends Vtiger_CRMEntity
    {
        public $table_name = 'vtiger_ossemployees';
        public $table_index = 'ossemployeesid';
        public $column_fields = [];
    Severity: Minor
    Found in modules/OSSEmployees/OSSEmployees.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 __getParentEmployees has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __getParentEmployees($id, &$parentAccounts, &$encounteredAccounts)
        {
            $parentId = (new App\Db\Query())
                ->select(['parentid'])
                ->from('vtiger_ossemployees')
    Severity: Minor
    Found in modules/OSSEmployees/OSSEmployees.php - About 1 hr to fix

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

          public function __getChildEmployees($id, &$childAccounts, $depth)
          {
              $userNameSql = App\Module::getSqlForNameInDisplayFormat('Users');
              $dataReader = (new App\Db\Query())
                  ->select(['vtiger_ossemployees.*', '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/OSSEmployees/OSSEmployees.php - About 1 hr to fix

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

            public function __getParentEmployees($id, &$parentAccounts, &$encounteredAccounts)
            {
                $parentId = (new App\Db\Query())
                    ->select(['parentid'])
                    ->from('vtiger_ossemployees')
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.php - About 35 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            public function moduleHandler($moduleName, $eventType)
            {
                if ('module.postinstall' == $eventType) {
                    //block with fields in summary
                    $tabId = \App\Module::getModuleId($moduleName);
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.php - About 35 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            public function getEmployeeHierarchy($id)
            {
                \App\Log::trace('Entering getEmployeeHierarchy(' . $id . ') method ...');
        
                $listViewHeader = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 29 to the 15 allowed.
        Open

            public function getEmployeeHierarchy($id)
        Severity: Critical
        Found in modules/OSSEmployees/OSSEmployees.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

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

                $data = (new App\Db\Query())
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 '178', column '58').
        Open

                    ->select(['vtiger_ossemployees.*', '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/OSSEmployees/OSSEmployees.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 '137', column '20').
        Open

                $parentId = (new App\Db\Query())
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 '148', column '58').
        Open

                    ->select(['vtiger_ossemployees.*', '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/OSSEmployees/OSSEmployees.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 '177', column '22').
        Open

                $dataReader = (new App\Db\Query())
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 __getChildEmployees uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                            } else {
                                $childAccountInfo[$columnName] = $row[$columnName];
                            }
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.php by phpmd

        ElseExpression

        Since: 1.4.0

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

        Example

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

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

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

                                    } else {
                                        $data = '<i>' . $data . '</i>';
                                    }
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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\Field' in method 'getEmployeeHierarchy'.
        Open

                        } elseif (\App\Field::getFieldPermission('OSSEmployees', $colName)) {
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 'getEmployeeHierarchy'.
        Open

                            $data = \App\Purifier::encodeHtml($accountInfo[$colName]);
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 __getParentEmployees uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                    } else {
                        $parentAccountInfo[$columnName] = $data[$columnName];
                    }
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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\Module' in method '__getChildEmployees'.
        Open

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

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

                                } else {
                                    $data = '<b>' . $data . '</b>';
                                }
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 'getEmployeeHierarchy'.
        Open

                \App\Log::trace('Exiting getEmployeeHierarchy method ...');
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 '__getParentEmployees'.
        Open

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

                \App\Log::trace('Entering getEmployeeHierarchy(' . $id . ') method ...');
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 'moduleHandler'.
        Open

                    $tabId = \App\Module::getModuleId($moduleName);
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 'vtlib\Module' in method 'moduleHandler'.
        Open

                    $modcommentsModuleInstance = vtlib\Module::getInstance('ModComments');
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 'ModComments' in method 'moduleHandler'.
        Open

                            ModComments::addWidgetTo(['OSSEmployees']);
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

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

                        $listViewHeader[] = \App\Language::translate($fieldName);
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 'getEmployeeHierarchy'.
        Open

                    $hasRecordViewAccess = \App\Privilege::isPermitted('OSSEmployees', 'DetailView', $employeesId);
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 "ossemployeesid" 5 times.
        Open

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

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

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

                'LBL_LASTNAME' => 'last_name',
        Severity: Critical
        Found in modules/OSSEmployees/OSSEmployees.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

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

                $rowsList = $this->__getChildEmployees($id, $rowsList, $rowsList[$id]['depth']);
        Severity: Critical
        Found in modules/OSSEmployees/OSSEmployees.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" 4 times.
        Open

                'Assigned To' => 'assigned_user_id',
        Severity: Critical
        Found in modules/OSSEmployees/OSSEmployees.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 "ossemployees" 4 times.
        Open

                'LBL_LASTNAME' => ['ossemployees', 'last_name'],
        Severity: Critical
        Found in modules/OSSEmployees/OSSEmployees.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" 5 times.
        Open

            public $tab_name = ['vtiger_crmentity', 'vtiger_ossemployees', 'vtiger_ossemployeescf', 'vtiger_entity_stats'];
        Severity: Critical
        Found in modules/OSSEmployees/OSSEmployees.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_ossemployees" 6 times.
        Open

            public $table_name = 'vtiger_ossemployees';
        Severity: Critical
        Found in modules/OSSEmployees/OSSEmployees.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_ossemployees.ossemployeesid = vtiger_crmentity.crmid" 3 times.
        Open

                    ->innerJoin('vtiger_crmentity', 'vtiger_ossemployees.ossemployeesid = vtiger_crmentity.crmid')
        Severity: Critical
        Found in modules/OSSEmployees/OSSEmployees.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 "parentid" 4 times.
        Open

                            } elseif ('parentid' == $colName) {
        Severity: Critical
        Found in modules/OSSEmployees/OSSEmployees.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 "OSSEmployees" 5 times.
        Open

                    if (\App\Field::getFieldPermission('OSSEmployees', $colName)) {
        Severity: Critical
        Found in modules/OSSEmployees/OSSEmployees.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 "business_mail" 3 times.
        Open

                'LBL_BUSINESSMAIL' => 'business_mail',
        Severity: Critical
        Found in modules/OSSEmployees/OSSEmployees.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

                    ->select(['vtiger_ossemployees.*', '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/OSSEmployees/OSSEmployees.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_ossemployeescf" 3 times.
        Open

            public $customFieldTable = ['vtiger_ossemployeescf', 'ossemployeesid'];
        Severity: Critical
        Found in modules/OSSEmployees/OSSEmployees.php by sonar-php

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

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

                    ->where(['vtiger_crmentity.deleted' => 0, 'vtiger_ossemployees.ossemployeesid' => $id])->scalar();
        Severity: Critical
        Found in modules/OSSEmployees/OSSEmployees.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 __construct from undeclared class \yii\db\Expression
        Open

                    ->select(['vtiger_ossemployees.*', '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/OSSEmployees/OSSEmployees.php by phan

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

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

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

                    ->select(['vtiger_ossemployees.*', '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/OSSEmployees/OSSEmployees.php by phan

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

                    ->select(['vtiger_ossemployees.*', '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/OSSEmployees/OSSEmployees.php by phan

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

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

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

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

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

                    \App\Db::getInstance()->createCommand()->update('vtiger_field', ['summaryfield' => 1], ['and', ['tabid' => $tabId],
        Severity: Critical
        Found in modules/OSSEmployees/OSSEmployees.php by phan

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

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

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

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

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

                    ->select(['vtiger_ossemployees.*', '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/OSSEmployees/OSSEmployees.php by phan

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

                            ModComments::addWidgetTo(['OSSEmployees']);
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.php by phan

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

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

        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

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

                $dataReader = (new App\Db\Query())
                    ->select(['vtiger_ossemployees.*', '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_ossemployees')
                    ->innerJoin('vtiger_crmentity', 'vtiger_ossemployees.ossemployeesid = vtiger_crmentity.crmid')
                    ->leftJoin('vtiger_groups', 'vtiger_crmentity.smownerid = vtiger_groups.groupid')
        Severity: Major
        Found in modules/OSSEmployees/OSSEmployees.php and 1 other location - About 1 hr to fix
        modules/OSSEmployees/OSSEmployees.php on lines 147..154

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 102.

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

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

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

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

        Refactorings

        Further Reading

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

                $data = (new App\Db\Query())
                    ->select(['vtiger_ossemployees.*', '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_ossemployees')
                    ->innerJoin('vtiger_crmentity', 'vtiger_ossemployees.ossemployeesid = vtiger_crmentity.crmid')
                    ->leftJoin('vtiger_groups', 'vtiger_crmentity.smownerid = vtiger_groups.groupid')
        Severity: Major
        Found in modules/OSSEmployees/OSSEmployees.php and 1 other location - About 1 hr to fix
        modules/OSSEmployees/OSSEmployees.php on lines 177..183

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 102.

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

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

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

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

        Refactorings

        Further Reading

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

            public $def_detailview_recname = 'last_name';
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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

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

                    $modcommentsModuleInstance = vtlib\Module::getInstance('ModComments');
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 OSSEmployees extends Vtiger_CRMEntity

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

        <?php

        The property $table_index is not named in camelCase.
        Open

        class OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 $special_functions is not named in camelCase.
        Open

        class OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 getEmployeeHierarchy($id)
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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_detailview_recname is not named in camelCase.
        Open

        class OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 __getChildEmployees($id, &$childAccounts, $depth)
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 $table_name is not named in camelCase.
        Open

        class OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 $def_basicsearch_col is not named in camelCase.
        Open

        class OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 $list_fields_name is not named in camelCase.
        Open

        class OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 $popup_fields is not named in camelCase.
        Open

        class OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 __getParentEmployees($id, &$parentAccounts, &$encounteredAccounts)
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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 $default_order_by is not named in camelCase.
        Open

        class OSSEmployees extends Vtiger_CRMEntity
        {
            public $table_name = 'vtiger_ossemployees';
            public $table_index = 'ossemployeesid';
            public $column_fields = [];
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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

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

            public $customFieldTable = ['vtiger_ossemployeescf', 'ossemployeesid'];

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

            /**

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

                'vtiger_entity_stats' => 'crmid', ];

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

                // Format: Field Label => fieldname

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

            ];

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

            public $search_fields_name = [];

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

            public $default_order_by = '';

        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

                $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 (!$hasRecordViewAccess && 'name' != $colName) {

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

                            if ('name' == $colName) {

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

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

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

            public $table_index = 'ossemployeesid';

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

                'FL_POSITION' => ['crmentity', 'position'],

        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 $special_functions = ['set_import_assigned_user'];

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

            public function getEmployeeHierarchy($id)

        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

                foreach ($this->list_fields_name as $fieldName => $colName) {

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

                                    if ($hasRecordViewAccess) {

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

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

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

            public $tab_name_index = [

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

                'Assigned To' => 'assigned_user_id',

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

                'LBL_NAME' => ['ossemployees', 'name'],

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

             *                returns Employees hierarchy in array format

        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

                                    } else {

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

                'vtiger_crmentity' => 'crmid',

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

                'LBL_BUSINESSPHONE' => 'business_phone',

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

                'LBL_BUSINESSPHONE' => ['ossemployees', 'business_phone'],

        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 ($employeesId != $id) {

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

            /**

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

            public $list_fields_name = [

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

                'LBL_LASTNAME' => 'last_name',

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

                'FL_POSITION' => 'position',

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

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

                    $hasRecordViewAccess = \App\Privilege::isPermitted('OSSEmployees', 'DetailView', $employeesId);

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

                'vtiger_ossemployees' => 'ossemployeesid',

        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

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

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

             * @param int $id - employeeid

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

            /** Indicator if this is a custom module or standard module */

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

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

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

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

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

            {

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

                    if (\App\Field::getFieldPermission('OSSEmployees', $colName)) {

        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

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

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

                'LBL_LASTNAME' => ['ossemployees', 'last_name'],

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

            // Callback function list during Importing

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

                $rowsList = $this->__getParentEmployees($id, $rowsList, $encounteredAccounts);

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

            public $IsCustomModule = true;

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

             */

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

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

                $rowsList = [];

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

                $rowsList = $this->__getChildEmployees($id, $rowsList, $rowsList[$id]['depth']);

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

                    foreach ($this->list_fields_name as $fieldName => $colName) {

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

            /**

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

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

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

                'LBL_NAME' => 'name',

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

                'LBL_BUSINESSMAIL' => 'business_mail',

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

                            $accountInfoData[] = '';

        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

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

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

            /**

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

            // For Popup listview and UI type support

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

            public $popup_fields = ['last_name'];

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

            // Refers to vtiger_field.fieldname values.

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

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

        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

                            } elseif ('parentid' == $colName) {

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

            public $table_name = 'vtiger_ossemployees';

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

             */

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

             */

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

                foreach ($rowsList as $employeesId => $accountInfo) {

        Line exceeds 120 characters; contains 140 characters
        Open

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

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

                                    }

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

                                }

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

            public $tab_name = ['vtiger_crmentity', 'vtiger_ossemployees', 'vtiger_ossemployeescf', 'vtiger_entity_stats'];

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

            public $relationFields = [];

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

            // For Popup window record selection

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

            public $def_detailview_recname = 'last_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

                'LBL_BUSINESSMAIL' => ['ossemployees', 'business_mail'],

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

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

                        } elseif (\App\Field::getFieldPermission('OSSEmployees', $colName)) {

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

            public $def_basicsearch_col = 'last_name';

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

                        $listViewHeader[] = \App\Language::translate($fieldName);

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

                    $accountInfoData = [];

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

                'vtiger_ossemployeescf' => 'ossemployeesid',

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

                            $data = \App\Purifier::encodeHtml($accountInfo[$colName]);

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

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

        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

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

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

                    ->select(['vtiger_ossemployees.*', '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

                }

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

                    $tabId = \App\Module::getModuleId($moduleName);

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

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

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

                    ->innerJoin('vtiger_crmentity', 'vtiger_ossemployees.ossemployeesid = vtiger_crmentity.crmid')

        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

            }

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

                            }

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

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

                    ->one();

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

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

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

            }

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

            }

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

                    ->innerJoin('vtiger_crmentity', 'vtiger_ossemployees.ossemployeesid = vtiger_crmentity.crmid')

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

                    ++$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[$employeesId] = $accountInfoData;

        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

                $depth = 0;

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

                    ->select(['vtiger_ossemployees.*', '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

                        }

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

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

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

                return $hierarchy;

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

                    $this->__getParentEmployees($parentId, $parentAccounts, $encounteredAccounts);

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

                    ->innerJoin('vtiger_crmentity', 'vtiger_ossemployees.ossemployeesid = vtiger_crmentity.crmid')

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

                $immediateParentId = $data['parentid'];

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

                foreach ($this->list_fields_name as $columnName) {

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

                    ->from('vtiger_ossemployees')

        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

                    //block with fields in summary

        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

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

        Line exceeds 120 characters; contains 230 characters
        Open

                    ->select(['vtiger_ossemployees.*', '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

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

        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

                    if ('assigned_user_id' == $columnName) {

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

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

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

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

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

                        include_once 'modules/ModComments/ModComments.php';

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

                    ->from('vtiger_ossemployees')

        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

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

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

                    \App\Db::getInstance()->createCommand()->update('vtiger_field', ['summaryfield' => 1], ['and', ['tabid' => $tabId],

        Line exceeds 120 characters; contains 127 characters
        Open

                    \App\Db::getInstance()->createCommand()->update('vtiger_field', ['summaryfield' => 1], ['and', ['tabid' => $tabId],

        Line exceeds 120 characters; contains 180 characters
        Open

                        ['columnname' => ['ossemployees_no', 'employee_status', 'name', 'last_name', 'pesel', 'id_card', 'employee_education', 'parentid', 'business_mail']], ])->execute();

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

                            $accountInfoData[] = $data;

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

                    ->select(['parentid'])

        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

            {

        Line exceeds 120 characters; contains 230 characters
        Open

                    ->select(['vtiger_ossemployees.*', '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

                        }

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

            public function moduleHandler($moduleName, $eventType)

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

                                $fieldModel = Vtiger_Module_Model::getInstance('OSSEmployees')->getFieldByName($fieldName);

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

                    ->from('vtiger_ossemployees')

        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

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

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

                        $this->__getChildEmployees($childAccId, $childAccounts, $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 = $fieldModel->getDisplayValue($data);

        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

                        $childAccId = $row['ossemployeesid'];

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

                            continue;

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

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

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

                            } else {

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

                    // block with comments

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

                    ->where(['vtiger_crmentity.deleted' => 0, 'vtiger_ossemployees.ossemployeesid' => $id])->scalar();

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

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

        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 (\array_key_exists($childAccId, $childAccounts)) {

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

                        foreach ($this->list_fields_name as $columnName) {

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

                                $childAccountInfo[$columnName] = $row[$columnName];

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

                            }

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

                        }

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

                        $childAccounts[$childAccId] = $childAccountInfo;

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

                        $parentAccountInfo[$columnName] = $data['user_name'];

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

                        $parentAccountInfo[$columnName] = $data[$columnName];

        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

                        $childAccountInfo['depth'] = $depth;

        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

            public function __getParentEmployees($id, &$parentAccounts, &$encounteredAccounts)

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

                if (!empty($parentId) && !\in_array($parentId, $encounteredAccounts)) {

        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

                }

        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

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

        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

                            if ('assigned_user_id' == $columnName) {

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

                        }

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

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

        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

                    }

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

                        ['columnname' => ['ossemployees_no', 'employee_status', 'name', 'last_name', 'pesel', 'id_card', 'employee_education', 'parentid', 'business_mail']], ])->execute();

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

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

        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_ossemployees.ossemployeesid' => $id])

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

            public function __getChildEmployees($id, &$childAccounts, $depth)

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

                        if (class_exists('ModComments')) {

        The method __getChildEmployees is not named in camelCase.
        Open

            public function __getChildEmployees($id, &$childAccounts, $depth)
            {
                $userNameSql = App\Module::getSqlForNameInDisplayFormat('Users');
                $dataReader = (new App\Db\Query())
                    ->select(['vtiger_ossemployees.*', '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/OSSEmployees/OSSEmployees.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 __getParentEmployees is not named in camelCase.
        Open

            public function __getParentEmployees($id, &$parentAccounts, &$encounteredAccounts)
            {
                $parentId = (new App\Db\Query())
                    ->select(['parentid'])
                    ->from('vtiger_ossemployees')
        Severity: Minor
        Found in modules/OSSEmployees/OSSEmployees.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