YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Workflows/models/Record.php

Summary

Maintainability
D
2 days
Test Coverage
F
0%

Settings_Workflows_Record_Model has 30 functions (exceeds 20 allowed). Consider refactoring.
Open

class Settings_Workflows_Record_Model extends Settings_Vtiger_Record_Model
{
    /**
     * Get record id.
     *
Severity: Minor
Found in modules/Settings/Workflows/models/Record.php - About 3 hrs to fix

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

    class Settings_Workflows_Record_Model extends Settings_Vtiger_Record_Model
    {
        /**
         * Get record id.
         *

    File Record.php has 285 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
     * The Original Code is:  vtiger CRM Open Source
    Severity: Minor
    Found in modules/Settings/Workflows/models/Record.php - About 2 hrs to fix

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

          public function transformAdvanceFilterToWorkFlowFilter()
          {
              $conditions = $this->get('conditions');
              $wfCondition = [];
      
      
      Severity: Minor
      Found in modules/Settings/Workflows/models/Record.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 getRecordLinks has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getRecordLinks(): array
          {
              $links = [];
      
              $recordLinks = [
      Severity: Minor
      Found in modules/Settings/Workflows/models/Record.php - About 1 hr to fix

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

            public function transformToAdvancedFilterCondition($conditions = false)
            {
                if (!$conditions) {
                    $conditions = $this->get('conditions');
                }
        Severity: Minor
        Found in modules/Settings/Workflows/models/Record.php - About 45 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            public function getFieldFilterValueType($fieldname)
            {
                $conditions = $this->get('conditions');
                if (!empty($conditions) && \is_array($conditions)) {
                    foreach ($conditions as $filter) {
        Severity: Minor
        Found in modules/Settings/Workflows/models/Record.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

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

        class Settings_Workflows_Record_Model extends Settings_Vtiger_Record_Model

        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.

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

                $transformedConditions[1] = ['columns' => $firstGroup ?? []];

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

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

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

                            $firstGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['value'],

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

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

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

                $transformedConditions[2] = ['columns' => $secondGroup ?? []];

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

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

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

                            $secondGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['value'],

        UndefinedVariable

        Since: 2.8.0

        Detects when a variable is used that has not been defined before.

        Example

        class Foo
        {
            private function bar()
            {
                // $message is undefined
                echo $message;
            }
        }

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

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

                return (new \App\Db\Query())->select(['summary', 'task'])->from('com_vtiger_workflowtasks')->where(['workflow_id' => $this->getId()])->all();

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

                return (new \App\Db\Query())

        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 getTasks has a boolean flag argument $active, which is a certain sign of a Single Responsibility Principle violation.
        Open

            public function getTasks($active = true)

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

                $wm = new VTWorkflowManager();

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

                $wm = new VTWorkflowManager();

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

                return (new VTEntityMethodManager())->methodsForModule($this->get('module_name'));

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

                $wm = new VTWorkflowManager();

        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 transformToAdvancedFilterCondition has a boolean flag argument $conditions, which is a certain sign of a Single Responsibility Principle violation.
        Open

            public function transformToAdvancedFilterCondition($conditions = 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 '433', column '13').
        Open

                $wm = new VTWorkflowManager();

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

                return (new App\Db\Query())->from('com_vtiger_workflows')->count();

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

                $wm = new VTWorkflowManager();

        MissingImport

        Since: 2.7.0

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

        Example

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

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

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

                $this->module = 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 using static access to class '\App\Json' in method 'save'.
        Open

                $wf->test = \App\Json::encode($this->get('conditions'));

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

                    } else {
                        $moduleRelationsByType['LBL_WORKFLOW_CUSTOM_RELATIONS'][] = $relationInfo;
                    }

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

            public function getParams(string $key = null)
            {
                if ($params = $this->get('params') ?: []) {
                    $params = \App\Json::decode($params);
                }

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

                        } else {
                            $secondGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['value'],
                                'column_condition' => $info['joincondition'], 'valuetype' => $info['valuetype'], 'groupid' => $info['groupid'], ];
                        }

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

                    $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class 'App\Relation' in method 'getModuleRelationsByType'.
        Open

                $moduleRelations = App\Relation::getByModule($this->getModule()->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 'Settings_Workflows_TaskRecord_Model' in method 'getTasks'.
        Open

                return Settings_Workflows_TaskRecord_Model::getAllForWorkflow($this, $active);

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

                    $params = \App\Json::decode($params);

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

                $workflowModel->set('conditions', !empty($wf->test) ? \App\Json::decode($wf->test) : []);

        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 'Settings_Workflows_TaskType_Model' in method 'getTaskTypes'.
        Open

                foreach (Settings_Workflows_TaskType_Model::getAllForModule($this->getModule()) as $taskType) {

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

                        if (!($info['groupid'])) {

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

                        'linklabel' => 'LBL_ACTIVATION_TASKS',

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

                $wf->executionCondition = $this->get('execution_condition');

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

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

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

                            $firstGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['value'],

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

                            $firstGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['value'],

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

                        'linkurl' => 'javascript:Settings_Workflows_List_Js.setChangeStatusTasks(this,' . $this->getId() . ',true);',

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

                if ($params = $this->get('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 "conditions" 6 times.
        Open

                $wf->test = \App\Json::encode($this->get('conditions'));

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

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

                            $firstGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['value'],

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

                        'linktype' => 'LISTVIEWRECORD',

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

                $wf->moduleName = $this->get('module_name');

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

                                'column_condition' => $info['joincondition'], 'valuetype' => $info['valuetype'], 'groupid' => $info['groupid'], ];

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

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

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

                        'linktype' => 'LISTVIEWRECORD',

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

                            $firstGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['value'],

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

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

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

                                'column_condition' => $info['joincondition'], 'valuetype' => $info['valuetype'], 'groupid' => $info['groupid'], ];

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

                $transformedConditions[1] = ['columns' => $firstGroup ?? []];

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

                            $firstGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['value'],

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

                                'column_condition' => $info['joincondition'], 'valuetype' => $info['valuetype'], 'groupid' => $info['groupid'], ];

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

                        'class' => 'activeTasks',

        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.

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

                            $secondGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['value'],

        Argument 1 (moduleName) is false but \App\Relation::getByModule() takes string defined at /code/app/Relation.php:29
        Open

                $moduleRelations = App\Relation::getByModule($this->getModule()->getName());

        Call to undeclared method \VTTask::setTaskType
        Open

                    $taskModel = Settings_Workflows_TaskRecord_Model::getCleanInstance($this, $taskType->get('classname'))->setTaskType($taskType);

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

                            $firstGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['value'],

        Return type of getCleanInstance() is undeclared type \self
        Open

            public static function getCleanInstance(string $moduleName)

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

                return (new \App\Db\Query())

        Reference to undeclared property \Settings_Workflows_Record_Model->workflow_object
        Open

                return $this->workflow_object;

        Reference to undeclared property \Workflow->filtersavedinnew
        Open

                $wf->filtersavedinnew = 6;

        Reference to undeclared property \Settings_Workflows_Record_Model->module
        Open

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

        Reference to undeclared property \Workflow->params
        Open

                $wf->params = null;

        Return type of getInstanceFromWorkflowObject() is undeclared type \self
        Open

            public static function getInstanceFromWorkflowObject($wf)

        Reference to undeclared property \Settings_Workflows_Record_Model->module
        Open

                return $this->module;

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

                return (new App\Db\Query())->from('com_vtiger_workflows')->count();

        Reference to undeclared property \Settings_Workflows_Record_Model->workflow_object
        Open

                $this->workflow_object = $wf;

        Return type of getInstance() is undeclared type \self
        Open

            public static function getInstance($workflowId)

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

                return (new \App\Db\Query())->select(['summary', 'task'])->from('com_vtiger_workflowtasks')->where(['workflow_id' => $this->getId()])->all();

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

                if (\is_array($conditions)) {
                    foreach ($conditions as $index => $condition) {
                        $columns = $condition['columns'];
                        if ('1' == $index && empty($columns)) {
                            $wfCondition[] = ['fieldname' => '', 'operation' => '', 'value' => '', 'valuetype' => '',
        Severity: Major
        Found in modules/Settings/Workflows/models/Record.php and 1 other location - About 4 hrs to fix
        modules/Settings/PDF/models/Record.php on lines 196..211

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

        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 (!empty($conditions)) {
                    foreach ($conditions as $info) {
                        if (!($info['groupid'])) {
                            $firstGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['value'],
                                'column_condition' => $info['joincondition'], 'valuetype' => $info['valuetype'], 'groupid' => $info['groupid'], ];
        Severity: Major
        Found in modules/Settings/Workflows/models/Record.php and 1 other location - About 3 hrs to fix
        modules/Vtiger/helpers/AdvancedFilter.php on lines 144..154

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 157.

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

                $transformedConditions = [];

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

                $moduleRelationsByType = [];

        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 Settings_Workflows_Record_Model extends Settings_Vtiger_Record_Model

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

        <?php

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

                $wm = new VTWorkflowManager();

        ShortVariable

        Since: 0.2

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

        Example

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

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

        The class Settings_Workflows_Record_Model is not named in CamelCase.
        Open

        class Settings_Workflows_Record_Model extends Settings_Vtiger_Record_Model
        {
            /**
             * Get record id.
             *

        CamelCaseClassName

        Since: 0.2

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

        Example

        class class_name {
        }

        Source

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

                $wf = $this->getWorkflowObject();

        ShortVariable

        Since: 0.2

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

        Example

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

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

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

                $wm = new VTWorkflowManager();

        ShortVariable

        Since: 0.2

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

        Example

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

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

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

                $wm = new VTWorkflowManager();

        ShortVariable

        Since: 0.2

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

        Example

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

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

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

                $wf = $this->getWorkflowObject();

        ShortVariable

        Since: 0.2

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

        Example

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

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

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

                $wf = $this->getWorkflowObject();

        ShortVariable

        Since: 0.2

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

        Example

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

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

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

                $wf = $wm->newWorkflow($moduleName);

        ShortVariable

        Since: 0.2

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

        Example

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

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

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

                $wf = $wm->retrieve($workflowId);

        ShortVariable

        Since: 0.2

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

        Example

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

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

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

            protected function setWorkflowObject($wf)

        ShortVariable

        Since: 0.2

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

        Example

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

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

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

                $wf = $this->getWorkflowObject();

        ShortVariable

        Since: 0.2

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

        Example

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

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

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

                $wm = new VTWorkflowManager();

        ShortVariable

        Since: 0.2

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

        Example

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

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

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

                $wm = new VTWorkflowManager();

        ShortVariable

        Since: 0.2

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

        Example

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

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

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

            public static function getInstanceFromWorkflowObject($wf)

        ShortVariable

        Since: 0.2

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

        Example

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

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

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

             * @return string

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

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

            protected function setWorkflowObject($wf)

        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 tasks list url.

        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

                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

             * @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

             * @return object

        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 workflow object.

        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 'index.php?module=Workflows&parent=Settings&view=TasksList&record=' . $this->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 $this->get('workflow_id');

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

            }

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

            public function getName()

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

                return 'index.php?module=Workflows&parent=Settings&view=Edit&record=' . $this->getId();

        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

             *

        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

             * Set workflow object.

        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 edit view url.

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

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

             * Get record name.

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

            public function getEditViewUrl()

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

             * Get add task url.

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

            public function getAddTaskUrl()

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

            public function 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

             */

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

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

