YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/views/RelatedList.php

Summary

Maintainability
D
2 days
Test Coverage
F
0%

process accesses the super-global variable $_SESSION.
Open

    public function process(App\Request $request)
    {
        $moduleName = $request->getModule();
        $relatedModuleName = $request->getByType('relatedModule', 2);
        $parentId = $request->getInteger('record');
Severity: Minor
Found in modules/Vtiger/views/RelatedList.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

process accesses the super-global variable $_SESSION.
Open

    public function process(App\Request $request)
    {
        $moduleName = $request->getModule();
        $relatedModuleName = $request->getByType('relatedModule', 2);
        $parentId = $request->getInteger('record');
Severity: Minor
Found in modules/Vtiger/views/RelatedList.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

process accesses the super-global variable $_SESSION.
Open

    public function process(App\Request $request)
    {
        $moduleName = $request->getModule();
        $relatedModuleName = $request->getByType('relatedModule', 2);
        $parentId = $request->getInteger('record');
Severity: Minor
Found in modules/Vtiger/views/RelatedList.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Method process has 145 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process(App\Request $request)
    {
        $moduleName = $request->getModule();
        $relatedModuleName = $request->getByType('relatedModule', 2);
        $parentId = $request->getInteger('record');
Severity: Major
Found in modules/Vtiger/views/RelatedList.php - About 5 hrs to fix

    Function process has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        public function process(App\Request $request)
        {
            $moduleName = $request->getModule();
            $relatedModuleName = $request->getByType('relatedModule', 2);
            $parentId = $request->getInteger('record');
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php - About 5 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    The method process() has 150 lines of code. Current threshold is set to 100. Avoid really long methods.
    Open

        public function process(App\Request $request)
        {
            $moduleName = $request->getModule();
            $relatedModuleName = $request->getByType('relatedModule', 2);
            $parentId = $request->getInteger('record');
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phpmd

    The method process() has an NPath complexity of 1353646080. The configured NPath complexity threshold is 200.
    Open

        public function process(App\Request $request)
        {
            $moduleName = $request->getModule();
            $relatedModuleName = $request->getByType('relatedModule', 2);
            $parentId = $request->getInteger('record');
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phpmd

    NPathComplexity

    Since: 0.1

    The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

    Example

    class Foo {
        function bar() {
            // lots of complicated code
        }
    }

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

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

        public function process(App\Request $request)
        {
            $moduleName = $request->getModule();
            $relatedModuleName = $request->getByType('relatedModule', 2);
            $parentId = $request->getInteger('record');
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.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 46 to the 15 allowed.
    Open

        public function process(App\Request $request)
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by sonar-php

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

    See

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

    class Vtiger_RelatedList_View extends Vtiger_Index_View
    {
        /**
         * Checking permissions.
         *
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phpmd

    CouplingBetweenObjects

    Since: 1.1.0

    A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

    Example

    class Foo {
        /**
         * @var \foo\bar\X
         */
        private $x = null;
    
        /**
         * @var \foo\bar\Y
         */
        private $y = null;
    
        /**
         * @var \foo\bar\Z
         */
        private $z = null;
    
        public function setFoo(\Foo $foo) {}
        public function setBar(\Bar $bar) {}
        public function setBaz(\Baz $baz) {}
    
        /**
         * @return \SplObjectStorage
         * @throws \OutOfRangeException
         * @throws \InvalidArgumentException
         * @throws \ErrorException
         */
        public function process(\Iterator $it) {}
    
        // ...
    }

    Source https://phpmd.org/rules/design.html#couplingbetweenobjects

    Missing class import via use statement (line '31', column '14').
    Open

                throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.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 '53', column '22').
    Open

            $pagingModel = new Vtiger_Paging_Model();
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.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 '27', column '14').
    Open

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.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 '24', column '14').
    Open

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phpmd

    MissingImport

    Since: 2.7.0

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

    Example

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

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

    Avoid using static access to class 'App\Condition' in method 'process'.
    Open

            $searchParams = App\Condition::validSearchParams($relationListView->getQueryGenerator()->getModule(), $request->getArray('search_params'));
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'Vtiger_RelationListView_Model' in method 'process'.
    Open

            $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName, $request->getInteger('relationId'), $cvId);
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.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 'checkPermission'.
    Open

            if (!\App\Privilege::isPermitted($request->getModule(), 'DetailView', $request->getInteger('record'))) {
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.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 'process'.
    Open

            if ($relationModel->isFavorites() && \App\Privilege::isPermitted($moduleName, 'FavoriteRecords')) {
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.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\Condition' in method 'process'.
    Open

                $searchValue = App\Condition::validSearchValue($request->getByType('search_value', 'Text'), $relationListView->getQueryGenerator()->getModule(), $searchKey, $operator);
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            $currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.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 process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $relatedView = $request->getByType('relatedView');
                $_SESSION['relatedView'][$moduleName][$relatedModuleName] = $relatedView;
            }
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phpmd

    ElseExpression

    Since: 1.4.0

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

    Example

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

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

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

            if (\App\Config::performance('LISTVIEW_COMPUTE_PAGE_COUNT')) {
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            $viewer->assign('SHOW_RELATED_WIDGETS', \in_array($relationModel->getId(), App\Config::module($moduleName, 'showRelatedWidgetsByDefault', [])));
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.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\ModuleHierarchy' in method 'process'.
    Open

                $viewer->assign('HIERARCHY', \App\ModuleHierarchy::getModuleLevel($relatedModuleName));
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.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 process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $viewer->assign('IS_WIDGETS', false);
            }
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phpmd

    ElseExpression

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'Users_Record_Model' in method 'process'.
    Open

            $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'Vtiger_Record_Model' in method 'process'.
    Open

            $parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $moduleName);
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.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 "quickSearchEnabled" 3 times.
    Open

            if ($request->has('quickSearchEnabled')) {
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.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 "limit" 3 times.
    Open

            if ($request->has('limit')) {
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.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 "Alnum" 3 times.
    Open

            $cvId = $request->isEmpty('cvId', true) ? 0 : $request->getByType('cvId', 'Alnum');
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.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 "search_params" 3 times.
    Open

            $searchParams = App\Condition::validSearchParams($relationListView->getQueryGenerator()->getModule(), $request->getArray('search_params'));
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.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 "totalCount" 4 times.
    Open

            $totalCount = $request->isEmpty('totalCount', true) ? 0 : $request->getInteger('totalCount');
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.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 "operator" 3 times.
    Open

            if (!$request->isEmpty('operator', true)) {
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.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 "relatedView" 5 times.
    Open

            if ($request->isEmpty('relatedView', true)) {
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.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 "search_key" 3 times.
    Open

            if (!$request->isEmpty('search_key', true)) {
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.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 "entityState" 3 times.
    Open

            if ($request->has('entityState')) {
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.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 "record" 3 times.
    Open

            if ($request->isEmpty('record', true)) {
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.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 undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('PAGE_NUMBER', $pageNumber);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SEARCH_PARAMS', $searchParamsRaw);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::getTemplateVars (Did you mean expr->getTemplatePath())
    Open

            return $this->viewer->view($this->getTemplateName(), $this->viewer->getTemplateVars('MODULE_NAME'), true);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SHOW_CREATOR_DETAIL', $relationModel->showCreatorDetail());
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('PAGE_COUNT', $pagingModel->getPageCount());
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SHOW_RELATED_WIDGETS', \in_array($relationModel->getId(), App\Config::module($moduleName, 'showRelatedWidgetsByDefault', [])));
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('PAGING_MODEL', $pagingModel);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('RELATED_VIEW', $relatedView);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SHOW_HEADER', $showHeader);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SHOW_COMMENT', $relationModel->showComment());
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('FAVORITES', $favorites);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('HIERARCHY', \App\ModuleHierarchy::getModuleLevel($relatedModuleName));
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('VIEW_MODEL', $relationListView);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('LISTVIEW_COUNT', $totalCount);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('TOTAL_ENTRIES', $totalCount);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Reference to undeclared property \CRMEntity->default_order_by
    Open

                if ($moduleInstance->default_order_by && $moduleInstance->default_sort_order) {
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phan

    Reference to undeclared property \CRMEntity->default_order_by
    Open

                    foreach ((array) $moduleInstance->default_order_by as $value) {
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('RELATED_HEADERS', $header);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODULE', $moduleName);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SEARCH_DETAILS', $searchParams);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('VIEW', $request->getByType('view'));
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Reference to static property defaultSource from undeclared class \Config\Modules\ModComments
    Open

                $viewer->assign('HIERARCHY_VALUE', \Config\Modules\ModComments::$defaultSource);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Reference to undeclared property \CRMEntity->default_sort_order
    Open

                if ($moduleInstance->default_order_by && $moduleInstance->default_sort_order) {
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SHOW_SUMMATION_ROW', $request->has('showSummation') ? $request->getBoolean('showSummation') : true);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('RELATED_MODULE', $relationModel->getRelationModuleModel());
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('RELATION_FIELD', $relationModel->getRelationField());
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('OPERATOR', $operator);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

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

                $searchValue = App\Condition::validSearchValue($request->getByType('search_value', 'Text'), $relationListView->getQueryGenerator()->getModule(), $searchKey, $operator);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

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

            $transformedSearchParams = $queryGenerator->parseBaseSearchParamsToCondition($searchParams);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('START_PAGIN_FROM', $pagingModel->getStartPagingFrom());
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('ALPHABET_VALUE', $searchValue);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('IS_FAVORITES', $isFavorites);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('LOCKED_EMPTY_FIELDS', $request->isEmpty('lockedEmptyFields', true) ? [] : $request->getArray('lockedEmptyFields'));
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('RELATED_RECORDS', $models);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('IS_WIDGETS', true);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('IS_WIDGETS', false);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

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

            $searchParams = App\Condition::validSearchParams($relationListView->getQueryGenerator()->getModule(), $request->getArray('search_params'));
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('INVENTORY_FIELDS', $relationModel->getRelationInventoryFields());
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('RELATED_ENTIRES_COUNT', \count($models));
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('ORDER_BY', $orderBy);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('HIERARCHY_VALUE', \Config\Modules\ModComments::$defaultSource);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('PARENT_RECORD', $parentRecordModel);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Reference to undeclared property \CRMEntity->default_sort_order
    Open

                        $orderBy[$value] = $moduleInstance->default_sort_order;
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('RELATED_LIST_LINKS', $links);
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('IS_EDITABLE', $relationModel->isEditable());
    Severity: Critical
    Found in modules/Vtiger/views/RelatedList.php by phan

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

        public function checkPermission(App\Request $request)
        {
            if ($request->isEmpty('record', true)) {
                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
            }
    Severity: Major
    Found in modules/Vtiger/views/RelatedList.php and 1 other location - About 2 hrs to fix
    modules/Vtiger/actions/DetailAjax.php on lines 18..30

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

    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

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

            if (!$request->isEmpty('search_key', true)) {
                $searchKey = $request->getByType('search_key', 'Alnum');
                $searchValue = App\Condition::validSearchValue($request->getByType('search_value', 'Text'), $relationListView->getQueryGenerator()->getModule(), $searchKey, $operator);
                $relationListView->set('search_key', $searchKey);
                $relationListView->set('search_value', $searchValue);
    Severity: Major
    Found in modules/Vtiger/views/RelatedList.php and 1 other location - About 1 hr to fix
    modules/PriceBooks/views/Detail.php on lines 66..72

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

    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

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

            if ($showHeader) {
                $links = $relationListView->getLinks();
                if (!($request->has('showViews') ? $request->getBoolean('showViews') : true)) {
                    unset($links['RELATEDLIST_VIEWS']);
                    $relatedView = 'List';
    Severity: Major
    Found in modules/Vtiger/views/RelatedList.php and 1 other location - About 1 hr to fix
    modules/PriceBooks/views/Detail.php on lines 95..105

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

    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

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

            foreach ($request->getArray('search_params') as $fieldListGroup) {
                $searchParamsRaw[] = $fieldListGroup;
                foreach ($fieldListGroup as $fieldSearchInfo) {
                    $fieldSearchInfo['searchValue'] = $fieldSearchInfo[2] ?? '';
                    $fieldSearchInfo['fieldName'] = $fieldName = $fieldSearchInfo[0] ?? '';
    Severity: Major
    Found in modules/Vtiger/views/RelatedList.php and 2 other locations - About 55 mins to fix
    modules/PriceBooks/views/Detail.php on lines 82..90
    modules/Users/views/List.php on lines 108..116

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

    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

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

            if ($request->isEmpty('relatedView', true)) {
                $relatedView = empty($_SESSION['relatedView'][$moduleName][$relatedModuleName]) ? 'List' : $_SESSION['relatedView'][$moduleName][$relatedModuleName];
            } else {
                $relatedView = $request->getByType('relatedView');
                $_SESSION['relatedView'][$moduleName][$relatedModuleName] = $relatedView;
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php and 1 other location - About 30 mins to fix
    modules/PriceBooks/views/Detail.php on lines 26..31

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

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

            $currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.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 $transformedSearchParams. Keep variable name length under 20.
    Open

            $transformedSearchParams = $queryGenerator->parseBaseSearchParamsToCondition($searchParams);
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.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 Vtiger_RelatedList_View extends Vtiger_Index_View

    The class Vtiger_RelatedList_View is not named in CamelCase.
    Open

    class Vtiger_RelatedList_View extends Vtiger_Index_View
    {
        /**
         * Checking permissions.
         *
    Severity: Minor
    Found in modules/Vtiger/views/RelatedList.php by phpmd

    CamelCaseClassName

    Since: 0.2

    It is considered best practice to use the CamelCase notation to name classes.

    Example

    class class_name {
    }

    Source

    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 ($request->has('entityState')) {

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

            $viewer = $this->getViewer($request);

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

            foreach ($request->getArray('search_params') as $fieldListGroup) {

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

                if (!($request->has('showViews') ? $request->getBoolean('showViews') : 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

            } else {

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

            $totalCount = $request->isEmpty('totalCount', true) ? 0 : $request->getInteger('totalCount');

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

                $relationListView->set('operator', $operator);

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

            }

    Line exceeds 120 characters; contains 147 characters
    Open

            $searchParams = App\Condition::validSearchParams($relationListView->getQueryGenerator()->getModule(), $request->getArray('search_params'));

    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 process(App\Request $request)

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

            if ($request->isEmpty('relatedView', true)) {

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

                $relatedView = empty($_SESSION['relatedView'][$moduleName][$relatedModuleName]) ? 'List' : $_SESSION['relatedView'][$moduleName][$relatedModuleName];

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

            $pagingModel->set('page', $pageNumber);

    Line exceeds 120 characters; contains 154 characters
    Open

            $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName, $request->getInteger('relationId'), $cvId);

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

                $moduleInstance = $relationListView->getRelatedModuleModel()->getEntityInstance();

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

            }

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

                $searchParamsRaw = $searchParams = [];

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

            }

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

            $relationListView->loadSearchLockedFields($request);

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

                foreach ($fieldListGroup as $fieldSearchInfo) {

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

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

                    unset($links['RELATEDLIST_MASSACTIONS']);

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

            }

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

         */

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

        {

    Line exceeds 120 characters; contains 161 characters
    Open

                $relatedView = empty($_SESSION['relatedView'][$moduleName][$relatedModuleName]) ? 'List' : $_SESSION['relatedView'][$moduleName][$relatedModuleName];

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

            if (empty($orderBy)) {

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

                    $orderBy = [];

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

                        $orderBy[$value] = $moduleInstance->default_sort_order;

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

                $showHeader = $request->getBoolean('showHeader');

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

                    $relatedView = 'List';

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

            }

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

                $relationListView->setFields(array_merge(['id'], $request->getArray('fields', 'Alnum')));

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

            }

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

                $pagingModel->set('limit', $request->getInteger('limit'));

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

            $operator = 's';

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

            if (!$request->isEmpty('operator', true)) {

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

                $searchParamsRaw[] = $fieldListGroup;

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

                }

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

                    unset($links['RELATEDLIST_VIEWS']);

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

            $viewer->assign('SHOW_SUMMATION_ROW', $request->has('showSummation') ? $request->getBoolean('showSummation') : true);

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

            $viewer->assign('SHOW_COMMENT', $relationModel->showComment());

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

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

         *

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

         * @throws \App\Exceptions\NoPermittedToRecord

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

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

        }

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

        /**

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

         *

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

            //To make smarty to get the details easily accesible

    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

            $viewer->assign('START_PAGIN_FROM', $pagingModel->getStartPagingFrom());

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

            $viewer->assign('PAGING_MODEL', $pagingModel);

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

            $viewer->assign('SEARCH_DETAILS', $searchParams);

    Line exceeds 120 characters; contains 152 characters
    Open

            $viewer->assign('SHOW_RELATED_WIDGETS', \in_array($relationModel->getId(), App\Config::module($moduleName, 'showRelatedWidgetsByDefault', [])));

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

         * Template name.

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

            $currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

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

            $relatedModuleName = $request->getByType('relatedModule', 2);

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

            $parentId = $request->getInteger('record');

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

                $_SESSION['relatedView'][$moduleName][$relatedModuleName] = $relatedView;

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

                    foreach ((array) $moduleInstance->default_order_by as $value) {

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

            }

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

            $relationListView->set('search_params', $transformedSearchParams);

    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 (!($request->has('showMassActions') ? $request->getBoolean('showMassActions') : true)) {

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

            $viewer->assign('ORDER_BY', $orderBy);

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

            $viewer->assign('LOCKED_EMPTY_FIELDS', $request->isEmpty('lockedEmptyFields', true) ? [] : $request->getArray('lockedEmptyFields'));

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

            if (!\App\Privilege::isPermitted($request->getModule(), 'DetailView', $request->getInteger('record'))) {

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

            }

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

         * @param \App\Request $request

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

            $moduleName = $request->getModule();

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

                $relatedView = $request->getByType('relatedView');

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

            $pagingModel = new Vtiger_Paging_Model();

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

            if (!empty($orderBy)) {

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

                $relationListView->set('orderby', $orderBy);

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

                $operator = $request->getByType('operator');

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

                $relationListView->set('search_key', $searchKey);

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

            if (empty($searchParams) || !\is_array($searchParams)) {

    Line exceeds 120 characters; contains 123 characters
    Open

                $relationListView->setFields(array_merge(['id'], $relationListView->getRelatedModuleModel()->getNameFields()));

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

            $viewer->assign('VIEW_MODEL', $relationListView);

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

            $viewer->assign('PARENT_RECORD', $parentRecordModel);

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

            $viewer->assign('RELATION_FIELD', $relationModel->getRelationField());

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

                $favorites = $relationListView->getFavoriteRecords();

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

            $viewer->assign('SHOW_RELATED_WIDGETS', \in_array($relationModel->getId(), App\Config::module($moduleName, 'showRelatedWidgetsByDefault', [])));

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

        public function loadView()

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

         */

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

            $viewer->assign('PAGE_COUNT', $pagingModel->getPageCount());

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

            if ($relationListView->isWidgetsList()) {

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

                $viewer->assign('HIERARCHY', \App\ModuleHierarchy::getModuleLevel($relatedModuleName));

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

            }

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

            return $this->loadView();

    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

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

            $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName, $request->getInteger('relationId'), $cvId);

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

            }

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

                $searchKey = $request->getByType('search_key', 'Alnum');

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

                    $searchParams[$fieldName] = $fieldSearchInfo;

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

            if ($request->has('showHeader')) {

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

                $links = $relationListView->getLinks();

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

            }

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

            if (\App\Config::performance('LISTVIEW_COMPUTE_PAGE_COUNT')) {

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

            if ($relationModel->isFavorites() && \App\Privilege::isPermitted($moduleName, 'FavoriteRecords')) {

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

            $viewer->assign('IS_EDITABLE', $relationModel->isEditable());

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

            $viewer->assign('SEARCH_PARAMS', $searchParamsRaw);

    Line exceeds 120 characters; contains 140 characters
    Open

            $viewer->assign('LOCKED_EMPTY_FIELDS', $request->isEmpty('lockedEmptyFields', true) ? [] : $request->getArray('lockedEmptyFields'));

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

                $viewer->assign('IS_WIDGETS', true);

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

            if ('ListPreview' === $relatedView) {

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

                $pagingModel->set('totalCount', $totalCount);

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

            $viewer->assign('INVENTORY_FIELDS', $relationModel->getRelationInventoryFields());

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

            $isFavorites = false;

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

                $viewer->assign('HIERARCHY_VALUE', \Config\Modules\ModComments::$defaultSource);

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

        {

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

                $relationListView->set('advSortEnabled', $request->getBoolean('sortEnabled'));

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

            $viewer->assign('RELATED_RECORDS', $models);

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

            $viewer->assign('RELATED_MODULE', $relationModel->getRelationModuleModel());

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

                $pagingModel->set('totalCount', $totalCount);

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

            }

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

            $viewer->assign('TOTAL_ENTRIES', $totalCount);

    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 ($request->isEmpty('record', true)) {

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

         * Process.

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

            }

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

            $orderBy = $request->getArray('orderby', \App\Purifier::STANDARD, [], \App\Purifier::SQL);

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

                    }

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

                $relationListView->set('entityState', $request->getByType('entityState'));

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

            if (!$request->isEmpty('search_key', true)) {

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

            $transformedSearchParams = $queryGenerator->parseBaseSearchParamsToCondition($searchParams);

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

                    $fieldSearchInfo['fieldName'] = $fieldName = $fieldSearchInfo[0] ?? '';

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

                $relationListView->set('quickSearchEnabled', $request->getBoolean('quickSearchEnabled'));

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

            }

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

            $viewer->assign('SHOW_CREATOR_DETAIL', $relationModel->showCreatorDetail());

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

                $totalCount = (int) $relationListView->getRelatedEntriesCount();

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

            } elseif (!empty($totalCount)) {

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

                $isFavorites = $relationModel->isFavorites();

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

         * Load template.

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

         * @param \App\Request $request

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

            if (!$currentUserPrivilegesModel->hasModulePermission($request->getByType('relatedModule', 2))) {

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

                throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

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

            $cvId = $request->isEmpty('cvId', true) ? 0 : $request->getByType('cvId', 'Alnum');

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

            $parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $moduleName);

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

                $viewer->assign('OPERATOR', $operator);

    Line exceeds 120 characters; contains 180 characters
    Open

                $searchValue = App\Condition::validSearchValue($request->getByType('search_value', 'Text'), $relationListView->getQueryGenerator()->getModule(), $searchKey, $operator);

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

            $viewer->assign('RELATED_VIEW', $relatedView);

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

            $viewer->assign('RELATED_ENTIRES_COUNT', \count($models));

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

            $viewer->assign('LISTVIEW_COUNT', $totalCount);

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

        {

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

            $searchParams = App\Condition::validSearchParams($relationListView->getQueryGenerator()->getModule(), $request->getArray('search_params'));

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

            $queryGenerator = $relationListView->getQueryGenerator();

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

                    $fieldSearchInfo['searchValue'] = $fieldSearchInfo[2] ?? '';

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

            $relationModel = $relationListView->getRelationModel();

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

            $viewer->assign('RELATED_HEADERS', $header);

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

            $viewer->assign('IS_FAVORITES', $isFavorites);

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

            return $this->viewer->view($this->getTemplateName(), $this->viewer->getTemplateVars('MODULE_NAME'), true);

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

            $pageNumber = $request->isEmpty('page', true) ? 1 : $request->getInteger('page');

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

            if ($request->has('limit')) {

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

                if ($moduleInstance->default_order_by && $moduleInstance->default_sort_order) {

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

            }

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

                $searchValue = App\Condition::validSearchValue($request->getByType('search_value', 'Text'), $relationListView->getQueryGenerator()->getModule(), $searchKey, $operator);

    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 ($request->has('quickSearchEnabled')) {

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

            $models = $relationListView->getEntries($pagingModel);

    Line exceeds 120 characters; contains 125 characters
    Open

            $viewer->assign('SHOW_SUMMATION_ROW', $request->has('showSummation') ? $request->getBoolean('showSummation') : true);

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

            $viewer->assign('PAGE_NUMBER', $pageNumber);

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

            $viewer->assign('VIEW', $request->getByType('view'));

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

                $viewer->assign('IS_WIDGETS', false);

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

        /**

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

        /**

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

         * Checking permissions.

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

        public function checkPermission(App\Request $request)

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

                }

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

                $relationListView->set('search_value', $searchValue);

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

                $viewer->assign('ALPHABET_VALUE', $searchValue);

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

                    $fieldSearchInfo['specialOption'] = $fieldSearchInfo[3] ?? '';

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

            $showHeader = 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

                $relationListView->setFields(array_merge(['id'], $relationListView->getRelatedModuleModel()->getNameFields()));

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

            if ($request->has('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

                $viewer->assign('RELATED_LIST_LINKS', $links);

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

            $viewer->assign('SHOW_HEADER', $showHeader);

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

            $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());

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

            return 'RelatedList.tpl';

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

            $header = $relationListView->getHeaders();

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

            if ($request->has('sortEnabled')) {

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

            $viewer->assign('MODULE', $moduleName);

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

                $viewer->assign('FAVORITES', $favorites);

    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

        }

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

    class Vtiger_RelatedList_View extends Vtiger_Index_View

    There are no issues that match your filters.

    Category
    Status