YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/SharingAccess/models/Rule.php

Summary

Maintainability
C
1 day
Test Coverage
F
51%

File Rule.php has 334 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Settings SharingAccess rule model class.
 *
 * @copyright YetiForce S.A.
Severity: Minor
Found in modules/Settings/SharingAccess/models/Rule.php - About 4 hrs to fix

    Settings_SharingAccess_Rule_Model has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Settings_SharingAccess_Rule_Model extends \App\Base
    {
        const RULE_TYPE_GROUPS = 'GRP';
        const RULE_TYPE_ROLE = 'ROLE';
        const RULE_TYPE_ROLE_AND_SUBORDINATES = 'RS';
    Severity: Minor
    Found in modules/Settings/SharingAccess/models/Rule.php - About 2 hrs to fix

      Method save has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function save()
          {
              $ruleId = $this->getId();
              $db = \App\Db::getInstance();
      
      
      Severity: Minor
      Found in modules/Settings/SharingAccess/models/Rule.php - About 1 hr to fix

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

        class Settings_SharingAccess_Rule_Model extends \App\Base

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

        Missing class import via use statement (line '409', column '18').
        Open

                $result = (new \App\Db\Query())->from('vtiger_datashare_module_rel')->where(['tabid' => $moduleModel->getId(), 'shareid' => $ruleId])->one();

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

                    $row = (new App\Db\Query())->from($tableName)->where(['shareid' => $this->getId()])

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

                $dataReader = (new App\Db\Query())->from('vtiger_datashare_module_rel')

        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 'Settings_SharingAccess_Module_Model' in method 'setModule'.
        Open

                $module = Settings_SharingAccess_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 'Settings_SharingAccess_RuleMember_Model' in method 'getRuleComponents'.
        Open

                        $qualifiedTargetId = Settings_SharingAccess_RuleMember_Model::getQualifiedId($targetMemberType, $row[$targetColumnName]);

        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_SharingAccess_RuleMember_Model' in method 'save'.
        Open

                $sourceIdComponents = Settings_SharingAccess_RuleMember_Model::getIdComponentsFromQualifiedId($sourceId);

        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_SharingAccess_RuleMember_Model' in method 'getRuleComponents'.
        Open

                        $qualifiedSourceId = Settings_SharingAccess_RuleMember_Model::getQualifiedId($sourceMemberType, $row[$sourceColumnName]);

        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_SharingAccess_RuleMember_Model' in method 'getRuleComponents'.
        Open

                        $this->rule_details['source_member'] = Settings_SharingAccess_RuleMember_Model::getInstance($qualifiedSourceId);

        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_SharingAccess_Module_Model' in method 'save'.
        Open

                Settings_SharingAccess_Module_Model::recalculateSharingRules();

        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_SharingAccess_Module_Model' in method 'delete'.
        Open

                Settings_SharingAccess_Module_Model::recalculateSharingRules();

        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_SharingAccess_RuleMember_Model' in method 'getRuleComponents'.
        Open

                        $this->rule_details['target_member'] = Settings_SharingAccess_RuleMember_Model::getInstance($qualifiedTargetId);

        StaticAccess

        Since: 1.4.0

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

        Example

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

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

        Avoid using static access to class 'Vtiger_Link_Model' in method '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\Db' in method 'save'.
        Open

                $db = \App\Db::getInstance();

        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_SharingAccess_RuleMember_Model' in method 'save'.
        Open

                $targetIdComponents = Settings_SharingAccess_RuleMember_Model::getIdComponentsFromQualifiedId($targetId);

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

                } else {
                    $relationTypeComponents = explode('::', $this->get('relationtype'));
                    $sourceType = $relationTypeComponents[0];
                    $targetType = $relationTypeComponents[1];
        
        

        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

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

                        $this->rule_details['permission'] = $row['permission'];

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

                        'source_id' => 'share_roleid',

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

                        'target_id' => 'to_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 "index.php?parent=Settings&module=Roles&view=Edit&record=" 4 times.
        Open

                    return 'index.php?parent=Settings&module=Roles&view=Edit&record=' . $sourceMemberDetails[1];

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

                        'source_id' => 'share_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 "source_id" 19 times.
        Open

                        'source_id' => 'share_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 "to_groupid" 4 times.
        Open

                        'target_id' => 'to_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 "share_roleandsubid" 4 times.
        Open

                        'source_id' => 'share_roleandsubid',

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

                        'target_id' => 'to_roleandsubid',

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

                        'table' => 'vtiger_datashare_grp2grp',

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

                        'source_id' => 'share_userid',

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

                        'tabid' => $this->getModule()->getId(),

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

                        'target_id' => 'to_userid',

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

                        'target_id' => 'to_roleid',

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

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

        Noncompliant Code Example

        With the default threshold of 3:

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

        Compliant Solution

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

        Exceptions

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

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

                    $db->createCommand()->insert('vtiger_datashare_module_rel', [

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

                    $relationTypeComponents = explode('::', $this->get('relationtype'));

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

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

        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.

        Reference to undeclared property \Settings_SharingAccess_Rule_Model->module (Did you mean $module)
        Open

                $this->module = $module;

        Argument 1 (qualifiedId) is string but \Settings_SharingAccess_RuleMember_Model::getInstance() takes int defined at /code/modules/Settings/SharingAccess/models/RuleMember.php:56
        Open

                        $this->rule_details['target_member'] = Settings_SharingAccess_RuleMember_Model::getInstance($qualifiedTargetId);

        Reference to undeclared property \Settings_SharingAccess_Rule_Model->rule_details
        Open

                        $this->rule_details['permission'] = $row['permission'];

        Reference to undeclared property \Settings_SharingAccess_Rule_Model->rule_details
        Open

                return $this->rule_details;

        Call to method getId on non-class type string
        Open

                return '?module=SharingAccess&parent=Settings&action=IndexAjax&mode=deleteRule&for_module=' . $this->getModule()->getId() . '&record=' . $this->getId();

        Returning type string but getTargetDetailViewUrl() is declared to return \DetailViewUrl
        Open

                    return 'index.php?parent=Settings&module=Groups&view=Detail&record=' . $targetMemberDetails[1];

        Return type of getTargetMemberName() is undeclared type \Name
        Open

            public function getTargetMemberName()

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

                $dataReader = (new App\Db\Query())->from('vtiger_datashare_module_rel')

        Call to method getId on non-class type string
        Open

                return '?module=SharingAccess&parent=Settings&view=IndexAjax&mode=editRule&for_module=' . $this->getModule()->getId() . '&record=' . $this->getId();

        Returning type string but getTargetDetailViewUrl() is declared to return \DetailViewUrl
        Open

                    return 'index.php?parent=Settings&module=Roles&view=Edit&record=' . $targetMemberDetails[1];

        Returning type string but getTargetMemberName() is declared to return \Name
        Open

                return $targetMemberDetails[0];

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

                $db->createCommand()->update('vtiger_datashare_module_rel', [

        Return type of getSourceMemberName() is undeclared type \Name
        Open

            public function getSourceMemberName()

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

                    $db->createCommand()->delete($tableColumnInfo['table'], ['shareid' => $ruleId])->execute();

        Reference to undeclared property \Settings_SharingAccess_Rule_Model->rule_details
        Open

                        $this->rule_details['target_member'] = Settings_SharingAccess_RuleMember_Model::getInstance($qualifiedTargetId);

        Returning type string but getSourceDetailViewUrl() is declared to return \DetailViewUrl
        Open

                    return 'index.php?parent=Settings&module=Roles&view=Edit&record=' . $sourceMemberDetails[1];

        Returning type string but getSourceMemberName() is declared to return \Name
        Open

                return $sourceMemberDetails[0];

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

                $db->createCommand()->insert($tableName, [

        Reference to undeclared property \Settings_SharingAccess_Rule_Model->rule_details
        Open

                if (!isset($this->rule_details) && $this->getId()) {

        Reference to undeclared property \Settings_SharingAccess_Rule_Model->rule_details
        Open

                        $this->rule_details['source_member'] = Settings_SharingAccess_RuleMember_Model::getInstance($qualifiedSourceId);

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

                    $row = (new App\Db\Query())->from($tableName)->where(['shareid' => $this->getId()])

        Returning type \Settings_SharingAccess_Rule_Model but getInstance() is declared to return array
        Open

                    return $ruleModel->setData($result)->setModuleFromInstance($moduleModel);

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

                return false;

        Argument 1 (qualifiedId) is string but \Settings_SharingAccess_RuleMember_Model::getInstance() takes int defined at /code/modules/Settings/SharingAccess/models/RuleMember.php:56
        Open

                        $this->rule_details['source_member'] = Settings_SharingAccess_RuleMember_Model::getInstance($qualifiedSourceId);

        Return type of getTargetDetailViewUrl() is undeclared type \DetailViewUrl
        Open

            public function getTargetDetailViewUrl()

        Returning type string but getTargetDetailViewUrl() is declared to return \DetailViewUrl
        Open

                    return 'index.php?parent=Settings&module=Roles&view=Edit&record=' . $targetMemberDetails[1];

        Saw unextractable annotation for comment '* @return <number> Id'</number>
        Open

             * @return <Number> Id

        Reference to undeclared property \Settings_SharingAccess_Rule_Model->module (Did you mean $module)
        Open

                $this->module = $module;

        Return type of getSourceDetailViewUrl() is undeclared type \DetailViewUrl
        Open

            public function getSourceDetailViewUrl()

        Call to method getId on non-class type string
        Open

                        'tabid' => $this->getModule()->getId(),

        Reference to undeclared property \Settings_SharingAccess_Rule_Model->module
        Open

                return $this->module;

        Returning type string but getSourceDetailViewUrl() is declared to return \DetailViewUrl
        Open

                    return 'index.php?parent=Settings&module=Groups&view=Detail&record=' . $sourceMemberDetails[1];

        Returning type string but getSourceDetailViewUrl() is declared to return \DetailViewUrl
        Open

                    return 'index.php?parent=Settings&module=Roles&view=Edit&record=' . $sourceMemberDetails[1];

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

                    $db->createCommand()->insert('vtiger_datashare_module_rel', [

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

                $dbCommand = App\Db::getInstance()->createCommand();

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

                $result = (new \App\Db\Query())->from('vtiger_datashare_module_rel')->where(['tabid' => $moduleModel->getId(), 'shareid' => $ruleId])->one();

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

                self::RULE_TYPE_GROUPS => [
                    self::RULE_TYPE_GROUPS => [
                        'table' => 'vtiger_datashare_grp2grp',
                        'source_id' => 'share_groupid',
                        'target_id' => 'to_groupid',
        Severity: Major
        Found in modules/Settings/SharingAccess/models/Rule.php and 3 other locations - About 1 hr to fix
        modules/Settings/SharingAccess/models/Rule.php on lines 54..75
        modules/Settings/SharingAccess/models/Rule.php on lines 76..97
        modules/Settings/SharingAccess/models/Rule.php on lines 98..119

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

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

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

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

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

        Refactorings

        Further Reading

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

                self::RULE_TYPE_ROLE_AND_SUBORDINATES => [
                    self::RULE_TYPE_GROUPS => [
                        'table' => 'vtiger_datashare_rs2grp',
                        'source_id' => 'share_roleandsubid',
                        'target_id' => 'to_groupid',
        Severity: Major
        Found in modules/Settings/SharingAccess/models/Rule.php and 3 other locations - About 1 hr to fix
        modules/Settings/SharingAccess/models/Rule.php on lines 32..53
        modules/Settings/SharingAccess/models/Rule.php on lines 54..75
        modules/Settings/SharingAccess/models/Rule.php on lines 76..97

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

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

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

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

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

        Refactorings

        Further Reading

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

                self::RULE_TYPE_USERS => [
                    self::RULE_TYPE_GROUPS => [
                        'table' => 'vtiger_datashare_us2grp',
                        'source_id' => 'share_userid',
                        'target_id' => 'to_groupid',
        Severity: Major
        Found in modules/Settings/SharingAccess/models/Rule.php and 3 other locations - About 1 hr to fix
        modules/Settings/SharingAccess/models/Rule.php on lines 32..53
        modules/Settings/SharingAccess/models/Rule.php on lines 76..97
        modules/Settings/SharingAccess/models/Rule.php on lines 98..119

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

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

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

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

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

        Refactorings

        Further Reading

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

                self::RULE_TYPE_ROLE => [
                    self::RULE_TYPE_GROUPS => [
                        'table' => 'vtiger_datashare_role2group',
                        'source_id' => 'share_roleid',
                        'target_id' => 'to_groupid',
        Severity: Major
        Found in modules/Settings/SharingAccess/models/Rule.php and 3 other locations - About 1 hr to fix
        modules/Settings/SharingAccess/models/Rule.php on lines 32..53
        modules/Settings/SharingAccess/models/Rule.php on lines 54..75
        modules/Settings/SharingAccess/models/Rule.php on lines 98..119

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

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

                    $relationTypeComponents = explode('::', $this->get('relationtype'));

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

                    $relationTypeComponents = explode('::', $this->get('relationtype'));

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

                $relationTypeComponents = explode('::', $this->get('relationtype'));

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

            public static $ruleMemberToRelationMapping = [
                self::RULE_TYPE_GROUPS => Settings_SharingAccess_RuleMember_Model::RULE_MEMBER_TYPE_GROUPS,
                self::RULE_TYPE_ROLE => Settings_SharingAccess_RuleMember_Model::RULE_MEMBER_TYPE_ROLES,
                self::RULE_TYPE_ROLE_AND_SUBORDINATES => Settings_SharingAccess_RuleMember_Model::RULE_MEMBER_TYPE_ROLE_AND_SUBORDINATES,
                self::RULE_TYPE_USERS => Settings_SharingAccess_RuleMember_Model::RULE_MEMBER_TYPE_USERS,

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

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

                $db = \App\Db::getInstance();

        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_SharingAccess_Rule_Model is not named in CamelCase.
        Open

        class Settings_SharingAccess_Rule_Model extends \App\Base
        {
            const RULE_TYPE_GROUPS = 'GRP';
            const RULE_TYPE_ROLE = 'ROLE';
            const RULE_TYPE_ROLE_AND_SUBORDINATES = 'RS';

        CamelCaseClassName

        Since: 0.2

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

        Example

        class class_name {
        }

        Source

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

                self::RULE_TYPE_ROLE_AND_SUBORDINATES => Settings_SharingAccess_RuleMember_Model::RULE_MEMBER_TYPE_ROLE_AND_SUBORDINATES,

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

                        'source_id' => 'share_groupid',

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

            const READ_WRITE_PERMISSION = 1;

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

                self::RULE_TYPE_GROUPS => Settings_SharingAccess_RuleMember_Model::RULE_MEMBER_TYPE_GROUPS,

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

            public static $allPermissions = [

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

            public static $dataShareTableColArr = [

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

                self::RULE_TYPE_GROUPS => [

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

                        'target_id' => 'to_roleandsubid',

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

                    ],

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

                        'table' => 'vtiger_datashare_role2rs',

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

                    self::RULE_TYPE_ROLE => [

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

                        'source_id' => 'share_roleandsubid',

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

                $module = Settings_SharingAccess_Module_Model::getInstance($moduleName);

        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

            public function setModuleFromInstance($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

                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

            const RULE_TYPE_USERS = 'US';

        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 $ruleMemberToRelationMapping = [

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

                self::RULE_TYPE_ROLE => Settings_SharingAccess_RuleMember_Model::RULE_MEMBER_TYPE_ROLES,

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

                    self::RULE_TYPE_USERS => [

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

                        'source_id' => 'share_roleid',

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

                self::RULE_TYPE_ROLE_AND_SUBORDINATES => [

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

                        'target_id' => 'to_roleid',

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

            {

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

            /**

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

            {

        Line exceeds 120 characters; contains 128 characters
        Open

                        $this->rule_details['source_member'] = Settings_SharingAccess_RuleMember_Model::getInstance($qualifiedSourceId);

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

                }

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

                self::READ_ONLY_PERMISSION => 'Read Only',

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

                        'target_id' => 'to_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

                    $row = (new App\Db\Query())->from($tableName)->where(['shareid' => $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

                self::RULE_TYPE_USERS => Settings_SharingAccess_RuleMember_Model::RULE_MEMBER_TYPE_USERS,

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

                        'table' => 'vtiger_datashare_grp2grp',

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

                        'table' => 'vtiger_datashare_grp2rs',

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

                        'table' => 'vtiger_datashare_us2grp',

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

                    self::RULE_TYPE_ROLE_AND_SUBORDINATES => [

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

                        'target_id' => 'to_groupid',

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

                    self::RULE_TYPE_USERS => [

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

                        'target_id' => 'to_roleandsubid',

        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

            }

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

             * Function to get the Group Name.

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

                    if ($row) {

        Line exceeds 120 characters; contains 137 characters
        Open

                        $qualifiedTargetId = Settings_SharingAccess_RuleMember_Model::getQualifiedId($targetMemberType, $row[$targetColumnName]);

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

                self::READ_WRITE_PERMISSION => 'Read Write',

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

                    ],

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

                        'table' => 'vtiger_datashare_grp2role',

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

                        'target_id' => 'to_roleid',

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

                    self::RULE_TYPE_USERS => [

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

                        'table' => 'vtiger_datashare_role2us',

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

                        'target_id' => 'to_userid',

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

                        'table' => 'vtiger_datashare_rs2rs',

        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

                    $targetType = $relationTypeComponents[1];

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

                        $qualifiedSourceId = Settings_SharingAccess_RuleMember_Model::getQualifiedId($sourceMemberType, $row[$sourceColumnName]);

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

                }

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

            const RULE_TYPE_ROLE = 'ROLE';

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

            const RULE_TYPE_ROLE_AND_SUBORDINATES = 'RS';

        Line exceeds 120 characters; contains 129 characters
        Open

                self::RULE_TYPE_ROLE_AND_SUBORDINATES => Settings_SharingAccess_RuleMember_Model::RULE_MEMBER_TYPE_ROLE_AND_SUBORDINATES,

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

                        'target_id' => 'to_groupid',

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

                    self::RULE_TYPE_GROUPS => [

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

                        'table' => 'vtiger_datashare_us2us',

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

                        'target_id' => 'to_userid',

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

                        'table' => 'vtiger_datashare_us2role',

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

                self::RULE_TYPE_ROLE => [

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

                        'target_id' => 'to_roleid',

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

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

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

             * @return string

        Line exceeds 120 characters; contains 137 characters
        Open

                        $qualifiedSourceId = Settings_SharingAccess_RuleMember_Model::getQualifiedId($sourceMemberType, $row[$sourceColumnName]);

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

                        $this->rule_details['target_member'] = Settings_SharingAccess_RuleMember_Model::getInstance($qualifiedTargetId);

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

                if ($this->getId()) {

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

                        'source_id' => 'share_userid',

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

                    ],

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

                        'source_id' => 'share_roleid',

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

                    ],

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

             * Function to get rules.

        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

                    $relationTypeComponents = explode('::', $this->get('relationtype'));

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

                    $targetColumnName = $tableColumnInfo['target_id'];

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

                        $this->rule_details['source_member'] = Settings_SharingAccess_RuleMember_Model::getInstance($qualifiedSourceId);

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

            const RULE_TYPE_GROUPS = 'GRP';

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

            const READ_ONLY_PERMISSION = 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

                    self::RULE_TYPE_GROUPS => [

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

                    self::RULE_TYPE_ROLE_AND_SUBORDINATES => [

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

                self::RULE_TYPE_USERS => [

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

                    ],

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

                    self::RULE_TYPE_ROLE => [

        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

                $this->module = $module;

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

                    $sourceColumnName = $tableColumnInfo['source_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

                        'source_id' => 'share_userid',

        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

                    self::RULE_TYPE_USERS => [

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

                        'table' => 'vtiger_datashare_rs2role',

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

                    ],

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

             * Function to get the Id of the Sharing Access Rule.

        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

                        $qualifiedTargetId = Settings_SharingAccess_RuleMember_Model::getQualifiedId($targetMemberType, $row[$targetColumnName]);

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

                        'source_id' => 'share_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

                        'source_id' => 'share_userid',

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

                        'table' => 'vtiger_datashare_role2role',

        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

            protected function getRuleComponents()

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

                    $tableColumnInfo = self::$dataShareTableColArr[$sourceType][$targetType];

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

                    self::RULE_TYPE_ROLE => [

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

                ],

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

                        'table' => 'vtiger_datashare_us2rs',

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

                        'target_id' => 'to_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

                $this->module = $module;

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

                        ->one();

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

                return $this->rule_details;

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

            public function getSourceMember()

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

                        'source_id' => 'share_groupid',

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

                    self::RULE_TYPE_GROUPS => [

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

                        'source_id' => 'share_roleid',

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

                        'target_id' => 'to_userid',

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

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

                    $sourceType = $relationTypeComponents[0];

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

                        $targetMemberType = self::$ruleMemberToRelationMapping[$targetType];

        Line exceeds 120 characters; contains 128 characters
        Open

                        $this->rule_details['target_member'] = Settings_SharingAccess_RuleMember_Model::getInstance($qualifiedTargetId);

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

                        'table' => 'vtiger_datashare_grp2us',

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

                        'target_id' => 'to_roleid',

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

                        'target_id' => 'to_roleandsubid',

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

            {

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

                    $tableName = $tableColumnInfo['table'];

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

                        $sourceMemberType = self::$ruleMemberToRelationMapping[$sourceType];

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

                        'source_id' => 'share_groupid',

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

                        'target_id' => 'to_userid',

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

                    ],

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

                        'target_id' => 'to_roleandsubid',

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

                        'table' => 'vtiger_datashare_role2group',

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

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

                if (!isset($this->rule_details) && $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

                    $ruleComponents = $this->getRuleComponents();

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

                        'source_id' => 'share_userid',

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

                ],

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

                        'source_id' => 'share_roleid',

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

                    self::RULE_TYPE_GROUPS => [

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

                        'table' => 'vtiger_datashare_rs2us',

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

                        'source_id' => 'share_roleandsubid',

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

                    self::RULE_TYPE_ROLE_AND_SUBORDINATES => [

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

                return false;

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

                }

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

            {

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

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

             * @return DetailViewUrl

        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

                    self::RULE_TYPE_ROLE => [

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

                    self::RULE_TYPE_ROLE_AND_SUBORDINATES => [

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

                        'table' => 'vtiger_datashare_rs2grp',

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

                        'source_id' => 'share_roleandsubid',

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

                    ],

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

                        'source_id' => 'share_roleandsubid',

        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->rule_details['permission'] = $row['permission'];

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

                    return $ruleComponents['source_member'];

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

            }

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

                    $ruleComponents = $this->getRuleComponents();

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

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

                if ($this->getId()) {

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

                    return self::READ_ONLY_PERMISSION == $permission;

        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 $targetMemberDetails[0];

        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

                foreach ($recordLinks as $recordLink) {

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

                return false;

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

            {

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

                return false;

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

                    $permission = $this->getPermission();

        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 'index.php?parent=Settings&module=Roles&view=Edit&record=' . $targetMemberDetails[1];

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

                $targetMember = $this->getTargetMember()->getId();

        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

            {

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

                    $tableColumnInfo = self::$dataShareTableColArr[$sourceType][$targetType];

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

                return false;

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

            {

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

            public function isReadWrite()

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

                if ($this->getId()) {

        Line exceeds 120 characters; contains 160 characters
        Open

                return '?module=SharingAccess&parent=Settings&action=IndexAjax&mode=deleteRule&for_module=' . $this->getModule()->getId() . '&record=' . $this->getId();

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

                $sourceMemberDetails = explode(':', $sourceMember);

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

                    return 'index.php?parent=Settings&module=Groups&view=Detail&record=' . $sourceMemberDetails[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

            public function save()

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

                    $ruleId = $db->getLastInsertID('vtiger_datashare_module_rel_shareid_seq');

        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?parent=Settings&module=Roles&view=Edit&record=' . $sourceMemberDetails[1];

        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

                        'linkurl' => 'javascript:app.showModalWindow(null, "' . $this->getEditViewUrl() . '");',

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

                $sourceId = $this->get('source_id');

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

                if ($this->getId()) {

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

                    $permission = $this->getPermission();

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

            }

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

            }

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

             * Function to get the detailViewUrl for the rule member in Sharing Access Custom Rules.

        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

                $recordLinks = [

        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

                } else {

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

                    $relationTypeComponents = explode('::', $this->get('relationtype'));

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

                $sourceType = array_search($sourceIdComponents[0], self::$ruleMemberToRelationMapping);

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

                $targetId = $this->get('target_id');

        Line exceeds 120 characters; contains 156 characters
        Open

                return '?module=SharingAccess&parent=Settings&view=IndexAjax&mode=editRule&for_module=' . $this->getModule()->getId() . '&record=' . $this->getId();

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

             * @return DetailViewUrl

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

                if ('Groups' == $targetMemberDetails[0]) {

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

             * @return Name of the rule Member

        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

                $db = \App\Db::getInstance();

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

                if ($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

            public function getPermission()

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

            public function getTargetDetailViewUrl()

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

                $targetMemberDetails = explode(':', $targetMember);

        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

                        'tabid' => $this->getModule()->getId(),

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

                    $this->set('shareid', $ruleId);

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

                $targetType = array_search($targetIdComponents[0], self::$ruleMemberToRelationMapping);

        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?parent=Settings&module=Groups&view=Detail&record=' . $targetMemberDetails[1];

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

                $ruleId = $this->getId();

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

                if (!$ruleId) {

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

                    'permission' => $this->get('permission'),

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

            {

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

            {

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

                }

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

             * Function to get the detailViewUrl for the rule member in Sharing Access Custom Rules.

        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 ('Roles' === $sourceMemberDetails[0]) {

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

                if ('RoleAndSubordinates' === $sourceMemberDetails[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

             * Function to get the Member Name from the Rule Model.

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

             * @return Name of the rule Member

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

            public function getTargetMemberName()

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

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

                $sourceIdComponents = Settings_SharingAccess_RuleMember_Model::getIdComponentsFromQualifiedId($sourceId);

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

                $db->createCommand()->insert($tableName, [

        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 $ruleComponents['target_member'];

        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

            public function getSourceDetailViewUrl()

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

                return '?module=SharingAccess&parent=Settings&view=IndexAjax&mode=editRule&for_module=' . $this->getModule()->getId() . '&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

                $sourceMember = $this->getSourceMember()->getId();

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

                    return 'index.php?parent=Settings&module=Roles&view=Edit&record=' . $sourceMemberDetails[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

                $targetMember = $this->getTargetMember()->getId();

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

                return $sourceMemberDetails[0];

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

                    return 'index.php?parent=Settings&module=Roles&view=Edit&record=' . $targetMemberDetails[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' => 'yfi yfi-full-editing-view',

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

                    $db->createCommand()->delete($tableColumnInfo['table'], ['shareid' => $ruleId])->execute();

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

                $targetIdComponents = Settings_SharingAccess_RuleMember_Model::getIdComponentsFromQualifiedId($targetId);

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

                    $db->createCommand()->insert('vtiger_datashare_module_rel', [

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

                $tableColumnName = self::$dataShareTableColArr[$sourceType][$targetType];

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

                }

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

             * Delete the rule.

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

                    ->where(['tabid' => $moduleModel->getId()])

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

                Settings_SharingAccess_Module_Model::recalculateSharingRules();

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

            }

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

                    $ruleModels[$row['shareid']] = $ruleModel->setData($row)->setModuleFromInstance($moduleModel);

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

            }

        Line exceeds 120 characters; contains 149 characters
        Open

                $result = (new \App\Db\Query())->from('vtiger_datashare_module_rel')->where(['tabid' => $moduleModel->getId(), 'shareid' => $ruleId])->one();

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

                if ($result) {

        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::READ_WRITE_PERMISSION == $permission;

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

                return '?module=SharingAccess&parent=Settings&action=IndexAjax&mode=deleteRule&for_module=' . $this->getModule()->getId() . '&record=' . $this->getId();

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

                if ('RoleAndSubordinates' == $targetMemberDetails[0]) {

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

            public function getSourceMemberName()

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

                $sourceMemberDetails = explode(':', $sourceMember);

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

            {

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

                    $targetType = $relationTypeComponents[1];

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

                $db->createCommand()->update('vtiger_datashare_module_rel', [

        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

            /**

        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 mixed $moduleModel

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

                $ruleModels = [];

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

                return $ruleModels;

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

                    'relationtype' => $this->get('relationtype'),

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

            }

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

                $dbCommand->delete('vtiger_datashare_module_rel', ['shareid' => $ruleId])->execute();

        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

                    ->createCommand()->query();

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

                    $ruleModel = new self();

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

            public function getTargetMember()

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

                    $ruleComponents = $this->getRuleComponents();

        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 ('Groups' === $sourceMemberDetails[0]) {

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

                }

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

                }

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

            public function getRecordLinks(): 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

                        'linklabel' => 'LBL_EDIT_RECORD',

        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

                    ])->execute();

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

                $targetColumnName = $tableColumnName['target_id'];

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

                $relationTypeComponents = explode('::', $this->get('relationtype'));

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

                Settings_SharingAccess_Module_Model::recalculateSharingRules();

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

                    $ruleModel = new self();

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

                return false;

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

             */

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

                $dataReader = (new App\Db\Query())->from('vtiger_datashare_module_rel')

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

            public static function getInstance($moduleModel, $ruleId)

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

                $dataReader->close();

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

             * @param mixed $ruleId

        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

                while ($row = $dataReader->read()) {

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

             * @param mixed $moduleModel

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

             * @return array - Array of Settings_Groups_Record_Model instances

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

                    return $ruleModel->setData($result)->setModuleFromInstance($moduleModel);

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

             * @return Settings_Groups_Record_Model[]

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

                ])->execute();

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

                $ruleId = $this->getId();

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

            public static function getAllByModule($moduleModel)

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

                    return $ruleComponents['permission'];

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

                return false;

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

             */

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

                if ('Roles' == $targetMemberDetails[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

                $sourceMember = $this->getSourceMember()->getId();

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

             * Function to get the Member Name from the Rule 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

                $targetMemberDetails = explode(':', $targetMember);

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

                        'linkurl' => 'javascript:app.showModalWindow(null, "' . $this->getDeleteActionUrl() . '");',

        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[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

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

                    $sourceType = $relationTypeComponents[0];

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

                $sourceColumnName = $tableColumnName['source_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

                    'shareid' => $ruleId,

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

                ], ['shareid' => $ruleId])->execute();

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

             *

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

                $tableName = $tableColumnName['table'];

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

                $dbCommand = App\Db::getInstance()->createCommand();

        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('relationtype', implode('::', [$sourceType, $targetType]));

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

                    $targetColumnName => $targetIdComponents[1],

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

                $tableColumnInfo = self::$dataShareTableColArr[$relationTypeComponents[0]][$relationTypeComponents[1]];

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

                $dbCommand->delete($tableColumnInfo['table'], ['shareid' => $ruleId])->execute();

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

             * Function to get all the rules.

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

            {

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

                    $sourceColumnName => $sourceIdComponents[1],

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

             * Function to get all the rules.

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

                $result = (new \App\Db\Query())->from('vtiger_datashare_module_rel')->where(['tabid' => $moduleModel->getId(), 'shareid' => $ruleId])->one();

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

                }

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

        class Settings_SharingAccess_Rule_Model extends \App\Base

        There are no issues that match your filters.

        Category
        Status