             * Get record id.

        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

             * @return string

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

             * @param object $wf

        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->workflow_object = $wf;

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

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

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

            }

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

             */

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

                return 'index.php?module=Workflows&parent=Settings&view=EditTask&for_workflow=' . $this->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

             *

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

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

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

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

            }

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

                $wm = new VTWorkflowManager();

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

                $wf->description = $this->get('summary');

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

                $this->set('workflow_id', $wf->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

                $links = [];

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

                    ],

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

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

        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 $key ? ($params[$key] ?? null) : $params;

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

                $wf->test = \App\Json::encode($this->get('conditions'));

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

                $wf->moduleName = $this->get('module_name');

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

                    $wf->sequence = $this->getNextSequenceNumber($this->get('module_name'));

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

            public function getEntityMethods()

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

                    [

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

                        'linkurl' => 'javascript:Settings_Workflows_List_Js.setChangeStatusTasks(this,' . $this->getId() . ', false);',

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

            {

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

                    }

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

            /**

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

                $wf->executionCondition = $this->get('execution_condition');

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

                $wf->filtersavedinnew = $this->get('filtersavedinnew');

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

                $wf->schdayofweek = $this->get('schdayofweek');

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

                if (!isset($wf->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

             *

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

            public function getRecordLinks(): array

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

                return Settings_Workflows_TaskRecord_Model::getAllForWorkflow($this, $active);

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

        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

                return (new VTEntityMethodManager())->methodsForModule($this->get('module_name'));

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

                    [

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

                        'linkurl' => 'index.php?module=Workflows&parent=Settings&action=ExportWorkflow&id=' . $this->getId(),

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

                return $this->module;

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

             *

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

                $taskTypes = [];

        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 getParams(string $key = null)

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

                $wf->schtime = $this->get('schtime');

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

                $wf->schannualdates = $this->get('schannualdates');

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

                $wf->nexttrigger_time = $this->get('nexttrigger_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

                        'linklabel' => 'LBL_ACTIVATION_TASKS',

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

                        'linklabel' => 'LBL_DEACTIVATION_TASKS',

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

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

             * @param string $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

                    $taskModel = Settings_Workflows_TaskRecord_Model::getCleanInstance($this, $taskType->get('classname'))->setTaskType($taskType);

        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

             */

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

                    $params = \App\Json::decode($params);

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

            public function save()

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

                        'linktype' => 'LISTVIEWRECORD',

        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

                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

                        'linktype' => 'LISTVIEWRECORD',

        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

            public function getTaskTypes()

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

                $wf = $this->getWorkflowObject();

        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

                        'class' => 'activeTasks',

        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 getTasks($active = true)

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

             * Delete record from database.

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

             */

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

            /** {@inheritdoc} */

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

                        'class' => 'deactiveTasks',

        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

                $wf->schmonth = $this->get('schmonth');

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

            public function delete()

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

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

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

                        'linklabel' => 'LBL_EXPORT_RECORD',

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

             * Get tasks 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

                    return 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

                $wf = $this->getWorkflowObject();

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

            }

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

                $wm = new VTWorkflowManager();

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

                $wm->delete($this->getId());

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

                        'linkurl' => 'javascript:Settings_Workflows_List_Js.setChangeStatusTasks(this,' . $this->getId() . ',true);',

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

                    ],

        Line exceeds 120 characters; contains 127 characters
        Open

                        'linkurl' => 'javascript:Settings_Workflows_List_Js.setChangeStatusTasks(this,' . $this->getId() . ', 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

                foreach (Settings_Workflows_TaskType_Model::getAllForModule($this->getModule()) as $taskType) {

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

            /**

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

             * Save record to database.

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

            {

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

                $wf->schtypeid = $this->get('schtypeid');

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

                $wf->schdayofmonth = $this->get('schdayofmonth');

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

                $wf->params = $this->get('params');

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

                $wm->save($wf);

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

                $recordLinks = [

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

             * Get module object.

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

            }

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

             * @param bool $active

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

             * Get task types array.

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

             * @return array

        Line exceeds 120 characters; contains 139 characters
        Open

                    $taskModel = Settings_Workflows_TaskRecord_Model::getCleanInstance($this, $taskType->get('classname'))->setTaskType($taskType);

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

             * Check if is default record.

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

             * Gets params value.

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

             * @return mixed

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

             */

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

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

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

                    if ($taskModel->isEditable()) {

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

            public function isDefault()

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

            {

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

             * Functions returns the Custom Entity Methods that are supported for a module.

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

                        'linktype' => 'LISTVIEWRECORD',

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

            /**

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

                        $taskTypes[] = $taskModel;

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

                return $taskTypes;

        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' => 'LISTVIEWRECORD',

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

                        'linktype' => 'LISTVIEWRECORD',

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

                    $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

        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

                $workflowModel = new self();

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

                $workflowModel->set('params', $wf->params);

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

                $workflowModel->setModule($wf->moduleName);

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

                return $workflowModel;

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

        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

                if (!$conditions) {

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

                }

        Line exceeds 120 characters; contains 136 characters
        Open

                            $secondGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['value'],

        Line exceeds 120 characters; contains 138 characters
        Open

                                'column_condition' => $info['joincondition'], 'valuetype' => $info['valuetype'], 'groupid' => $info['groupid'], ];

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

                }

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

                $transformedConditions[2] = ['columns' => $secondGroup ?? []];

        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 setModule($moduleName)

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

            /**

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

             *

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

                if (!empty($wf->defaultworkflow) && 1 == $wf->defaultworkflow) {

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

             * @param string|null $key

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

                        'linkurl' => 'javascript:Settings_Workflows_List_Js.setChangeStatusTasks(this,' . $this->getId() . ',true);',

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

                        'linkurl' => $this->getEditViewUrl(),

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

                        'class' => 'js-edit',

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

                        'linklabel' => 'LBL_DELETE_RECORD',

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

             * Get clean instance.

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

                $wf = $wm->newWorkflow($moduleName);

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

                $wf->params = null;

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

             * Get instance from workflow object.

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

                $workflowModel->set('module_name', $wf->moduleName);

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

             * @param int $executionCondition

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

             * Functions transforms workflow filter to advanced filter.

        Line exceeds 120 characters; contains 135 characters
        Open

                            $firstGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['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

            public function getFieldFilterValueType($fieldname)

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

            public function transformAdvanceFilterToWorkFlowFilter()

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

                return self::getInstanceFromWorkflowObject($wf);

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

                $workflowModel->set('workflow_id', $wf->id ?? 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

            public function executionConditionAsLabel($executionCondition = null)

        Line exceeds 120 characters; contains 148 characters
        Open

                $arr = ['ON_FIRST_SAVE', 'ONCE', 'ON_EVERY_SAVE', 'ON_MODIFY', 'ON_DELETE', 'ON_SCHEDULE', 'MANUAL', 'TRIGGER', 'BLOCK_EDIT', 'ON_RELATED'];

        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 transformToAdvancedFilterCondition($conditions = false)

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

                    foreach ($conditions as $filter) {

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

             */

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

                    [

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

             * @param int $workflowId

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

                $wf = $wm->retrieve($workflowId);

        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 object $wf

        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 (null === $executionCondition) {

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

                return $arr[$executionCondition - 1] ?? '';

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

                }

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

             *

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

                        }

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

             *

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

                $wm = new VTWorkflowManager();

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

            public static function getInstanceFromWorkflowObject($wf)

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

            {

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

                $workflowModel->set('summary', $wf->description ?? '');

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

                $workflowModel->setWorkflowObject($wf);

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

             *

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

                                'column_condition' => $info['joincondition'], 'valuetype' => $info['valuetype'], 'groupid' => $info['groupid'], ];

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

                        }

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

            }

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

             * @param string $moduleName

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

             *

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

            {

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

                            $firstGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['value'],

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

                $transformedConditions[1] = ['columns' => $firstGroup ?? []];

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

             * @param mixed $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 \Self

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

            public static function getInstance($workflowId)

        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

             * @param mixed $conditions

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

                            return $filter['valuetype'];

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

             * Function transforms Advance filter to workflow conditions.

        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

                    $executionCondition = $this->get('execution_condition');

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

             * Check if filter is saved in new.

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

                $wf = $this->getWorkflowObject();

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

                if ('6' == $wf->filtersavedinnew) {

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

                $transformedConditions = [];

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

                    foreach ($conditions as $info) {

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

                        if (!($info['groupid'])) {

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

             * @return string|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

                $conditions = $this->get('conditions');

        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

                        'linkurl' => 'javascript:Settings_Workflows_List_Js.deleteById(' . $this->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

             */

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

                    $conditions = $this->get('conditions');

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

                            $secondGroup[] = ['columnname' => $info['fieldname'], 'comparator' => $info['operation'], 'value' => $info['value'],

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

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

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

        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

                $wf->filtersavedinnew = 6;

        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 \self

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

                $workflowModel->set('filtersavedinnew', $wf->filtersavedinnew);

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

                        'linkicon' => 'yfi yfi-full-editing-view',

        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 execution condition label.

        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

                }

        Line exceeds 120 characters; contains 138 characters
        Open

                                'column_condition' => $info['joincondition'], 'valuetype' => $info['valuetype'], 'groupid' => $info['groupid'], ];

        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

                        if ($fieldname == $filter['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

                    foreach ($conditions as $index => $condition) {

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

                return (new \App\Db\Query())->select(['summary', 'task'])->from('com_vtiger_workflowtasks')->where(['workflow_id' => $this->getId()])->all();

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

            /**

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

                    $relationType = \Vtiger_Relation_Model::getInstanceById($relationId)->getRelationType();

        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

                $arr = ['ON_FIRST_SAVE', 'ONCE', 'ON_EVERY_SAVE', 'ON_MODIFY', 'ON_DELETE', 'ON_SCHEDULE', 'MANUAL', 'TRIGGER', 'BLOCK_EDIT', 'ON_RELATED'];

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

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

                                'column_condition' => $info['joincondition'], 'valuetype' => $info['valuetype'], 'groupid' => $info['groupid'], ];

        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

                                    'value' => $column['value'] ?? '', 'valuetype' => $column['valuetype'], 'joincondition' => $column['column_condition'],

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

                $wf = $this->getWorkflowObject();

        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

            public static function getAllAmountWorkflowsAmount()

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

             *

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

                    ->max('sequence') + 1;

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

            }

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

                        'linkicon' => 'fas fa-trash-alt',

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

                $wm = new VTWorkflowManager();

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

                return self::getInstanceFromWorkflowObject($wf);

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

            }

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

                $workflowModel->set('conditions', !empty($wf->test) ? \App\Json::decode($wf->test) : []);

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

                $workflowModel->set('execution_condition', $wf->executionCondition);

        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 ('1' == $index && empty($columns)) {

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

                                'joincondition' => '', 'groupid' => '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

                $this->set('conditions', $wfCondition);

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

             * Get next workflow action sequence number.

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

                    } elseif (\Vtiger_Relation_Model::RELATION_M2M === $relationType) {

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

                foreach ($recordLinks as $recordLink) {

        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 static function getCleanInstance(string $moduleName)

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

            public function isFilterSavedInNew()

        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

                return $transformedConditions;

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

             * Function returns valuetype of the field filter.

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

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

            }

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

                        $columns = $condition['columns'];

        Line exceeds 120 characters; contains 147 characters
        Open

                                    'value' => $column['value'] ?? '', 'valuetype' => $column['valuetype'], 'joincondition' => $column['column_condition'],

        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 (new \App\Db\Query())

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

                    ->from('com_vtiger_workflows')

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

                    ->where(['module_name' => $moduleName])

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

                }

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

            {

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

            public function getNextSequenceNumber(string $moduleName): int

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

                            $wfCondition[] = ['fieldname' => '', 'operation' => '', 'value' => '', 'valuetype' => '',

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

                                    'groupjoin' => $condition['condition'], 'groupid' => $column['groupid'], ];

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

            }

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

                $wm = new VTWorkflowManager();

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

             * Returns array of tasks for active workflow.

        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 (\Vtiger_Relation_Model::RELATION_O2M === $relationType) {

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

                        $moduleRelationsByType['LBL_ONE_TO_MANY_RELATIONS'][] = $relationInfo;

        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

            {

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

                if (\is_array($conditions)) {

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

                                $wfCondition[] = ['fieldname' => $column['columnname'], 'operation' => $column['comparator'],

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

             * Function to get number of workflow.

        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($columns) && \is_array($columns)) {

        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

                $moduleRelationsByType = [];

        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

                $conditions = $this->get('conditions');

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

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

            /**

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

                        $moduleRelationsByType['LBL_MANY_TO_MANY_RELATIONS'][] = $relationInfo;

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

                            foreach ($columns as $column) {

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

             * Get module relations by type.

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

                $moduleRelations = App\Relation::getByModule($this->getModule()->getName());

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

                        }

        Line exceeds 120 characters; contains 149 characters
        Open

                return (new \App\Db\Query())->select(['summary', 'task'])->from('com_vtiger_workflowtasks')->where(['workflow_id' => $this->getId()])->all();

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

                return (new App\Db\Query())->from('com_vtiger_workflows')->count();

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

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

                $wm->updateNexTriggerTime($wf);

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

                $wfCondition = [];

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

            public function updateNextTriggerTime()

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

             * @return array tasks

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

             * @param string $moduleName

        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

                foreach ($moduleRelations as $relationId => $relationInfo) {

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

                        $moduleRelationsByType['LBL_WORKFLOW_CUSTOM_RELATIONS'][] = $relationInfo;

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

        class Settings_Workflows_Record_Model extends Settings_Vtiger_Record_Model

        There are no issues that match your filters.

        Category
        Status