YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/models/RelationListView.php

Summary

Maintainability
F
5 days
Test Coverage
F
34%

File RelationListView.php has 543 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

 /* +***********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
Severity: Major
Found in modules/Vtiger/models/RelationListView.php - About 1 day to fix

    Vtiger_RelationListView_Model has 33 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Vtiger_RelationListView_Model extends \App\Base
    {
        /**
         * Relation model instance.
         *
    Severity: Minor
    Found in modules/Vtiger/models/RelationListView.php - About 4 hrs to fix

      Function getHeaders has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getHeaders()
          {
              $fields = [];
              if ($this->get('viewId')) {
                  $moduleModel = $this->getRelationModel()->getRelationModuleModel();
      Severity: Minor
      Found in modules/Vtiger/models/RelationListView.php - About 3 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

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

      class Vtiger_RelationListView_Model extends \App\Base
      {
          /**
           * Relation model instance.
           *

      Method getLinks has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getLinks(): array
          {
              $parentRecordModel = $this->getParentRecordModel();
              $relationModelInstance = $this->getRelationModel();
              $relatedModuleModel = $relationModelInstance->getRelationModuleModel();
      Severity: Major
      Found in modules/Vtiger/models/RelationListView.php - About 3 hrs to fix

        Function loadSearchLockedFields has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public function loadSearchLockedFields(App\Request $request): void
            {
                $moduleModel = $this->getRelationModel()->getRelationModuleModel();
                if (!$request->isEmpty('lockedFields')) {
                    foreach ($request->getArray('lockedFields') as $value) {
        Severity: Minor
        Found in modules/Vtiger/models/RelationListView.php - About 2 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            public function getLinks(): array
            {
                $parentRecordModel = $this->getParentRecordModel();
                $relationModelInstance = $this->getRelationModel();
                $relatedModuleModel = $relationModelInstance->getRelationModuleModel();
        Severity: Minor
        Found in modules/Vtiger/models/RelationListView.php - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            public function getRecordsFromArray(array $rows)
            {
                $listViewRecordModels = $relatedFields = [];
                $moduleModel = $this->getRelationModel()->getRelationModuleModel();
                $recordId = $this->getParentRecordModel()->getId();
        Severity: Minor
        Found in modules/Vtiger/models/RelationListView.php - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            public function getHeaders()
            {
                $fields = [];
                if ($this->get('viewId')) {
                    $moduleModel = $this->getRelationModel()->getRelationModuleModel();
        Severity: Minor
        Found in modules/Vtiger/models/RelationListView.php - About 1 hr to fix

          Method getTreeEntries has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getTreeEntries()
              {
                  $relModuleName = $this->getRelatedModuleModel()->getName();
                  $relationModelInstance = $this->getRelationModel();
                  $template = $this->getTreeViewModel()->getTemplate();
          Severity: Minor
          Found in modules/Vtiger/models/RelationListView.php - About 1 hr to fix

            Method getAddRelationLinks has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getAddRelationLinks(): array
                {
                    $relationModelInstance = $this->getRelationModel();
                    if (!$relationModelInstance->isAddActionSupported() || $this->getParentRecordModel()->isReadOnly()) {
                        return [];
            Severity: Minor
            Found in modules/Vtiger/models/RelationListView.php - About 1 hr to fix

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

                  public function getRecordsFromArray(array $rows)
                  {
                      $listViewRecordModels = $relatedFields = [];
                      $moduleModel = $this->getRelationModel()->getRelationModuleModel();
                      $recordId = $this->getParentRecordModel()->getId();
              Severity: Minor
              Found in modules/Vtiger/models/RelationListView.php - About 1 hr to fix

                Function getWidgets has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getWidgets(int $recordId): array
                    {
                        $widgets = [];
                        $moduleModel = $this->getRelatedModuleModel();
                        foreach ($this->getWidgetsList() as $widgetCol) {
                Severity: Minor
                Found in modules/Vtiger/models/RelationListView.php - About 1 hr to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function getRelationQuery has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getRelationQuery($returnQueryGenerator = false)
                    {
                        if ($this->has('Query')) {
                            return $this->get('Query');
                        }
                Severity: Minor
                Found in modules/Vtiger/models/RelationListView.php - About 1 hr to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function getTreeEntries has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getTreeEntries()
                    {
                        $relModuleName = $this->getRelatedModuleModel()->getName();
                        $relationModelInstance = $this->getRelationModel();
                        $template = $this->getTreeViewModel()->getTemplate();
                Severity: Minor
                Found in modules/Vtiger/models/RelationListView.php - About 55 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 loadOrderBy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function loadOrderBy()
                    {
                        $orderBy = $this->get('orderby');
                        if (!empty($orderBy) && \is_array($orderBy)) {
                            foreach ($orderBy as $fieldName => $sortFlag) {
                Severity: Minor
                Found in modules/Vtiger/models/RelationListView.php - About 55 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 getCreateViewUrl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getCreateViewUrl(bool $fullView = false)
                    {
                        $createViewUrl = $this->getRelationModel()->getCreateViewUrl($fullView);
                        if (!empty(Config\Relation::$addSearchParamsToCreateView) && ($searchParams = $this->getArray('search_params')) && isset($searchParams['and']) && \is_array($searchParams['and'])) {
                            foreach ($searchParams['and'] as $row) {
                Severity: Minor
                Found in modules/Vtiger/models/RelationListView.php - About 35 mins to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function loadCondition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function loadCondition()
                    {
                        $relatedModuleName = $this->getRelatedModuleModel()->getName();
                        $queryGenerator = $this->getRelationModel()->getQueryGenerator();
                        if ($entityState = $this->get('entityState')) {
                Severity: Minor
                Found in modules/Vtiger/models/RelationListView.php - About 25 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 getHeaders() has an NPath complexity of 720. The configured NPath complexity threshold is 200.
                Open

                    public function getHeaders()
                    {
                        $fields = [];
                        if ($this->get('viewId')) {
                            $moduleModel = $this->getRelationModel()->getRelationModuleModel();

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

                    public function loadSearchLockedFields(App\Request $request): void
                    {
                        $moduleModel = $this->getRelationModel()->getRelationModuleModel();
                        if (!$request->isEmpty('lockedFields')) {
                            foreach ($request->getArray('lockedFields') as $value) {

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

                    public function getHeaders()
                    {
                        $fields = [];
                        if ($this->get('viewId')) {
                            $moduleModel = $this->getRelationModel()->getRelationModuleModel();

                CyclomaticComplexity

                Since: 0.1

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

                Example

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

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

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

                    public function getHeaders()

                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

                Class "Vtiger_RelationListView_Model" has 33 methods, which is greater than 20 authorized. Split it into smaller classes.
                Open

                class Vtiger_RelationListView_Model extends \App\Base

                A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

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

                    public function loadSearchLockedFields(App\Request $request): void

                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_RelationListView_Model has a coupling between objects value of 26. Consider to reduce the number of dependencies under 13.
                Open

                class Vtiger_RelationListView_Model extends \App\Base
                {
                    /**
                     * Relation model instance.
                     *

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

                        return (new App\Db\Query())->select(['relcrmid'])->from('u_#__favorites')

                MissingImport

                Since: 2.7.0

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

                Example

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

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

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

                    public static function getInstance(Vtiger_Record_Model $parentRecordModel, string $relationModuleName, $relationId = false, $cvId = 0)

                BooleanArgumentFlag

                Since: 1.4.0

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

                Example

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

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

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

                    public function getCreateViewUrl(bool $fullView = false)

                BooleanArgumentFlag

                Since: 1.4.0

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

                Example

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

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

                Missing class import via use statement (line '198', column '13').
                Open

                        throw new \App\Exceptions\AppException('>>> No relationModel instance, requires verification 2 <<<');

                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 '157', column '25').
                Open

                        $queryGenerator = new \App\QueryGenerator($relationModelInstance->getRelationModuleModel()->getName());

                MissingImport

                Since: 2.7.0

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

                Example

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

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

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

                    public function getRelationQuery($returnQueryGenerator = false)

                BooleanArgumentFlag

                Since: 1.4.0

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

                Example

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

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

                Missing class import via use statement (line '733', column '17').
                Open

                        $query = (new App\Db\Query())->from('a_#__relatedlists_widgets')->where(['relation_id' => $relationId]);

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

                        return (new \App\Db\Query())->from('vtiger_trees_templates_data ttd')->innerJoin('u_#__crmentity_rel_tree rel', 'rel.tree = ttd.tree')

                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 '586', column '23').
                Open

                        $eventHandler = new App\EventHandler();

                MissingImport

                Since: 2.7.0

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

                Example

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

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

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

                        } else {
                            $relationModelInstance = Vtiger_Relation_Model::getInstance($parentModuleModel, Vtiger_Module_Model::getInstance($relationModuleName), $relationId);
                        }

                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_Relation_Model' in method 'getInstance'.
                Open

                            $relationModelInstance = Vtiger_Relation_Model::getInstance($parentModuleModel, Vtiger_Module_Model::getInstance($relationModuleName), $relationId);

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

                    public function loadCondition()
                    {
                        $relatedModuleName = $this->getRelatedModuleModel()->getName();
                        $queryGenerator = $this->getRelationModel()->getQueryGenerator();
                        if ($entityState = $this->get('entityState')) {

                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\Language' in method 'getTreeEntries'.
                Open

                                $parentName = '(' . App\Language::translate($treeDetail['name'], $relModuleName) . ') ';

                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_Link_Model' in method 'getLinks'.
                Open

                                $relatedLink['RELATEDLIST_MASSACTIONS'][] = Vtiger_Link_Model::getInstanceFromValues([
                                    'linktype' => 'RELATEDLIST_MASSACTIONS',
                                    'linklabel' => 'LBL_MASS_SEND_SMS',
                                    'linkdata' => ['url' => $smsNotifierModel->getMassSMSUrlForModule($relatedModuleModel->getName()), 'type' => 'modal'],
                                    'linkicon' => 'fas fa-comment-sms',

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

                                'linklabel' => \App\Language::translate('LBL_SELECT_RELATION', $relatedModel->getName()),

                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\User' in method 'getFavoriteRecords'.
                Open

                                'userid' => App\User::getCurrentUserId(),

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

                            $relationModelInstance = Vtiger_Relation_Model::getInstance($parentModuleModel, Vtiger_Module_Model::getInstance($relationModuleName), $relationId);

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

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

                                $fieldModel = Vtiger_Field_Model::getInstance($fieldName, Vtiger_Module_Model::getInstance($fieldInfo['module_name']));

                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\Cache' in method 'getWidgetsList'.
                Open

                        if (\App\Cache::has('RelatedModuleWidgets', $relationId)) {

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

                    public function loadCondition()
                    {
                        $relatedModuleName = $this->getRelatedModuleModel()->getName();
                        $queryGenerator = $this->getRelationModel()->getQueryGenerator();
                        if ($entityState = $this->get('entityState')) {

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

                        } else {
                            $pagingModel->set('nextPageExists', false);
                        }

                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 assigning values to variables in if clauses and the like (line '383', column '7').
                Open

                    public function getHeaders()
                    {
                        $fields = [];
                        if ($this->get('viewId')) {
                            $moduleModel = $this->getRelationModel()->getRelationModuleModel();

                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\Log' in method 'getHeaders'.
                Open

                                    \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

                Avoid using static access to class 'Vtiger_TreeCategoryModal_Model' in method 'getTreeViewModel'.
                Open

                        return Vtiger_TreeCategoryModal_Model::getInstance($this->getRelatedModuleModel());

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

                        } else {
                            $cvId = array_key_first($this->getRelationModel()->getCustomViewList());
                        }

                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\Language' in method 'getLinks'.
                Open

                                        'linkhint' => \App\Language::translate('LBL_EXPORT_PDF'),

                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 '499', column '65').
                Open

                    public function getCreateViewUrl(bool $fullView = false)
                    {
                        $createViewUrl = $this->getRelationModel()->getCreateViewUrl($fullView);
                        if (!empty(Config\Relation::$addSearchParamsToCreateView) && ($searchParams = $this->getArray('search_params')) && isset($searchParams['and']) && \is_array($searchParams['and'])) {
                            foreach ($searchParams['and'] as $row) {

                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 '\Vtiger_Module_Model' in method 'getLinks'.
                Open

                            if ($relatedModuleModel->isPermitted('MassSendSMS') && ($smsNotifierModel = \Vtiger_Module_Model::getInstance('SMSNotifier'))->isSMSActiveForModule($relatedModuleModel->getName())) {

                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_Link_Model' in method 'getLinks'.
                Open

                                    $relatedLink['RELATEDLIST_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([
                                        'linktype' => 'RELATEDLIST_BASIC',
                                        'linkdata' => [
                                            'type' => 'modal',
                                            'url' => "index.php?module={$parentRecordModel->getModuleName()}&view=PDF&fromview=RelatedList",

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

                                    'linklabel' => App\Language::translate('LBL_ADD_RELATION', $relatedModel->getName()),

                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_Relation_Model' in method 'getInstance'.
                Open

                            $relationModelInstance = Vtiger_Relation_Model::getInstanceById($relationId);

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

                                'name' => $parentName . App\Language::translate($row['name'], $relModuleName),

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

                Avoid using static access to class 'App\Fields\DateTime' in method 'getTreeEntries'.
                Open

                                $tree['rel_created_time'] = App\Fields\DateTime::formatToDisplay($row['rel_created_time']);

                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 '551', column '60').
                Open

                    public function getLinks(): array
                    {
                        $parentRecordModel = $this->getParentRecordModel();
                        $relationModelInstance = $this->getRelationModel();
                        $relatedModuleModel = $relationModelInstance->getRelationModuleModel();

                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\Language' in method 'getAddRelationLinks'.
                Open

                                'linklabel' => App\Language::translate('LBL_MASS_ADD', 'Documents'),

                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_Loader' in method 'getWidgets'.
                Open

                                $widgetName = Vtiger_Loader::getComponentClassName('Widget', $widget['type'], $moduleModel->getName());

                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\Cache' in method 'getWidgetsList'.
                Open

                        App\Cache::save('RelatedModuleWidgets', $relationId, $widgets);

                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\CustomView' in method 'getHeaders'.
                Open

                            $customView = App\CustomView::getInstance($moduleModel->getName());

                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_Link_Model' in method 'getLinks'.
                Open

                                $relatedLink['RELATEDLIST_MASSACTIONS'][] = Vtiger_Link_Model::getInstanceFromValues([
                                    'linktype' => 'RELATEDLIST_MASSACTIONS',
                                    'linklabel' => 'LBL_MASS_DOWNLOAD',
                                    'linkurl' => "javascript:Vtiger_RelatedList_Js.triggerMassDownload('index.php?module={$parentRecordModel->getModuleName()}&action=RelationAjax&mode=massDownload&src_record={$parentRecordModel->getId()}&relatedModule=Documents&mode=multiple','sendByForm')",
                                    'linkclass' => '',

                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_Link_Model' in method 'getLinks'.
                Open

                                Vtiger_Link_Model::getInstanceFromValues([
                                    'linktype' => 'RELATEDLIST_VIEWS',
                                    'linklabel' => 'LBL_RECORDS_PREVIEW_LIST',
                                    'view' => 'ListPreview',
                                    'linkicon' => 'fas fa-desktop',

                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_Link_Model' in method 'getAddRelationLinks'.
                Open

                            $addLinkModel['RELATEDLIST_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([
                                'linktype' => 'LISTVIEWBASIC',
                                'linklabel' => App\Language::translate('LBL_MASS_ADD', 'Documents'),
                                'linkdata' => [
                                    'url' => 'index.php?module=Documents&view=MassAddDocuments&sourceView=Detail',

                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_Loader' in method 'getInstance'.
                Open

                        $className = Vtiger_Loader::getComponentClassName('Model', 'RelationListView', $parentModuleModel->getName());

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

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

                                    \App\Log::warning("[RelationListView] Incorrect value of sorting: '$fieldName'");

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

                Avoid using static access to class 'Vtiger_Module_Model' in method 'getHeaders'.
                Open

                                $fieldModel = Vtiger_Field_Model::getInstance($fieldName, Vtiger_Module_Model::getInstance($fieldInfo['module_name']));

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

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

                                    \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

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

                                \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

                Avoid using static access to class '\Vtiger_Module_Model' in method 'loadSearchLockedFields'.
                Open

                                    $moduleModel = \Vtiger_Module_Model::getInstance($moduleName);

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

                Avoid assigning values to variables in if clauses and the like (line '220', column '7').
                Open

                    public function loadCondition()
                    {
                        $relatedModuleName = $this->getRelatedModuleModel()->getName();
                        $queryGenerator = $this->getRelationModel()->getQueryGenerator();
                        if ($entityState = $this->get('entityState')) {

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

                                } else {
                                    \App\Log::warning("[RelationListView] Incorrect value of sorting: '$fieldName'");
                                }

                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\Fields\Tree' in method 'getTreeEntries'.
                Open

                                $treeDetail = App\Fields\Tree::getValueByTreeId($template, $parent);

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

                Avoid using static access to class '\App\Fields\Owner' in method 'getTreeEntries'.
                Open

                                $tree['rel_created_user'] = \App\Fields\Owner::getLabel($row['rel_created_user']);

                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_Link_Model' in method 'getLinks'.
                Open

                                Vtiger_Link_Model::getInstanceFromValues([
                                    'linktype' => 'RELATEDLIST_VIEWS',
                                    'linklabel' => 'LBL_RECORDS_LIST',
                                    'view' => 'List',
                                    'linkicon' => 'far fa-list-alt',

                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_Link_Model' in method 'getLinks'.
                Open

                                $relatedLink['RELATEDLIST_MASSACTIONS'][] = Vtiger_Link_Model::getInstanceFromValues([
                                    'linktype' => 'RELATEDLIST_MASSACTIONS',
                                    'linklabel' => 'LBL_QUICK_EXPORT',
                                    'linkurl' => "javascript:Vtiger_RelatedList_Js.triggerMassAction('index.php?module={$parentRecordModel->getModuleName()}&action=RelationAjax&mode=exportToExcel&src_record={$parentRecordModel->getId()}&relatedModule={$relatedModuleModel->getName()}&relationId={$this->getRelationModel()->getId()}&isSortActive=true','sendByForm')",
                                    'linkclass' => '',

                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_Loader' in method 'getLinks'.
                Open

                                $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'PDF', $relatedModuleModel->getName());

                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_Link_Model' in method 'getSelectRelationLinks'.
                Open

                            Vtiger_Link_Model::getInstanceFromValues([
                                'linktype' => 'LISTVIEWBASIC',
                                'linklabel' => \App\Language::translate('LBL_SELECT_RELATION', $relatedModel->getName()),
                                'linkurl' => '',
                                'linkicon' => 'fas fa-level-up-alt',

                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_Link_Model' in method 'getAddRelationLinks'.
                Open

                                Vtiger_Link_Model::getInstanceFromValues([
                                    'linktype' => 'LISTVIEWBASIC',
                                    'linklabel' => App\Language::translate('LBL_ADD_RELATION', $relatedModel->getName()),
                                    'linkurl' => $this->getCreateViewUrl(),
                                    'linkqcs' => $relatedModel->isQuickCreateSupported(),

                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\Json' in method 'getWidgetsList'.
                Open

                            $row['data'] = \App\Json::decode($row['data']);

                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\Cache' in method 'getWidgetsList'.
                Open

                            return \App\Cache::get('RelatedModuleWidgets', $relationId);

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

                            if ('Documents' === $relatedModuleModel->getName()) {

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

                                    'linkurl' => "javascript:Vtiger_RelatedList_Js.triggerMassDownload('index.php?module={$parentRecordModel->getModuleName()}&action=RelationAjax&mode=massDownload&src_record={$parentRecordModel->getId()}&relatedModule=Documents&mode=multiple','sendByForm')",

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

                                $relatedLink['RELATEDLIST_MASSACTIONS'][] = Vtiger_Link_Model::getInstanceFromValues([

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

                            'RELATEDLIST_VIEWS' => [

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

                                    $relatedLink['RELATEDLIST_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([

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

                                    'linkdata' => ['url' => $smsNotifierModel->getMassSMSUrlForModule($relatedModuleModel->getName()), 'type' => 'modal'],

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

                            $relatedLink['LISTVIEWBASIC'] = $selectLinks;

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

                                    'linkicon' => 'far fa-list-alt',

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

                            $instance->set('viewId', $cvId);

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

                        if ($this->has('Query')) {

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

                                    'linkclass' => '',

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

                        if (\App\Cache::has('RelatedModuleWidgets', $relationId)) {

                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.

                Rename "$parentRecordModel" which has the same name as the field declared at line 27.
                Open

                        $parentRecordModel = $this->getParentRecordModel();

                Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

                Noncompliant Code Example

                class Foo {
                  public $myField;
                
                  public function doSomething() {
                    $myField = 0;
                    ...
                  }
                }
                

                See

                Define a constant instead of duplicating this literal "linktype" 9 times.
                Open

                                    'linktype' => 'RELATEDLIST_VIEWS',

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

                        if ($searchParams = $this->getArray('search_params')) {

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

                                    'linklabel' => 'LBL_RECORDS_LIST',

                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.

                Rename "$relatedModuleModel" which has the same name as the field declared at line 34.
                Open

                        $relatedModuleModel = $relationModelInstance->getRelationModuleModel();

                Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

                Noncompliant Code Example

                class Foo {
                  public $myField;
                
                  public function doSomething() {
                    $myField = 0;
                    ...
                  }
                }
                

                See

                Avoid unused parameters such as '$recordModel'.
                Open

                    public function getEntryExtend(Vtiger_Record_Model $recordModel)

                UnusedFormalParameter

                Since: 0.2

                Avoid passing parameters to methods or constructors and then not using those parameters.

                Example

                class Foo
                {
                    private function bar($howdy)
                    {
                        // $howdy is not used
                    }
                }

                Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                Returning type false but getInstance() is declared to return \Vtiger_RelationListView_Model
                Open

                            return false;

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

                        $queryGenerator = new \App\QueryGenerator($relationModelInstance->getRelationModuleModel()->getName());
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

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

                            $relationModuleName = $queryGenerator->getModule();
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

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

                                    $queryGenerator->setCustomColumn($columnName);
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

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

                            $queryGenerator->addCondition('id', $this->get('src_record'), 'n');
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Argument 3 (moduleName) is false but \Vtiger_Loader::getComponentClassName() takes string defined at /code/include/Loader.php:149
                Open

                        $className = Vtiger_Loader::getComponentClassName('Model', 'RelationListView', $parentModuleModel->getName());

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

                            $queryGenerator->parseAdvFilter($searchParams);
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

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

                            $queryGenerator->addCondition($this->get('search_key'), $this->get('search_value'), $this->get('operator'));
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Return type of getRelationQuery() is undeclared type \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
                Open

                    public function getRelationQuery($returnQueryGenerator = false)

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

                            $queryGenerator->setStateCondition($entityState);
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

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

                        $query->limit($pageLimit + 1)->offset($pagingModel->getStartIndex());
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

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

                                    \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

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

                                \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

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

                            $query = $queryGenerator->createQuery();
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Return type of getQueryGenerator() is undeclared type \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
                Open

                    public function getQueryGenerator()

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

                        return $this->getRelationQuery()->count();
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Argument 1 (templateId) is \type but \App\Fields\Tree::getValueByTreeId() takes int defined at /code/app/Fields/Tree.php:47
                Open

                                $treeDetail = App\Fields\Tree::getValueByTreeId($template, $parent);

                Reference to static property addSearchParamsToCreateView from undeclared class \Config\Relation
                Open

                        if (!empty(Config\Relation::$addSearchParamsToCreateView) && ($searchParams = $this->getArray('search_params')) && isset($searchParams['and']) && \is_array($searchParams['and'])) {
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Call to undeclared method \Vtiger_Module_Model::getMassSMSUrlForModule
                Open

                                    'linkdata' => ['url' => $smsNotifierModel->getMassSMSUrlForModule($relatedModuleModel->getName()), 'type' => 'modal'],
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

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

                        foreach ($this->getQueryGenerator()->getRelatedFields() as $fieldInfo) {
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Argument 2 (moduleName) is false but \App\Language::translate() takes string defined at /code/app/Language.php:161
                Open

                                'name' => $parentName . App\Language::translate($row['name'], $relModuleName),

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

                        return (new App\Db\Query())->select(['relcrmid'])->from('u_#__favorites')
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Suspicious type false of a variable or expression used to build a string. (Expected type to be able to cast to a string)
                Open

                                \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);

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

                                    \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Argument 2 (key) is int but \App\Cache::has() takes string defined at /code/app/Cache.php:74
                Open

                        if (\App\Cache::has('RelatedModuleWidgets', $relationId)) {

                Call to undeclared function \array_key_first()
                Open

                            $cvId = array_key_first($this->getRelationModel()->getCustomViewList());
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

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

                        return $this->getRecordsFromArray($this->getRelationQuery()->all());
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Suspicious type false of a variable or expression used to build a string. (Expected type to be able to cast to a string)
                Open

                                    \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);

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

                        return (new \App\Db\Query())->from('vtiger_trees_templates_data ttd')->innerJoin('u_#__crmentity_rel_tree rel', 'rel.tree = ttd.tree')
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Call to undeclared method \Vtiger_Module_Model::isSMSActiveForModule
                Open

                            if ($relatedModuleModel->isPermitted('MassSendSMS') && ($smsNotifierModel = \Vtiger_Module_Model::getInstance('SMSNotifier'))->isSMSActiveForModule($relatedModuleModel->getName())) {
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Argument 2 (moduleName) is false but \App\Language::translate() takes string defined at /code/app/Language.php:161
                Open

                                    'linklabel' => App\Language::translate('LBL_ADD_RELATION', $relatedModel->getName()),

                Call to method getCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
                Open

                                'userid' => App\User::getCurrentUserId(),
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

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

                            $this->getRelationModel()->getQueryGenerator()->initForCustomViewById($cvId);
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Argument 1 (moduleName) is false but \App\CustomView::getInstance() takes string defined at /code/app/CustomView.php:159
                Open

                            $customView = App\CustomView::getInstance($moduleModel->getName());

                Suspicious type false of a variable or expression used to build a string. (Expected type to be able to cast to a string)
                Open

                                    \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);

                Argument 2 (key) is int but \App\Cache::get() takes string defined at /code/app/Cache.php:61
                Open

                            return \App\Cache::get('RelatedModuleWidgets', $relationId);

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

                                    \App\Log::warning("[RelationListView] Incorrect value of sorting: '$fieldName'");
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Argument 3 (moduleName) is false but \Vtiger_Loader::getComponentClassName() takes string defined at /code/include/Loader.php:149
                Open

                                $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'PDF', $relatedModuleModel->getName());

                Suspicious type false of a variable or expression used to build a string. (Expected type to be able to cast to a string)
                Open

                                    'linkurl' => "javascript:Vtiger_RelatedList_Js.triggerMassAction('index.php?module={$parentRecordModel->getModuleName()}&action=RelationAjax&mode=exportToExcel&src_record={$parentRecordModel->getId()}&relatedModule={$relatedModuleModel->getName()}&relationId={$this->getRelationModel()->getId()}&isSortActive=true','sendByForm')",

                Argument 2 (key) is int but \App\Cache::save() takes string defined at /code/app/Cache.php:89
                Open

                        App\Cache::save('RelatedModuleWidgets', $relationId, $widgets);

                Argument 1 (moduleName) is false but \App\EventHandler::setModuleName() takes string defined at /code/app/EventHandler.php:366
                Open

                        $eventHandler->setModuleName($relatedModuleModel->getName());

                Argument 2 (moduleName) is false but \App\Language::translate() takes string defined at /code/app/Language.php:161
                Open

                                'linklabel' => \App\Language::translate('LBL_SELECT_RELATION', $relatedModel->getName()),

                Argument 2 (moduleName) is false but \App\Language::translate() takes string defined at /code/app/Language.php:161
                Open

                                $parentName = '(' . App\Language::translate($treeDetail['name'], $relModuleName) . ') ';

                Returning type \Vtiger_TreeView_Model but getTreeViewModel() is declared to return \Vtiger_TreeCategoryModal_Model
                Open

                        return Vtiger_TreeCategoryModal_Model::getInstance($this->getRelatedModuleModel());

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

                        $rows = $query->all();
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Call to method getLabel from undeclared class \App\Fields\Owner
                Open

                                $tree['rel_created_user'] = \App\Fields\Owner::getLabel($row['rel_created_user']);
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

                Argument 3 (moduleName) is false but \Vtiger_Loader::getComponentClassName() takes string defined at /code/include/Loader.php:149
                Open

                                $widgetName = Vtiger_Loader::getComponentClassName('Widget', $widget['type'], $moduleModel->getName());

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

                                    $this->getRelationModel()->getQueryGenerator()->setOrder($fieldName, $sortFlag);
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

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

                        $query = (new App\Db\Query())->from('a_#__relatedlists_widgets')->where(['relation_id' => $relationId]);
                Severity: Critical
                Found in modules/Vtiger/models/RelationListView.php by phan

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

                            foreach ($relatedFields as $relatedModuleName => $fields) {
                                foreach ($fields as $sourceField => $field) {
                                    $recordData = [
                                        'id' => $row[$sourceField . $relatedModuleName . 'id'] ?? 0,
                                    ];
                Severity: Major
                Found in modules/Vtiger/models/RelationListView.php and 1 other location - About 1 hr to fix
                modules/Vtiger/models/ListView.php on lines 617..628

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

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

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

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

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

                Refactorings

                Further Reading

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

                        if (!$request->isEmpty('lockedEmptyFields')) {
                            foreach ($request->getArray('lockedEmptyFields') as $value) {
                                if (strpos($value, ':')) {
                                    [$fieldName, $moduleName] = explode(':', $value);
                                    $moduleModel = \Vtiger_Module_Model::getInstance($moduleName);
                Severity: Major
                Found in modules/Vtiger/models/RelationListView.php and 1 other location - About 1 hr to fix
                modules/Vtiger/models/ListView.php on lines 663..672

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 106.

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

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

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

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

                Refactorings

                Further Reading

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

                        $relationModelInstance = $this->getRelationModel();

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

                        $relationModelInstance = $this->getRelationModel();

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

                        $relationModelInstance = $this->getRelationModel();

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

                            $relationModelInstance = Vtiger_Relation_Model::getInstanceById($relationId);

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

                        $relationModelInstance = $this->getRelationModel();

                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_RelationListView_Model extends \App\Base

                The class Vtiger_RelationListView_Model is not named in CamelCase.
                Open

                class Vtiger_RelationListView_Model extends \App\Base
                {
                    /**
                     * Relation model instance.
                     *

                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

                     * Set relation model instance.

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

                        return $this;

                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

                    }

                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 function isQuickSearchEnabled(): bool

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

                     * @param string              $relationModuleName

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

                     * @return self

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

                        $instance->setParentRecordModel($parentRecordModel);

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

                        $relationModelInstance->set('parentRecord', $parentRecordModel);

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

                     * @var Vtiger_Relation_Model

                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

                    }

                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

                     * Function to identify if the module supports quick search or not.

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

                    public static function getInstance(Vtiger_Record_Model $parentRecordModel, string $relationModuleName, $relationId = false, $cvId = 0)

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

                            $instance->set('viewId', $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

                     * @var Vtiger_Module_Model

                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 Vtiger_Relation_Model

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

                     *

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

                    /**

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

                     * @return \App\QueryGenerator

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

                     * Get relation list view model instance.

                Line exceeds 120 characters; contains 138 characters
                Open

                    public static function getInstance(Vtiger_Record_Model $parentRecordModel, string $relationModuleName, $relationId = false, $cvId = 0)

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

                        $instance->setRelatedModuleModel($relationModelInstance->getRelationModuleModel());

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

                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 Vtiger_Record_Model $parentRecord

                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

                        $relationModelInstance->set('query_generator', $queryGenerator);

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

                        $instance->setRelationModel($relationModelInstance);

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

                     * Function to get Relation query.

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

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

                    /**

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

                     * Mandatory columns.

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

                     * @return $this

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

                    }

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

                        return $this;

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

                    /**

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

                     * Get related module model instance.

                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

                     * Relation model instance.

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

                     *

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

                     *

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

                     * @param Vtiger_Module_Model $relatedModuleModel

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

                    {

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

                        } else {

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

                        }

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

                        if (is_numeric($cvId)) {

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

                        return $instance;

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

                     * @var array

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

                        return $this->has('quickSearchEnabled') ? $this->get('quickSearchEnabled') : 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

                    {

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

                    public function getRelationModel()

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

                    {

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

                    {

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

                        return $this->getRelationModel()->getQueryGenerator();

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

                        $instance = new $className();

                Line exceeds 120 characters; contains 160 characters
                Open

                            $relationModelInstance = Vtiger_Relation_Model::getInstance($parentModuleModel, Vtiger_Module_Model::getInstance($relationModuleName), $relationId);

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

                    public function getRelationQuery($returnQueryGenerator = false)

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

                        $this->loadCondition();

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

                            $relationModuleName = $queryGenerator->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

                        if ($entityState = $this->get('entityState')) {

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

                        } else {

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

                     */

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

                                    }

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

                        if ($this->has('viewId')) {

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

                     * Function to get the related list view entries.

                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

                        $listViewRecordModels = $relatedFields = [];

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

                        $recordId = $this->getParentRecordModel()->getId();

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

                                    $recordData = [

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

                                    $extRecordModel[$sourceField][$relatedModuleName] = Vtiger_Module_Model::getInstance($relatedModuleName)->getRecordFromArray($recordData);

                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->parentRecordModel = $parentRecord;

                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

                            $relationModelInstance = Vtiger_Relation_Model::getInstance($parentModuleModel, Vtiger_Module_Model::getInstance($relationModuleName), $relationId);

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

                        if (!$relationModelInstance) {

                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

                    {

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

                        }

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

                        $pageLimit = $pagingModel->getPageLimit();

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

                     * @return \Vtiger_Record_Model[]

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

                     * @param array $rows

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

                    public function getRecordsFromArray(array $rows)

                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

                    public function setRelationModel($relation)

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

                    /**

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

                        return $this;

                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 setRelatedModuleModel($relatedModuleModel)

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

                        $this->relatedModuleModel = $relatedModuleModel;

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

                     * Get query generator instance.

                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

                    /**

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

                        $this->loadOrderBy();

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

                        $relationModelInstance = $this->getRelationModel();

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

                            if ($returnQueryGenerator) {

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

                            return $query;

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

                    public function loadCondition()

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

                     * Parent record model instance.

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

                            $queryGenerator->setStateCondition($entityState);

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

                     * Related module model instance.

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

                        $this->relationModel = $relation;

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

                        }

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

                     * Set parent record model instance.

                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

                     * Set related module model instance.

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

                        $pagingModel->calculatePageRange(\count($relatedRecordList));

                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 \Vtiger_Record_Model[]

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

                    public function getRelatedModuleModel()

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

                     * Function extending recordModel object with additional information.

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

                    /**

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

                     *

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

                     * @param bool|int            $relationId

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

                     * @param Vtiger_Record_Model $recordModel

                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

                        $parentModuleModel = $parentRecordModel->getModule();

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

                            if (isset($this->mandatoryColumns[$relationModuleName])) {

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

                                    $queryGenerator->setCustomColumn($columnName);

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

                            }

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

                        throw new \App\Exceptions\AppException('>>> No relationModel instance, requires verification 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

                        if ($searchParams = $this->getArray('search_params')) {

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

                            $queryGenerator->parseAdvFilter($searchParams);

                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

                            $pagingModel->set('nextPageExists', false);

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

                     * Gets all entries.

                Line exceeds 120 characters; contains 158 characters
                Open

                                    $extRecordModel[$sourceField][$relatedModuleName] = Vtiger_Module_Model::getInstance($relatedModuleName)->getRecordFromArray($recordData);

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

                            $recordModel = $moduleModel->getRecordFromArray($row);

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

                     * @var Vtiger_Record_Model

                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

                     * @return $this

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

                        $className = Vtiger_Loader::getComponentClassName('Model', 'RelationListView', $parentModuleModel->getName());

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

                     * @param mixed $returnQueryGenerator

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

                     * @return \App\Db\Query|\App\QueryGenerator

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

                                return $queryGenerator;

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

                            $cvId = array_key_first($this->getRelationModel()->getCustomViewList());

                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 function getEntries(Vtiger_Paging_Model $pagingModel)

                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

                            $relatedFields[$fieldInfo['relatedModule']][$fieldInfo['sourceField']][] = $fieldInfo['relatedField'];

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

                                    foreach ($field as $relatedFieldName) {

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

                            }

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

                            $recordModel->ext = $extRecordModel;

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

                     * Set list view order by.

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

                            $queryGenerator = $relationModelInstance->getQuery();

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

                                foreach ($this->mandatoryColumns[$relationModuleName] as &$columnName) {

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

                            $this->set('Query', $query);

                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 function loadCustomView()

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

                            array_pop($rows);

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

                    public function getAllEntries(): array

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

                        return $this->getRecordsFromArray($this->getRelationQuery()->all());

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

                        foreach ($this->getQueryGenerator()->getRelatedFields() as $fieldInfo) {

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

                        foreach ($rows as $row) {

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

                                        unset($row[$sourceField . $relatedModuleName . $relatedFieldName]);

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

                            $listViewRecordModels[$row['id']] = $recordModel;

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

                        return $listViewRecordModels;

                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

                     * Load list view conditions.

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

                        $relatedRecordList = $this->getRecordsFromArray($rows);

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

                        $moduleModel = $this->getRelationModel()->getRelationModuleModel();

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

                    protected $parentRecordModel;

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

                    public function getParentRecordModel()

                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 Vtiger_Record_Model $parentRecordModel

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

                        $queryGenerator = new \App\QueryGenerator($relationModelInstance->getRelationModuleModel()->getName());

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

                        $this->loadCustomView();

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

                            $cvId = $this->get('viewId');

                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 getEntryExtend(Vtiger_Record_Model $recordModel)

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

                        if ('relation' !== $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

                    {

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

                                    ];

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

                    }

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

                        if (!empty($relationModelInstance) && $relationModelInstance->get('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

                        if ($relatedModuleName === $this->get('src_module') && !$this->isEmpty('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

                    }

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

                     *

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

                        $query->limit($pageLimit + 1)->offset($pagingModel->getStartIndex());

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

                            foreach ($relatedFields as $relatedModuleName => $fields) {

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

                            $this->getEntryExtend($recordModel);

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

                    protected $relatedModuleModel;

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

                    /**

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

                    /**

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

                     * @param Vtiger_Relation_Model $relation

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

                        return $this->relationModel;

                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 setParentRecordModel($parentRecord)

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

                    /**

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

                     * Get parent record model instance.

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

                     * @return $this

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

                     * @return Vtiger_Module_Model

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

                    public function getQueryGenerator()

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

                     * @param int|string          $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 ($this->has('Query')) {

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

                            return $this->get('Query');

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

                        $relatedModuleName = $this->getRelatedModuleModel()->getName();

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

                        $queryGenerator = $this->getRelationModel()->getQueryGenerator();

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

                        if ($searchParams = $this->getArray('search_rel_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

                            $this->getRelationModel()->getQueryGenerator()->initForCustomViewById($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

                        $rows = $query->all();

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

                        $count = \count($rows);

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

                     * Get models of records from array.

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

                                foreach ($fields as $sourceField => $field) {

                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

                     * Get relation model instance.

                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 Vtiger_Record_Model

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

                        return $this->parentRecordModel;

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

                     *

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

                     */

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

                        return $this->relatedModuleModel;

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

                     */

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

                     */

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

                        if ($relationId) {

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

                            $relationModelInstance = Vtiger_Relation_Model::getInstanceById($relationId);

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

                            return false;

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

                    /**

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

                            $queryGenerator->addCondition('id', $this->get('src_record'), 'n');

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

                            $this->getRelationModel()->setRelationConditions($searchParams);

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

                            $extRecordModel = [];

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

                     * @param Vtiger_Paging_Model $pagingModel

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

                        return $relatedRecordList;

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

                    /**

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

                     *

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

                            if ($recordId == $row['id']) {

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

                                continue;

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

                                        'id' => $row[$sourceField . $relatedModuleName . 'id'] ?? 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

                        $orderBy = $this->get('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

                    }

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

                     * Get header fields.

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

                     *

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

                     */

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

                        if ($this->get('viewId')) {

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

                        foreach ($fields as $fieldName => $fieldModel) {

                Line exceeds 120 characters; contains 164 characters
                Open

                                \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);

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

                            $fields = array_merge($fields, $relFields);

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

                        foreach ($rows as &$row) {

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

                            $pieces = explode('::', $row['parentTree']);

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

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

                                    $this->getRelationModel()->getQueryGenerator()->setOrder($fieldName, $sortFlag);

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

                    public function getHeaders()

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

                                $fields[$fieldModel->getFullName()] = $fieldModel;

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

                            foreach ($relFields as $fieldName => $fieldModel) {

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

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

                        $relationModelInstance = $this->getRelationModel();

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

                                'parent' => 0 == $parent ? '#' : $parent,

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

                                $tree['rel_created_user'] = \App\Fields\Owner::getLabel($row['rel_created_user']);

                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

                        }

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

                            $query = $queryGenerator->createQuery();

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

                        if (!$this->isEmpty('search_key')) {

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

                     * Load custom view.

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

                     * @return Vtiger_Record_Model[]

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

                            $pagingModel->set('nextPageExists', 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

                     */

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

                                $field = $this->getRelationModel()->getRelationModuleModel()->getFieldByName($fieldName);

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

                    {

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

                            }

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

                                \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);

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

                        }

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

                     *

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

                    {

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

                    /**

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

                                'name' => $parentName . App\Language::translate($row['name'], $relModuleName),

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

                            if ($showCreatorDetail) {

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

                        }

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

                            $queryGenerator->addCondition($this->get('search_key'), $this->get('search_value'), $this->get('operator'));

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

                     */

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

                        $query = $this->getRelationQuery();

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

                        if ($count > $pageLimit) {

                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

                                        $recordData[$relatedFieldName] = $row[$sourceField . $relatedModuleName . $relatedFieldName];

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

                            $moduleModel = $this->getRelationModel()->getRelationModuleModel();

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

                            $customView = App\CustomView::getInstance($moduleModel->getName());

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

                                if (!$fieldModel) {

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

                            if ($showComment) {

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

                        if (!empty($orderBy) && \is_array($orderBy)) {

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

                                    \App\Log::warning("[RelationListView] Incorrect value of sorting: '$fieldName'");

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

                                    \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);

                Line exceeds 120 characters; contains 168 characters
                Open

                                    \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);

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

                                    unset($relFields[$fieldName]);

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

                    {

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

                        ];

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

                    {

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

                        $relModuleName = $this->getRelatedModuleModel()->getName();

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

                        $rows = $relationModelInstance->getRelationTree();

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

                            }

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

                            $trees[] = $tree;

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

                    {

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

                        $createViewUrl = $this->getRelationModel()->getCreateViewUrl($fullView);

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

                        return $createViewUrl;

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

                     */

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

                            $selectLinks = $this->getSelectRelationLinks();

                Line exceeds 120 characters; contains 138 characters
                Open

                                    'linkdata' => ['url' => $smsNotifierModel->getMassSMSUrlForModule($relatedModuleModel->getName()), 'type' => 'modal'],

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

                            if ($relatedModuleModel->isPermitted('QuickExportToExcel')) {

                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 Vtiger_Link_Model[]

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

                        if (!$this->getRelationModel()->isSelectActionSupported() || $this->getParentRecordModel()->isReadOnly()) {

                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 (!$fieldModel->isViewable() && !$fieldModel->get('fromOutsideList')) {

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

                        return $this->getRelationQuery()->count();

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

                        $fields = $this->getTreeViewModel()->getTreeField();

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

                        return [

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

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

                        return (new \App\Db\Query())->from('vtiger_trees_templates_data ttd')->innerJoin('u_#__crmentity_rel_tree rel', 'rel.tree = ttd.tree')

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

                                    $createViewUrl .= "&{$row['field_name']}={$row['value']}";

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

                     * @return Vtiger_Link_Model[]

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

                    {

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

                                    'view' => 'List',

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

                                        'linktype' => 'RELATEDLIST_BASIC',

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

                        }

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

                            'viewInstance' => $this,

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

                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

                     * @return int

                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 Vtiger_TreeCategoryModal_Model::getInstance($this->getRelatedModuleModel());

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

                            'name' => $fields['fieldlabel'],

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

                                $treeDetail = App\Fields\Tree::getValueByTreeId($template, $parent);

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

                     * Get create url from parent record.

                Line exceeds 120 characters; contains 188 characters
                Open

                        if (!empty(Config\Relation::$addSearchParamsToCreateView) && ($searchParams = $this->getArray('search_params')) && isset($searchParams['and']) && \is_array($searchParams['and'])) {

                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

                        $relatedLink = [

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

                                    'linklabel' => 'LBL_RECORDS_PREVIEW_LIST',

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

                                            'type' => 'modal',

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

                     * Function to get the select links for related list.

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

                     * Function to get the add links for related list.

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

                        return (new \App\Db\Query())->from('vtiger_trees_templates_data ttd')->innerJoin('u_#__crmentity_rel_tree rel', 'rel.tree = ttd.tree')

                Line exceeds 120 characters; contains 121 characters
                Open

                            ->where(['ttd.templateid' => $template, 'rel.crmid' => $recordId, 'rel.relmodule' => $relModuleId])->count();

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

                                    'linktype' => 'RELATEDLIST_VIEWS',

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

                            }

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

                                    'linktype' => 'RELATEDLIST_MASSACTIONS',

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

                                    ]);

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

                        $eventHandler->setParams([

                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 getSelectRelationLinks(): array

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

                    {

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

                        $relationModelInstance = $this->getRelationModel();

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

                            'RELATEDLIST_VIEWS' => [

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

                                    'linkicon' => 'far fa-list-alt',

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

                                    'linkurl' => "javascript:Vtiger_RelatedList_Js.triggerMassDownload('index.php?module={$parentRecordModel->getModuleName()}&action=RelationAjax&mode=massDownload&src_record={$parentRecordModel->getId()}&relatedModule=Documents&mode=multiple','sendByForm')",

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

                                    'linkicon' => 'fas fa-comment-sms',

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

                                    'linkicon' => 'fas fa-file-export',

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

                        $eventHandler->setModuleName($relatedModuleModel->getName());

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

                            Vtiger_Link_Model::getInstanceFromValues([

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

                                'linktype' => 'LISTVIEWBASIC',

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

                    public function getAddRelationLinks(): array

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

                                $fieldName = $fieldInfo['field_name'];

                Line exceeds 120 characters; contains 142 characters
                Open

                                if (!$fieldModel->isActiveField() || ($sourceFieldName && !$moduleModel->getFieldByName($sourceFieldName)->isActiveField())) {

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

                        if ($relFields = $this->getRelationModel()->getRelationFields()) {

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

                     * Get tree view model.

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

                                $parentName = '(' . App\Language::translate($treeDetail['name'], $relModuleName) . ') ';

                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

                            foreach ($searchParams['and'] as $row) {

                Line exceeds 120 characters; contains 135 characters
                Open

                                $fieldModel = Vtiger_Field_Model::getInstance($fieldName, Vtiger_Module_Model::getInstance($fieldInfo['module_name']));

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

                                if ('e' === $row['comparator']) {

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

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

                    public function getTreeEntries()

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

                                Vtiger_Link_Model::getInstanceFromValues([

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

                        $trees = [];

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

                            }

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

                        $relModuleId = $this->getRelatedModuleModel()->getId();

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

                                    'linkicon' => 'fas fa-desktop',

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

                    /**

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

                                    'linktype' => 'RELATEDLIST_MASSACTIONS',

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

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

                Line exceeds 120 characters; contains 276 characters
                Open

                                    'linkurl' => "javascript:Vtiger_RelatedList_Js.triggerMassDownload('index.php?module={$parentRecordModel->getModuleName()}&action=RelationAjax&mode=massDownload&src_record={$parentRecordModel->getId()}&relatedModule=Documents&mode=multiple','sendByForm')",

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

                                    'linktype' => 'RELATEDLIST_MASSACTIONS',

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

                                ]);

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

                                ]);

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

                                $pdfModel = new $handlerClass();

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

                                        ],

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

                                        'linkclass' => 'btn-light js-mass-record-event',

                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

                            }

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

                                $sourceFieldName = $fieldInfo['source_field_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

                        if (empty($fields)) {

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

                        unset($fields['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

                        }

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

                    public function getLinks(): array

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

                                    'view' => 'ListPreview',

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

                                    'linklabel' => 'LBL_MASS_DOWNLOAD',

                Line exceeds 120 characters; contains 194 characters
                Open

                            if ($relatedModuleModel->isPermitted('MassSendSMS') && ($smsNotifierModel = \Vtiger_Module_Model::getInstance('SMSNotifier'))->isSMSActiveForModule($relatedModuleModel->getName())) {

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

                                    'linkclass' => 'js-mass-record-event',

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

                                if ($pdfModel->getActiveTemplatesForModule($relatedModuleModel->getName(), 'RelatedList')) {

                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 ($customView->getColumnsListByCvid($this->get('viewId')) as $fieldInfo) {

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

                                    continue;

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

                                    continue;

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

                        }

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

                            $fields = $this->getRelationModel()->getQueryFields();

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

                     * @return string[]

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

                        $showCreatorDetail = $relationModelInstance->get('creator_detail');

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

                     * @return int

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

                        if (!empty(Config\Relation::$addSearchParamsToCreateView) && ($searchParams = $this->getArray('search_params')) && isset($searchParams['and']) && \is_array($searchParams['and'])) {

                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

                                $selectLinkModel->set('_selectRelation', true)->set('_module', $relatedModuleModel);

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

                                $relatedLink['RELATEDLIST_MASSACTIONS'][] = Vtiger_Link_Model::getInstanceFromValues([

                Line exceeds 120 characters; contains 350 characters
                Open

                                    'linkurl' => "javascript:Vtiger_RelatedList_Js.triggerMassAction('index.php?module={$parentRecordModel->getModuleName()}&action=RelationAjax&mode=exportToExcel&src_record={$parentRecordModel->getId()}&relatedModule={$relatedModuleModel->getName()}&relationId={$this->getRelationModel()->getId()}&isSortActive=true','sendByForm')",

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

                            }

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

                        $eventHandler = new App\EventHandler();

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

                            'relatedLink' => $relatedLink,

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

                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 Vtiger_Link_Model[][]

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

                                if ($field || 'id' === $fieldName) {

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

                     * @return Vtiger_Field_Model[]

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

                                if (!$fieldModel->isActiveField() || ($sourceFieldName && !$moduleModel->getFieldByName($sourceFieldName)->isActiveField())) {

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

                                }

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

                            }

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

                                if (!$fieldModel) {

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

                     * Function to get Total number of record in this relation.

                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

                     * Get tree headers.

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

                            $tree = [

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

                                'id' => $row['tree'],

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

                        $template = $treeViewModel->getTemplate();

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

                     * @param bool $fullView

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

                            }

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

                                    'linklabel' => 'LBL_RECORDS_LIST',

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

                            $relatedLink['LISTVIEWBASIC'] = $selectLinks;

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

                            if ('Documents' === $relatedModuleModel->getName()) {

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

                                $relatedLink['RELATEDLIST_MASSACTIONS'][] = Vtiger_Link_Model::getInstanceFromValues([

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

                                    'linkurl' => "javascript:Vtiger_RelatedList_Js.triggerMassAction('index.php?module={$parentRecordModel->getModuleName()}&action=RelationAjax&mode=exportToExcel&src_record={$parentRecordModel->getId()}&relatedModule={$relatedModuleModel->getName()}&relationId={$this->getRelationModel()->getId()}&isSortActive=true','sendByForm')",

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

                                'linkicon' => 'fas fa-level-up-alt',

                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

                                    \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);

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

                        }

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

                            if (!$fieldModel) {

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

                                unset($fields[$fieldName]);

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

                     * @return Vtiger_TreeCategoryModal_Model

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

                    /**

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

                        $template = $this->getTreeViewModel()->getTemplate();

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

                            if (!empty($row['icon'])) {

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

                     * Function to get Total number of record in this relation.

                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

                                Vtiger_Link_Model::getInstanceFromValues([

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

                                ]),

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

                                    'linktype' => 'RELATEDLIST_VIEWS',

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

                                ]);

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

                            }

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

                            foreach ($orderBy as $fieldName => $sortFlag) {

                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

                    /**

                Line exceeds 120 characters; contains 168 characters
                Open

                                    \App\Log::warning("The field does not exist: '$fieldName' | Module: " . $this->getRelationModel()->getRelationModuleModel()->getName(), __METHOD__);

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

                                unset($fields[$fieldName]);

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

                                }

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

                            }

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

                        return $fields;

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

                    public function getTreeViewModel()

                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

                            $parentName = '';

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

                            if ($row['depth'] > 0) {

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

                                $tree['rel_comment'] = $row['rel_comment'];

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

                            }

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

                        }

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

                        return $trees;

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

                            ->where(['ttd.templateid' => $template, 'rel.crmid' => $recordId, 'rel.relmodule' => $relModuleId])->count();

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

                            $relatedLink = array_merge_recursive($relatedLink, $this->getAddRelationLinks());

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

                            }

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

                                $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'PDF', $relatedModuleModel->getName());

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

                                    $relatedLink['RELATEDLIST_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([

                Line exceeds 120 characters; contains 124 characters
                Open

                                            'url' => "index.php?module={$parentRecordModel->getModuleName()}&view=PDF&fromview=RelatedList",

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

                                        'linkicon' => 'fas fa-file-pdf',

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

                                        'linkhint' => \App\Language::translate('LBL_EXPORT_PDF'),

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

                        }

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

                        $parentRecordModel = $this->getParentRecordModel();

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

                        $relatedModuleModel = $relationModelInstance->getRelationModuleModel();

                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

                                    'linkclass' => '',

                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 $eventHandler->getParam('relatedLink');

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

                                if ($sourceFieldName) {

                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

                                $tree['icon'] = $row['icon'];

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

                    public function getRelatedTreeEntriesCount()

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

                        $recordId = $this->getParentRecordModel()->getId();

                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 string

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

                    public function getCreateViewUrl(bool $fullView = false)

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

                                    'linkicon' => 'fas fa-download',

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

                            if ($relatedModuleModel->isPermitted('MassSendSMS') && ($smsNotifierModel = \Vtiger_Module_Model::getInstance('SMSNotifier'))->isSMSActiveForModule($relatedModuleModel->getName())) {

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

                                    'linklabel' => 'LBL_MASS_SEND_SMS',

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

                                    'linklabel' => 'LBL_QUICK_EXPORT',

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

                            if ($relatedModuleModel->isPermitted('ExportPdf')) {

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

                                        'linkdata' => [

                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 (!$relatedModel->isPermitted('DetailView')) {

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

                                'linklabel' => \App\Language::translate('LBL_SELECT_RELATION', $relatedModel->getName()),

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

                                'linkurl' => '',

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

                     *

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

                        $fields = [];

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

                                $fieldModel = Vtiger_Field_Model::getInstance($fieldName, Vtiger_Module_Model::getInstance($fieldInfo['module_name']));

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

                                    $fieldModel->set('source_field_name', $sourceFieldName);

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

                     */

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

                     * Get tree entries.

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

                        $showComment = $relationModelInstance->get('relation_comment');

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

                            end($pieces);

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

                            $parent = prev($pieces);

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

                            }

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

                                $tree['rel_created_time'] = App\Fields\DateTime::formatToDisplay($row['rel_created_time']);

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

                                }

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

                                    'linkclass' => '',

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

                                    'linkdata' => ['url' => $smsNotifierModel->getMassSMSUrlForModule($relatedModuleModel->getName()), 'type' => 'modal'],

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

                        $eventHandler->setRecordModel($parentRecordModel);

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

                        $eventHandler->trigger('RelationListLinks');

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

                        $treeViewModel = $this->getTreeViewModel();

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

                     * Function to get the links for related list.

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

                            foreach ($selectLinks as $selectLinkModel) {

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

                            }

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

                                $relatedLink['RELATEDLIST_MASSACTIONS'][] = Vtiger_Link_Model::getInstanceFromValues([

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

                                            'url' => "index.php?module={$parentRecordModel->getModuleName()}&view=PDF&fromview=RelatedList",

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

                        $relatedModel = $this->getRelationModel()->getRelationModuleModel();

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

                        return [

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

                            ->column();

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

                                if (class_exists($widgetName)) {

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

                     * Get widgets list.

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

                        $relationId = $this->getRelationModel()->getId();

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

                        $dataReader->close();

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

                     */

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

                            }

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

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

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

                        $relationModelInstance = $this->getRelationModel();

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

                            'LISTVIEWBASIC' => [

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

                                Vtiger_Link_Model::getInstanceFromValues([

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

                        if ('Documents' === $relatedModel->getName()) {

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

                            $addLinkModel['RELATEDLIST_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([

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

                                'linktype' => 'LISTVIEWBASIC',

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

                                'relmodule' => $this->getRelatedModuleModel()->getName(),

                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 string|string[] $fields

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

                                    $widgetInstance = new $widgetName($moduleModel->getName(), $moduleModel, $recordId, $widget);

                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

                        }

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

                                $moduleModel->getFieldByName($value)->set('searchLockedEmptyFields', true);

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

                        $addLinkModel = [

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

                                    'url' => 'index.php?module=Documents&view=MassAddDocuments&sourceView=Detail',

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

                        return (new App\Db\Query())->select(['relcrmid'])->from('u_#__favorites')

                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

                            }

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

                    }

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

                    {

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

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

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

                            foreach ($request->getArray('lockedFields') as $value) {

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

                                $moduleModel->getFieldByName($value)->set('searchLockedFields', true);

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

                        if (!$relationModelInstance->isAddActionSupported() || $this->getParentRecordModel()->isReadOnly()) {

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

                                    'linkqcs' => $relatedModel->isQuickCreateSupported(),

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

                                    'linkurl' => $this->getCreateViewUrl(),

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

                                    'cb' => 'Documents_MassAddDocuments_Js.register',

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

                    }

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

                                'showLabel' => 1,

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

                            } elseif (isset($relFields[$fieldName])) {

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

                     * Set fileds.

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

                        return $widgets;

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

                                    }

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

                        $widgets = [];

                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

                                foreach ($values as $value) {

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

                        }

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

                            return [];

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

                        $relatedModel = $relationModelInstance->getRelationModuleModel();

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

                                    'linkicon' => 'fas fa-plus',

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

                                ]),

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

                     * @param int $recordId

                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 ($widgetCol as $widget) {

                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 bool

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

                     * @return void

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

                    public function loadSearchLockedFields(App\Request $request): void

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

                            foreach ($request->getArray('lockedEmptyFields') as $value) {

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

                                    $moduleModel = \Vtiger_Module_Model::getInstance($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

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

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

                        }

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

                            ]);

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

                    public function setFields($fields)

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

                     * @return array

                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

                        $query = (new App\Db\Query())->from('a_#__relatedlists_widgets')->where(['relation_id' => $relationId]);

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

                     * Locked fields according to parameters passed.

                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

                            $fields = explode(',', $fields);

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

                    /**

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

                     * @return array

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

                        if (\App\Cache::has('RelatedModuleWidgets', $relationId)) {

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

                        $dataReader = $query->orderBy(['sequence' => SORT_ASC])->createCommand()->query();

                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

                                    'linktype' => 'LISTVIEWBASIC',

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

                    public function getFavoriteRecords()

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

                                $relatedListFields[$fieldName] = $fieldModel;

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

                     *

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

                                    $widgetObject = $widgetInstance->getWidget();

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

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

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

                                        $moduleModel->getFieldByName($value[0])->set('searchLockedEmptyFields', 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

                                'linklabel' => App\Language::translate('LBL_MASS_ADD', 'Documents'),

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

                                'linkclass' => 'btn-light js-show-modal',

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

                                'linkicon' => 'yfi-document-templates',

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

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

                    }

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

                            $fieldModel = $this->relatedModuleModel->getFieldByName($fieldName);

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

                    /**

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

                     *

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

                                        $widgets[$widgetObject['wcol']][] = $widgetObject;

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

                            ->where([

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

                     */

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

                        $relatedListFields = [];

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

                            return \App\Cache::get('RelatedModuleWidgets', $relationId);

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

                        foreach ($fields as $fieldName) {

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

                     * Check if widgets exist.

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

                                'userid' => App\User::getCurrentUserId(),

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

                        $this->relationModel->set('QueryFields', $relatedListFields);

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

                    public function isWidgetsList(): bool

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

                     */

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

                     * Get widgets instances.

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

                                    [$fieldName, $moduleName] = explode(':', $value);

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

                        if (\is_string($fields)) {

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

                     *

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

                            if ($fieldModel) {

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

                                }

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

                            $widgets[$row['wcol']][$row['id']] = $row;

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

                    {

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

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

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

                                    if (\count($widgetObject) > 0) {

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

                        return $widgets;

                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

                        $moduleModel = $this->getRelationModel()->getRelationModuleModel();

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

                                if (strpos($value, ':')) {

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

                    }

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

                                'module' => $this->getParentRecordModel()->getModuleName(),

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

                            }

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

                    }

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

                        foreach ($this->getWidgetsList() as $widgetCol) {

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

                                $widgetName = Vtiger_Loader::getComponentClassName('Widget', $widget['type'], $moduleModel->getName());

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

                        $widgets = [1 => [], 2 => [], 3 => []];

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

                        return !empty($widgets[1]) || !empty($widgets[2]) || !empty($widgets[3]);

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

                                'linkdata' => [

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

                    {

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

                                'crmid' => $this->getParentRecordModel()->getId(),

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

                        $moduleModel = $this->getRelatedModuleModel();

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

                    public function getWidgetsList(): array

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

                        App\Cache::save('RelatedModuleWidgets', $relationId, $widgets);

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

                    /**

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

                                    'linklabel' => App\Language::translate('LBL_ADD_RELATION', $relatedModel->getName()),

                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

                        $relFields = $this->getRelationModel()->getRelationFields();

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

                        }

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

                            $row['data'] = \App\Json::decode($row['data']);

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

                            }

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

                                    'view' => 'Detail',

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

                                $relatedListFields[$fieldName] = $relFields[$fieldName];

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

                        }

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

                    public function getWidgets(int $recordId): array

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

                        $widgets = $this->getWidgetsList();

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

                     *

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

                                    $value = $fieldName;

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

                                    if ('y' === $value[1]) {

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

                class Vtiger_RelationListView_Model extends \App\Base

                There are no issues that match your filters.

                Category
                Status