YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
D
2 days
Test Coverage
F
0%

Function setRelatedParent has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    public function setRelatedParent(App\Request $request)
    {
        $filterFields = $request->getArray('filterFields', 'Text');
        if (!($relationId = $request->isEmpty('relationId') ? 0 : $request->getInteger('relationId')) && $this->sourceField) {
            $relationId = \App\Relation::getRelationId($this->moduleName, $this->sourceModule, $this->sourceField);
Severity: Minor
Found in modules/Vtiger/views/RecordsList.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

Method initializeContent has 130 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function initializeContent(App\Request $request)
    {
        $viewer = $this->getViewer($request);
        $this->moduleName = $request->getModule();
        $this->sourceModule = $request->getByType('src_module', 2);
Severity: Major
Found in modules/Vtiger/views/RecordsList.php - About 5 hrs to fix

    Function initializeContent has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        public function initializeContent(App\Request $request)
        {
            $viewer = $this->getViewer($request);
            $this->moduleName = $request->getModule();
            $this->sourceModule = $request->getByType('src_module', 2);
    Severity: Minor
    Found in modules/Vtiger/views/RecordsList.php - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    The class Vtiger_RecordsList_View has an overall complexity of 94 which is very high. The configured complexity threshold is 50.
    Open

    class Vtiger_RecordsList_View extends \App\Controller\Modal
    {
        /** {@inheritdoc} */
        public $modalSize = 'modal-fullscreen';
    
    
    Severity: Minor
    Found in modules/Vtiger/views/RecordsList.php by phpmd

    File RecordsList.php has 280 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Records list view class.
     *
    Severity: Minor
    Found in modules/Vtiger/views/RecordsList.php - About 2 hrs to fix

      Method setRelatedParent has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function setRelatedParent(App\Request $request)
          {
              $filterFields = $request->getArray('filterFields', 'Text');
              if (!($relationId = $request->isEmpty('relationId') ? 0 : $request->getInteger('relationId')) && $this->sourceField) {
                  $relationId = \App\Relation::getRelationId($this->moduleName, $this->sourceModule, $this->sourceField);
      Severity: Major
      Found in modules/Vtiger/views/RecordsList.php - About 2 hrs to fix

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

            public function checkPermission(App\Request $request)
            {
                $currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
                if (!$request->isEmpty('related_parent_module') && !$currentUserPrivilegesModel->hasModulePermission($request->getByType('related_parent_module', 2))) {
                    throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.php - About 45 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            public function setRecordListModel(App\Request $request)
            {
                if ($this->relatedParentId && !\App\Record::isExists($this->relatedParentId)) {
                    $this->relatedParentId = $this->relatedParentModule = '';
                }
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 initializeContent() has 137 lines of code. Current threshold is set to 100. Avoid really long methods.
        Open

            public function initializeContent(App\Request $request)
            {
                $viewer = $this->getViewer($request);
                $this->moduleName = $request->getModule();
                $this->sourceModule = $request->getByType('src_module', 2);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.php by phpmd

        The method checkPermission() has an NPath complexity of 240. The configured NPath complexity threshold is 200.
        Open

            public function checkPermission(App\Request $request)
            {
                $currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
                if (!$request->isEmpty('related_parent_module') && !$currentUserPrivilegesModel->hasModulePermission($request->getByType('related_parent_module', 2))) {
                    throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 initializeContent() has an NPath complexity of 1274019840. The configured NPath complexity threshold is 200.
        Open

            public function initializeContent(App\Request $request)
            {
                $viewer = $this->getViewer($request);
                $this->moduleName = $request->getModule();
                $this->sourceModule = $request->getByType('src_module', 2);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 initializeContent() has a Cyclomatic Complexity of 39. The configured cyclomatic complexity threshold is 10.
        Open

            public function initializeContent(App\Request $request)
            {
                $viewer = $this->getViewer($request);
                $this->moduleName = $request->getModule();
                $this->sourceModule = $request->getByType('src_module', 2);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.php by phpmd

        CyclomaticComplexity

        Since: 0.1

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

        Example

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

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

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

            public function setRelatedParent(App\Request $request)
            {
                $filterFields = $request->getArray('filterFields', 'Text');
                if (!($relationId = $request->isEmpty('relationId') ? 0 : $request->getInteger('relationId')) && $this->sourceField) {
                    $relationId = \App\Relation::getRelationId($this->moduleName, $this->sourceModule, $this->sourceField);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.php by phpmd

        CyclomaticComplexity

        Since: 0.1

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

        Example

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

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

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

            public function checkPermission(App\Request $request)
            {
                $currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
                if (!$request->isEmpty('related_parent_module') && !$currentUserPrivilegesModel->hasModulePermission($request->getByType('related_parent_module', 2))) {
                    throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 43 to the 15 allowed.
        Open

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

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

        See

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

            public function initializeContent(App\Request $request)
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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_RecordsList_View has a coupling between objects value of 23. Consider to reduce the number of dependencies under 13.
        Open

        class Vtiger_RecordsList_View extends \App\Controller\Modal
        {
            /** {@inheritdoc} */
            public $modalSize = 'modal-fullscreen';
        
        
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 '36', column '14').
        Open

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

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

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

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

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

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

                        if ($relatedParentIdTemp && ($relatedParentModuleTemp = \App\Record::getType($relatedParentIdTemp)) === \App\Module::getModuleName($hierarchy['rel_tabid'])) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'initializeContent'.
        Open

                        ->assign('SWITCH_ON_TEXT', $this->switchLabel ? \App\Language::translate($this->switchLabel, $this->moduleName) : \App\Language::translateSingularModuleName($this->relatedParentModule));
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'CustomView_Record_Model' in method 'initializeContent'.
        Open

                $viewer->assign('CUSTOM_VIEWS', CustomView_Record_Model::getAllByGroup($request->getModule()));
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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($this->relatedParentModule, 'DetailView', $this->relatedParentId)) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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_ListView_Model' in method 'setRecordListModel'.
        Open

                    $this->recordListModel = Vtiger_ListView_Model::getInstanceForPopup($this->moduleName, $this->sourceModule, $cvId);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class '\App\Record' in method 'setRelatedParent'.
        Open

                        $linkModule = \App\Record::getType($linkRecord);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 assigning values to variables in if clauses and the like (line '298', column '34').
        Open

            public function setRelatedParent(App\Request $request)
            {
                $filterFields = $request->getArray('filterFields', 'Text');
                if (!($relationId = $request->isEmpty('relationId') ? 0 : $request->getInteger('relationId')) && $this->sourceField) {
                    $relationId = \App\Relation::getRelationId($this->moduleName, $this->sourceModule, $this->sourceField);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.php by phpmd

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

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

        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->view('Modals/RecordsList.tpl', $request->getModule());
                }
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'Vtiger_Record_Model' in method 'setRelatedParent'.
        Open

                            $srcRecordModel = Vtiger_Record_Model::getInstanceById($this->sourceRecord, $this->sourceModule);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'setRelatedParent'.
        Open

                        if (\in_array($linkModule, \App\ModuleHierarchy::getModulesMap1M($this->moduleName))) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'setRecordListModel'.
        Open

                    $parentRecordModel = Vtiger_Record_Model::getInstanceById($this->relatedParentId, $this->relatedParentModule);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'setRelatedParent'.
        Open

                    if (\in_array($linkModule, \App\ModuleHierarchy::getModulesMap1M($this->moduleName))) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 setRecordListModel uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $this->recordListModel = Vtiger_ListView_Model::getInstanceForPopup($this->moduleName, $this->sourceModule, $cvId);
                }
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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\ModuleHierarchy' in method 'setRelatedParent'.
        Open

                    if (!$request->isEmpty('process', true) && \in_array($this->moduleName, array_keys(\App\ModuleHierarchy::getModulesByLevel(2)))) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class '\App\Record' in method 'checkPermission'.
        Open

                    $this->relatedParentModule = $request->isEmpty('related_parent_module', true) ? \App\Record::getType($this->relatedParentId) : $request->getByType('related_parent_module', \App\Purifier::ALNUM);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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_Module_Model' in method 'initializeContent'.
        Open

                $viewer->assign('MODULE_MODEL', Vtiger_Module_Model::getInstance($this->moduleName));
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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/RecordsList.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 'setRelatedParent'.
        Open

                        if (\in_array($this->moduleName, \App\ModuleHierarchy::getChildModules($processModule)) && \in_array($processModule, \App\ModuleHierarchy::getModulesMap1M($this->moduleName))) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'setRelatedParent'.
        Open

                            if (\in_array($linkModule, \App\ModuleHierarchy::getModulesMap1M($this->moduleName))) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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\Security\AdminAccess' in method 'checkPermission'.
        Open

                if (!$request->isEmpty('src_module') && (!\App\Security\AdminAccess::isPermitted($request->getByType('src_module', 2)) && !$currentUserPrivilegesModel->hasModulePermission($request->getByType('src_module', 2)))) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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_RecordStructure_Model' in method 'initializeContent'.
        Open

                $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'setRelatedParent'.
        Open

                if ($relationId && !$request->has('related_parent_id') && $hierarchyData = \App\ModuleHierarchy::getHierarchyByRelation($relationId)) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'initializeContent'.
        Open

                        ->assign('SWITCH_ON_TEXT', $this->switchLabel ? \App\Language::translate($this->switchLabel, $this->moduleName) : \App\Language::translateSingularModuleName($this->relatedParentModule));
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 assigning values to variables in if clauses and the like (line '284', column '9').
        Open

            public function setRelatedParent(App\Request $request)
            {
                $filterFields = $request->getArray('filterFields', 'Text');
                if (!($relationId = $request->isEmpty('relationId') ? 0 : $request->getInteger('relationId')) && $this->sourceField) {
                    $relationId = \App\Relation::getRelationId($this->moduleName, $this->sourceModule, $this->sourceField);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.php by phpmd

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

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

        Avoid using static access to class '\App\ModuleHierarchy' in method 'setRelatedParent'.
        Open

                        if (\in_array($this->moduleName, \App\ModuleHierarchy::getChildModules($processModule)) && \in_array($processModule, \App\ModuleHierarchy::getModulesMap1M($this->moduleName))) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 (!$request->isEmpty('src_record', true) && !\in_array($request->getByType('src_module', 2), ['Users', 'WebserviceUsers']) && !\App\Privilege::isPermitted($request->getByType('src_module', 2), 'DetailView', $request->getInteger('src_record'))) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 initializeContent uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $listViewHeaders = $this->recordListModel->getListViewHeaders();
                    $listViewEntries = $this->recordListModel->getListViewEntries($pagingModel);
                }
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'initializeContent'.
        Open

                if (App\Config::performance('LISTVIEW_COMPUTE_PAGE_COUNT') || ($request->getBoolean('showTotalCount') && !$totalCount)) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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\Relation' in method 'setRelatedParent'.
        Open

                    $relationId = \App\Relation::getRelationId($this->moduleName, $this->sourceModule, $this->sourceField);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 assigning values to variables in if clauses and the like (line '288', column '61').
        Open

            public function setRelatedParent(App\Request $request)
            {
                $filterFields = $request->getArray('filterFields', 'Text');
                if (!($relationId = $request->isEmpty('relationId') ? 0 : $request->getInteger('relationId')) && $this->sourceField) {
                    $relationId = \App\Relation::getRelationId($this->moduleName, $this->sourceModule, $this->sourceField);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.php by phpmd

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

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

        Avoid using static access to class '\App\Record' in method 'setRelatedParent'.
        Open

                        $processModule = \App\Record::getType($processRecord);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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_Module_Model' in method 'initializeContent'.
        Open

                $moduleModel = Vtiger_Module_Model::getInstance($this->moduleName);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'CRMEntity' in method 'initializeContent'.
        Open

                    $moduleInstance = CRMEntity::getInstance($this->moduleName);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'initializeContent'.
        Open

                    $searchValue = App\Condition::validSearchValue($request->getByType('search_value', 'Text'), $this->recordListModel->getQueryGenerator()->getModule(), $searchKey, $operator);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'initializeContent'.
        Open

                $searchParams = App\Condition::validSearchParams($this->recordListModel->getQueryGenerator()->getModule(), $request->getArray('search_params'));
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'setRecordListModel'.
        Open

                    $this->recordListModel = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $this->moduleName, $this->parentRelationId, $cvId);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 'setRelatedParent'.
        Open

                        if ($relatedParentIdTemp && ($relatedParentModuleTemp = \App\Record::getType($relatedParentIdTemp)) === \App\Module::getModuleName($hierarchy['rel_tabid'])) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class '\App\Record' in method 'setRelatedParent'.
        Open

                            $linkModule = \App\Record::getType($linkRecord);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class '\App\Record' in method 'setRelatedParent'.
        Open

                    $linkModule = \App\Record::getType($linkRecord);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.php by phpmd

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class '\App\Record' in method 'setRecordListModel'.
        Open

                if ($this->relatedParentId && !\App\Record::isExists($this->relatedParentId)) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 "ERR_NO_PERMISSIONS_FOR_THE_RECORD" 3 times.
        Open

                        throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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 "src_module" 7 times.
        Open

                if (!$request->isEmpty('src_module') && (!\App\Security\AdminAccess::isPermitted($request->getByType('src_module', 2)) && !$currentUserPrivilegesModel->hasModulePermission($request->getByType('src_module', 2)))) {
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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 "filterFields" 3 times.
        Open

                $filterFields = $request->getArray('filterFields', 'Text');
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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')) {
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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" 3 times.
        Open

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

                if (!$request->isEmpty('related_parent_module') && !$currentUserPrivilegesModel->hasModulePermission($request->getByType('related_parent_module', 2))) {
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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 "related_parent_id" 5 times.
        Open

                if (!$request->isEmpty('related_parent_id', true)) {
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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($this->recordListModel->getQueryGenerator()->getModule(), $request->getArray('search_params'));
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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) && !$request->isEmpty('search_value', true)) {
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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_value" 3 times.
        Open

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

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

                $this->sourceField = $request->isEmpty('src_field', true) ? '' : $request->getByType('src_field', 2);
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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 "currency_id" 3 times.
        Open

                $currencyId = $request->isEmpty('currency_id', true) ? '' : $request->getInteger('currency_id');
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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 "src_record" 5 times.
        Open

                if (!$request->isEmpty('src_record', true) && !\in_array($request->getByType('src_module', 2), ['Users', 'WebserviceUsers']) && !\App\Privilege::isPermitted($request->getByType('src_module', 2), 'DetailView', $request->getInteger('src_record'))) {
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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 "process" 3 times.
        Open

                } elseif (!$request->isEmpty('process', true) || !$request->isEmpty('link', true)) {
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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_RecordsList_View::checkAndConvertJsScripts
        Open

                return array_merge(parent::getModalScripts($request), $this->checkAndConvertJsScripts([
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.php by phan

        Assigning '' to property but \Vtiger_RecordsList_View->relatedParentId is int
        Open

                    $this->relatedParentId = $this->relatedParentModule = '';
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.php by phan

        Reference to undeclared class \App\Controller\Modal
        Open

                return array_merge(parent::getModalScripts($request), $this->checkAndConvertJsScripts([
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.php by phan

        Call to undeclared method \Vtiger_RecordsList_View::getViewer
        Open

                $viewer = $this->getViewer($request);
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.php by phan

        Call to undeclared method \Vtiger_RecordsList_View::getViewer
        Open

                    $viewer = $this->getViewer($request);
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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/RecordsList.php by phan

        Class extends undeclared class \App\Controller\Modal
        Open

        class Vtiger_RecordsList_View extends \App\Controller\Modal
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.php by phan

        Reference to undeclared property \Vtiger_RecordsList_View->modalIcon
        Open

                $this->modalIcon = "modCT_{$this->moduleName} yfm-{$this->moduleName}";
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.php by phan

        Reference to undeclared class \App\Controller\Modal
        Open

                parent::preProcessAjax($request);
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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/RecordsList.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/RecordsList.php by phan

        Call to undeclared method \Vtiger_RecordsList_View::getViewer
        Open

                $viewer = $this->getViewer($request);
        Severity: Critical
        Found in modules/Vtiger/views/RecordsList.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/RecordsList.php by phan

        Identical blocks of code found in 2 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/RecordsList.php and 1 other location - About 1 hr to fix
        modules/Vtiger/views/List.php on lines 252..260

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

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

                $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 = $this->recordListModel->getQueryGenerator()->parseBaseSearchParamsToCondition($searchParams);
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 $relatedParentModuleTemp. Keep variable name length under 20.
        Open

                        if ($relatedParentIdTemp && ($relatedParentModuleTemp = \App\Record::getType($relatedParentIdTemp)) === \App\Module::getModuleName($hierarchy['rel_tabid'])) {
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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 $currentUserPrivilegesModel. Keep variable name length under 20.
        Open

                $currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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_RecordsList_View extends \App\Controller\Modal

        The class Vtiger_RecordsList_View is not named in CamelCase.
        Open

        class Vtiger_RecordsList_View extends \App\Controller\Modal
        {
            /** {@inheritdoc} */
            public $modalSize = 'modal-fullscreen';
        
        
        Severity: Minor
        Found in modules/Vtiger/views/RecordsList.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->isEmpty('src_record', true) && !\in_array($request->getByType('src_module', 2), ['Users', 'WebserviceUsers']) && !\App\Privilege::isPermitted($request->getByType('src_module', 2), 'DetailView', $request->getInteger('src_record'))) {

        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

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

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

                    if (!\App\Privilege::isPermitted($this->relatedParentModule, 'DetailView', $this->relatedParentId)) {

        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

            public $recordListModel;

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

             */

        Line exceeds 120 characters; contains 125 characters
        Open

                    $this->relatedParentId = $request->isEmpty('related_parent_id') ? '' : $request->getInteger('related_parent_id');

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

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

                }

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

                    $this->recordListModel->set('filterFields', $filterFields);

        Line exceeds 120 characters; contains 152 characters
        Open

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

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

                if (empty($searchParams)) {

        Line exceeds 120 characters; contains 128 characters
        Open

                $transformedSearchParams = $this->recordListModel->getQueryGenerator()->parseBaseSearchParamsToCondition($searchParams);

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

                $this->recordListModel->loadSearchLockedFields($request);

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

                if (!$request->isEmpty('src_module') && (!\App\Security\AdminAccess::isPermitted($request->getByType('src_module', 2)) && !$currentUserPrivilegesModel->hasModulePermission($request->getByType('src_module', 2)))) {

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

                }

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

                return array_merge(parent::getModalScripts($request), $this->checkAndConvertJsScripts([

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

            /** @var int Related parent ID */

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

             *

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

                }

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

                $recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);

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

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

        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

                    }

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

            }

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

            /** @var bool Show switch */

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

            /** @var string Source module field name */

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

            public $parentRelationId;

        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

             *

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

                if (!isset($this->relatedParentModule)) {

        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

                if (!empty($this->sourceModule)) {

        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('MODULE', $this->moduleName);

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

                $viewer->assign('FILTER_FIELDS', $filterFields);

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

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

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

             */

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

                        $linkModule = \App\Record::getType($linkRecord);

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

                        $this->relatedParentModule = $linkModule;

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

            /** {@inheritdoc} */

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

                }

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

            protected function preProcessTplName(App\Request $request)

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

                return 'Modals/RecordsListHeader.tpl';

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

                    $viewer->assign('MODAL_PARAMS', $request->getArray('modal_params'));

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

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

            /** @var string Switch label */

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

                $multiSelectMode = $request->has('multi_select') ? $request->getBoolean('multi_select') : false;

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

                $moduleModel = Vtiger_Module_Model::getInstance($this->moduleName);

        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

                    }

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

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

        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

                    $this->recordListModel->set('currency_id', $currencyId);

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

                $viewer->assign('RELATED_PARENT_MODULE', $this->relatedParentModule);

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

                $viewer->assign('RELATED_PARENT_ID', $this->relatedParentId);

        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

                $this->parentRelationId = 0;

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

                            $relatedParentIdTemp = $srcRecordModel->get($relField);

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

                            $this->relatedParentModule = $relatedParentModuleTemp;

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

                            if (\in_array($linkModule, \App\ModuleHierarchy::getModulesMap1M($this->moduleName))) {

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

            /** {@inheritdoc} */

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

                    $this->relatedParentId = $request->getInteger('related_parent_id');

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

                }

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

            }

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

            public $sourceField;

        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

                    $this->recordListModel->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

                    $searchParamsRaw = $searchParams = [];

        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

                $viewer->assign('SOURCE_MODULE', $this->sourceModule);

        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

                    $relatedParentIdTemp = 0;

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

                        if (!empty($filterFields[$relField])) {

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

                            $srcRecordModel = Vtiger_Record_Model::getInstanceById($this->sourceRecord, $this->sourceModule);

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

                        }

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

                } elseif (!empty($filterFields['parent_id']) && 0 !== $this->relatedParentId) {

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

            public $modalSize = 'modal-fullscreen';

        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

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

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

                if (!empty($filterFields)) {

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

                if (!empty($totalCount)) {

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

                    $parentRecordModel = Vtiger_Record_Model::getInstanceById($this->relatedParentId, $this->relatedParentModule);

        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

                $filterFields = $request->getArray('filterFields', 'Text');

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

                } elseif (!$request->isEmpty('process', true) || !$request->isEmpty('link', true)) {

        Line exceeds 120 characters; contains 142 characters
        Open

                    if (!$request->isEmpty('process', true) && \in_array($this->moduleName, array_keys(\App\ModuleHierarchy::getModulesByLevel(2)))) {

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

                        $processRecord = $request->getInteger('process');

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

                            $linkRecord = $request->getInteger('link');

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

                    } elseif (!$request->isEmpty('link', true)) {

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

                    if (\in_array($linkModule, \App\ModuleHierarchy::getModulesMap1M($this->moduleName))) {

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

        Line exceeds 120 characters; contains 255 characters
        Open

                if (!$request->isEmpty('src_record', true) && !\in_array($request->getByType('src_module', 2), ['Users', 'WebserviceUsers']) && !\App\Privilege::isPermitted($request->getByType('src_module', 2), 'DetailView', $request->getInteger('src_record'))) {

        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

                parent::preProcessAjax($request);

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

                    'modules.Vtiger.resources.ListSearch',

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

            public $relatedParentId;

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

                $this->sourceRecord = $request->isEmpty('src_record', true) ? 0 : $request->getInteger('src_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

                if (!empty($this->relatedParentModule) && !empty($this->relatedParentId)) {

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

                if (App\Config::performance('LISTVIEW_COMPUTE_PAGE_COUNT') || ($request->getBoolean('showTotalCount') && !$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

                    $relationId = \App\Relation::getRelationId($this->moduleName, $this->sourceModule, $this->sourceField);

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

                            break;

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

                    if (!$request->isEmpty('process', true) && \in_array($this->moduleName, array_keys(\App\ModuleHierarchy::getModulesByLevel(2)))) {

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

                            }

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

                        $this->relatedParentId = $linkRecord;

        Line exceeds 120 characters; contains 221 characters
        Open

                if (!$request->isEmpty('src_module') && (!\App\Security\AdminAccess::isPermitted($request->getByType('src_module', 2)) && !$currentUserPrivilegesModel->hasModulePermission($request->getByType('src_module', 2)))) {

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

                    }

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

            /** {@inheritdoc} */

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

        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

                }

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

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

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

                    $listViewEntries = $this->recordListModel->getEntries($pagingModel);

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

                        ->assign('SWITCH_ON_TEXT', $this->switchLabel ? \App\Language::translate($this->switchLabel, $this->moduleName) : \App\Language::translateSingularModuleName($this->relatedParentModule));

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

                }

        Line exceeds 120 characters; contains 124 characters
        Open

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

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

             *

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

                }

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

                    $this->recordListModel = Vtiger_ListView_Model::getInstanceForPopup($this->moduleName, $this->sourceModule, $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

                        if (\in_array($linkModule, \App\ModuleHierarchy::getModulesMap1M($this->moduleName))) {

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

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

                $this->sourceModule = $request->getByType('src_module', 2);

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

                $currencyId = $request->isEmpty('currency_id', true) ? '' : $request->getInteger('currency_id');

        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->isEmpty('search_key', true) && !$request->isEmpty('search_value', true)) {

        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

                if ($currencyId) {

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

                $viewer->assign('LISTVIEW_ENTRIES_COUNT', \count($listViewEntries));

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

                $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());

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

                $viewer->assign('CV_ID', $cvId);

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

                if ($this->relatedParentId && !\App\Record::isExists($this->relatedParentId)) {

        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

             * Set relation parent.

        Line exceeds 120 characters; contains 143 characters
        Open

                if ($relationId && !$request->has('related_parent_id') && $hierarchyData = \App\ModuleHierarchy::getHierarchyByRelation($relationId)) {

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

                        }

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

                        }

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

                            $this->relatedParentModule = $linkModule;

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

                        }

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

            {

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

                $this->modalIcon = "modCT_{$this->moduleName} yfm-{$this->moduleName}";

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

                    $viewer->assign('VIEWNAME', 'recordsList');

        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

            /** {@inheritdoc} */

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

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

                    $this->relatedParentModule = $request->isEmpty('related_parent_module', true) ? '' : $request->getByType('related_parent_module', 2);

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

                if (!isset($this->relatedParentId)) {

        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

                    $this->recordListModel->set('orderby', $orderBy);

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

                    $this->recordListModel->set('search_key', $searchKey);

        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

                    $listViewHeaders = $this->recordListModel->getHeaders();

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

                    $listViewHeaders = $this->recordListModel->getListViewHeaders();

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

                    } elseif (method_exists($this->recordListModel, 'getRelatedEntriesCount')) {

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

                        $totalCount = $this->recordListModel->getRelatedEntriesCount();

        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('totalCount', (int) $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('SWITCH', true)

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

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

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

                $viewer->assign('RELATED_MODULE', $this->moduleName);

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

                $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);

        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

                if (!($relationId = $request->isEmpty('relationId') ? 0 : $request->getInteger('relationId')) && $this->sourceField) {

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

                                $this->relatedParentModule = $linkModule;

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

                    $linkRecord = (int) $filterFields['parent_id'];

        Line exceeds 120 characters; contains 206 characters
        Open

                    $this->relatedParentModule = $request->isEmpty('related_parent_module', true) ? \App\Record::getType($this->relatedParentId) : $request->getByType('related_parent_module', \App\Purifier::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

            /** {@inheritdoc} */

        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

                    "modules.{$request->getModule()}.resources.ListSearch",

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

            public $switchLabel;

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

            /** @var string Module 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

            public function initializeContent(App\Request $request)

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

                $this->sourceField = $request->isEmpty('src_field', true) ? '' : $request->getByType('src_field', 2);

        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 = new Vtiger_Paging_Model();

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

                }

        Line exceeds 120 characters; contains 153 characters
        Open

                    $this->recordListModel->set('src_module', $this->sourceModule)->set('src_field', $this->sourceField)->set('src_record', $this->sourceRecord);

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

                        $fieldSearchInfo['specialOption'] = \in_array($fieldSearchInfo[1], ['ch', 'kh']) ? true : '';

        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

                } else {

        Line exceeds 120 characters; contains 129 characters
        Open

                if (App\Config::performance('LISTVIEW_COMPUTE_PAGE_COUNT') || ($request->getBoolean('showTotalCount') && !$totalCount)) {

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

                $viewer->assign('MODULE_MODEL', Vtiger_Module_Model::getInstance($this->moduleName));

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

                $viewer->assign('CURRENCY_ID', $currencyId);

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

                $viewer->assign('LISTVIEW_ENTRIES', $listViewEntries);

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

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

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

                $viewer->assign('CUSTOM_VIEWS', CustomView_Record_Model::getAllByGroup($request->getModule()));

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

                    $this->relatedParentId = $this->relatedParentModule = '';

        Line exceeds 120 characters; contains 122 characters
        Open

                    $parentRecordModel = Vtiger_Record_Model::getInstanceById($this->relatedParentId, $this->relatedParentModule);

        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

                    foreach ($hierarchyData as $hierarchy) {

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

                        $relField = $hierarchy['rel_field_name'];

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

                        if ($relatedParentIdTemp && ($relatedParentModuleTemp = \App\Record::getType($relatedParentIdTemp)) === \App\Module::getModuleName($hierarchy['rel_tabid'])) {

        Line exceeds 120 characters; contains 174 characters
        Open

                        if ($relatedParentIdTemp && ($relatedParentModuleTemp = \App\Record::getType($relatedParentIdTemp)) === \App\Module::getModuleName($hierarchy['rel_tabid'])) {

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

                            $this->relatedParentId = $relatedParentIdTemp;

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

                    }

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

                        $processModule = \App\Record::getType($processRecord);

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

                            $this->relatedParentModule = $processModule;

        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->view('Pagination.tpl', $request->getModule());

        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

            /** @var string Source module name */

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

            /** @var int Parent relation ID */

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

            /** @var mixed Record list model */

        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

            {

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

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

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

                $this->setRelatedParent($request);

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

                    $this->recordListModel->set('src_module', $this->sourceModule)->set('src_field', $this->sourceField)->set('src_record', $this->sourceRecord);

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

                $transformedSearchParams = $this->recordListModel->getQueryGenerator()->parseBaseSearchParamsToCondition($searchParams);

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

                    $listViewEntries = $this->recordListModel->getListViewEntries($pagingModel);

        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

                $viewer->assign('RECORD_SELECTED', $request->getBoolean('record_selected', false));

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

                    if (!$parentRecordModel->isViewable()) {

        Line exceeds 120 characters; contains 151 characters
        Open

                    $this->recordListModel = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $this->moduleName, $this->parentRelationId, $cvId);

        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

                            $relatedParentIdTemp = $filterFields[$relField];

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

                        } elseif (!isset($filterFields[$relField]) && $this->sourceRecord) {

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

                            if (!$this->switchLabel && $hierarchy['label']) {

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

                        if (\in_array($this->moduleName, \App\ModuleHierarchy::getChildModules($processModule)) && \in_array($processModule, \App\ModuleHierarchy::getModulesMap1M($this->moduleName))) {

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

                                $this->relatedParentId = $linkRecord;

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

        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

                $viewer->assign('ONLY_BODY', $request->getBoolean('onlyBody'));

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

            /** @var int Source record ID */

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

            /** @var string Related parent module name */

        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

                    $this->recordListModel->set('operator', $operator);

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

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

        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

                        $totalCount = $this->recordListModel->getListViewCount();

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

                $viewer->assign('LISTVIEW_HEADERS', $listViewHeaders);

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

            /**

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

                }

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

                            $this->parentRelationId = $hierarchy['dest_relationid'];

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

                }

        Line exceeds 120 characters; contains 160 characters
        Open

                if (!$request->isEmpty('related_parent_module') && !$currentUserPrivilegesModel->hasModulePermission($request->getByType('related_parent_module', 2))) {

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

                if ('getPagination' === $request->getMode()) {

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

             * Function to initialize the required data to display the record list view contents.

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

             * @throws \App\Exceptions\IllegalValue

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

                    $this->relatedParentId = $request->isEmpty('related_parent_id') ? '' : $request->getInteger('related_parent_id');

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

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

        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

                }

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

                }

        Line exceeds 120 characters; contains 202 characters
        Open

                        ->assign('SWITCH_ON_TEXT', $this->switchLabel ? \App\Language::translate($this->switchLabel, $this->moduleName) : \App\Language::translateSingularModuleName($this->relatedParentModule));

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

                $viewer->assign('MULTI_SELECT', $multiSelectMode);

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

             * Set record list model.

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

            public function setRecordListModel(App\Request $request)

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

                if (!empty($this->relatedParentModule) && !empty($this->relatedParentId)) {

        Line exceeds 120 characters; contains 193 characters
        Open

                        if (\in_array($this->moduleName, \App\ModuleHierarchy::getChildModules($processModule)) && \in_array($processModule, \App\ModuleHierarchy::getModulesMap1M($this->moduleName))) {

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

                        } elseif (!$request->isEmpty('link', true)) {

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

                if (!$request->isEmpty('related_parent_module') && !$currentUserPrivilegesModel->hasModulePermission($request->getByType('related_parent_module', 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

                    $this->relatedParentModule = $request->isEmpty('related_parent_module', true) ? \App\Record::getType($this->relatedParentId) : $request->getByType('related_parent_module', \App\Purifier::ALNUM);

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

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

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

            /** {@inheritdoc} */

        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 $showSwitch = false;

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

            public $sourceModule;

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

                    $moduleInstance = CRMEntity::getInstance($this->moduleName);

        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

                        }

        Line exceeds 120 characters; contains 185 characters
        Open

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

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

                $searchParams = App\Condition::validSearchParams($this->recordListModel->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

                $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('MODULE_NAME', $this->moduleName);

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

                $viewer->assign('SOURCE_FIELD', $this->sourceField);

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

                $viewer->assign('ADDITIONAL_INFORMATIONS', $request->getBoolean('additionalInformations'));

        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

                    $this->recordListModel = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $this->moduleName, $this->parentRelationId, $cvId);

        Line exceeds 120 characters; contains 126 characters
        Open

                if (!($relationId = $request->isEmpty('relationId') ? 0 : $request->getInteger('relationId')) && $this->sourceField) {

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

                        $linkRecord = $request->getInteger('link');

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

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

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

                $this->moduleName = $request->getModule();

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

            /** {@inheritdoc} */

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

                    $viewer->view('Modals/RecordsList.tpl', $request->getModule());

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

            public function postProcessAjax(App\Request $request)

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

            public function getModalScripts(App\Request $request)

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

                $this->moduleName = $request->getModule();

        Line exceeds 120 characters; contains 145 characters
        Open

                    $this->relatedParentModule = $request->isEmpty('related_parent_module', true) ? '' : $request->getByType('related_parent_module', 2);

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

                $filterFields = $request->getArray('filterFields', 'Text');

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

                $cvId = $request->getInteger('cvId');

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

                if (!$request->isEmpty('noOfEntries', 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

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

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

                    $viewer->assign('SEARCH_KEY', $searchKey);

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

                $this->recordListModel->set('search_params', $transformedSearchParams);

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

                if ($this->showSwitch) {

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

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

        Line exceeds 120 characters; contains 127 characters
        Open

                    $this->recordListModel = Vtiger_ListView_Model::getInstanceForPopup($this->moduleName, $this->sourceModule, $cvId);

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

                            $this->relatedParentId = $processRecord;

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

                            $linkModule = \App\Record::getType($linkRecord);

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

                    if (method_exists($this->recordListModel, 'getListViewCount')) {

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

                $viewer->assign('SOURCE_RECORD', $this->sourceRecord);

        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_FIELDS', $request->isEmpty('lockedFields', true) ? [] : $request->getArray('lockedFields'));

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

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

                if ($relationId && !$request->has('related_parent_id') && $hierarchyData = \App\ModuleHierarchy::getHierarchyByRelation($relationId)) {

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

                            }

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

                    $linkModule = \App\Record::getType($linkRecord);

        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

                    $this->showSwitch = !$request->has('showSwitch') || $request->getBoolean('showSwitch');

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

            }

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

                                $this->switchLabel = $hierarchy['label'];

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

                            $this->relatedParentId = $linkRecord;

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

        class Vtiger_RecordsList_View extends \App\Controller\Modal

        There are no issues that match your filters.

        Category
        Status