YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
2 hrs
Test Coverage
F
52%

Method verifyDashboard has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function verifyDashboard($moduleName)
    {
        \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ')');
        $currentUser = Users_Record_Model::getCurrentUserModel();
        $blockId = Settings_WidgetsManagement_Module_Model::getBlocksFromModule($moduleName, $currentUser->getRole(), $this->get('dashboardId'));
Severity: Minor
Found in modules/Vtiger/models/DashBoard.php - About 1 hr to fix

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

        public function verifyDashboard($moduleName)
        {
            \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ')');
            $currentUser = Users_Record_Model::getCurrentUserModel();
            $blockId = Settings_WidgetsManagement_Module_Model::getBlocksFromModule($moduleName, $currentUser->getRole(), $this->get('dashboardId'));
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php - About 35 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

                if (!(new App\Db\Query())->from('vtiger_module_dashboard_widgets')
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    MissingImport

    Since: 2.7.0

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

    Example

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

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

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

            $query = (new \App\Db\Query())->select(['vtiger_module_dashboard_widgets.module', 'vtiger_module_dashboard_blocks.tabid'])
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    MissingImport

    Since: 2.7.0

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

    Example

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

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

    Missing class import via use statement (line '116', column '22').
    Open

            $dataReader = (new App\Db\Query())
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    MissingImport

    Since: 2.7.0

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

    Example

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

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

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

            $query = (new \App\Db\Query())->select(['vtiger_links.*', 'mdw.userid', 'mdw.data', 'mdw.active', 'mdw.title', 'mdw.size', 'mdw.filterid',
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    MissingImport

    Since: 2.7.0

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

    Example

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

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

    Avoid using static access to class 'Vtiger_Loader' in method 'getInstance'.
    Open

            $modelClassName = Vtiger_Loader::getComponentClassName('Model', 'DashBoard', $moduleName);
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                \App\Log::trace('Exiting ' . __METHOD__);
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'Settings_WidgetsManagement_Module_Model' in method 'verifyDashboard'.
    Open

            $blockId = Settings_WidgetsManagement_Module_Model::getBlocksFromModule($moduleName, $currentUser->getRole(), $this->get('dashboardId'));
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

        public static function getModulesWithWidgets($moduleName, $dashboard)
        {
            $currentUser = Users_Privileges_Model::getCurrentUserModel();
    
            $query = (new \App\Db\Query())->select(['vtiger_module_dashboard_widgets.module', 'vtiger_module_dashboard_blocks.tabid'])
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    IfStatementAssignment

    Since: 2.7.0

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

    Example

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

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

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

            $userPrivModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            $currentUser = Users_Privileges_Model::getCurrentUserModel();
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'Vtiger_Widget_Model' in method 'getDashboards'.
    Open

                $widget = Vtiger_Widget_Model::getInstanceFromValues($row);
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ')');
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'Vtiger_Widget_Model' in method 'verifyDashboard'.
    Open

                $widget = Vtiger_Widget_Model::getInstanceFromValues($row);
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            \App\Log::trace('Exiting ' . __METHOD__);
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Module' in method 'getModulesWithWidgets'.
    Open

                    $modules[$tabId] = \App\Module::getModuleName($tabId);
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            $currentUser = Users_Record_Model::getCurrentUserModel();
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Module' in method 'getModulesWithWidgets'.
    Open

            if ($moduleName && ($tabId = \App\Module::getModuleId($moduleName))) {
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Define a constant instead of duplicating this literal "linkid" 3 times.
    Open

                $row['linkid'] = $row['id'];
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

    Define a constant instead of duplicating this literal "isdefault" 3 times.
    Open

                    $active = $row['isdefault'] ? 1 : 0;
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

    Define a constant instead of duplicating this literal "userid" 3 times.
    Open

                    ->where(['userid' => $currentUser->getId(), 'templateid' => $row['id']])
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

    Define a constant instead of duplicating this literal "vtiger_module_dashboard_widgets" 3 times.
    Open

                if (!(new App\Db\Query())->from('vtiger_module_dashboard_widgets')
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

    Define a constant instead of duplicating this literal "dashboardId" 3 times.
    Open

                ->where(['mdw.userid' => $userPrivModel->getId(), 'vtiger_links.linktype' => 'DASHBOARDWIDGET', 'mdw.module' => $moduleModel->getId(), 'active' => $action, 'mdw.dashboardid' => $this->get('dashboardId')]);
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

    Define a constant instead of duplicating this literal "owners" 4 times.
    Open

                $row['owners'] = htmlspecialchars_decode($row['owners'] ?? '');
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

            $query = (new \App\Db\Query())->select(['vtiger_links.*', 'mdw.userid', 'mdw.data', 'mdw.active', 'mdw.title', 'mdw.size', 'mdw.filterid',
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by phan

    Return type of getDefaultWidgets() is undeclared type \Vtiger_Widget_Model[]
    Open

        public function getDefaultWidgets()
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phan

    Call to method getInstanceFromValues from undeclared class \Vtiger_Widget_Model
    Open

                $widget = Vtiger_Widget_Model::getInstanceFromValues($row);
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by phan

    Call to method getInstanceFromValues from undeclared class \Vtiger_Widget_Model
    Open

                $widget = Vtiger_Widget_Model::getInstanceFromValues($row);
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by phan

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

                if (!(new App\Db\Query())->from('vtiger_module_dashboard_widgets')
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by phan

    Reference to undeclared property \Vtiger_DashBoard_Model->module
    Open

            return $this->module;
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phan

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

                    App\Db::getInstance()->createCommand()->insert('vtiger_module_dashboard_widgets', [
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by phan

    Return type of setModule() is undeclared type \Vtiger_DetailView_Model
    Open

        public function setModule($moduleInstance)
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phan

    Reference to undeclared property \Vtiger_DashBoard_Model->module
    Open

            $this->module = $moduleInstance;
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phan

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

                \App\Log::trace('Exiting ' . __METHOD__);
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by phan

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

            $dataReader = (new App\Db\Query())
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by phan

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

            $query = (new \App\Db\Query())->select(['vtiger_module_dashboard_widgets.module', 'vtiger_module_dashboard_blocks.tabid'])
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by phan

    Return type of getDashboards() is undeclared type \Vtiger_Widget_Model[]
    Open

        public function getDashboards(int $action = 1)
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phan

    Saw unextractable annotation for comment '* @return <array> $modules'</array>
    Open

         * @return <Array> $modules
    Severity: Info
    Found in modules/Vtiger/models/DashBoard.php by phan

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

            \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ')');
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by phan

    Returning type \Vtiger_DashBoard_Model but setModule() is declared to return \Vtiger_DetailView_Model
    Open

            return $this;
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phan

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

            \App\Log::trace('Exiting ' . __METHOD__);
    Severity: Critical
    Found in modules/Vtiger/models/DashBoard.php by phan

    Each class must be in a namespace of at least one level (a top-level vendor name)
    Open

    class Vtiger_DashBoard_Model extends \App\Base

    The class Vtiger_DashBoard_Model is not named in CamelCase.
    Open

    class Vtiger_DashBoard_Model extends \App\Base
    {
        /**
         * Get widget special.
         *
    Severity: Minor
    Found in modules/Vtiger/models/DashBoard.php by phpmd

    CamelCaseClassName

    Since: 0.2

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

    Example

    class class_name {
    }

    Source

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

        {

    Line exceeds 120 characters; contains 146 characters
    Open

            $query = (new \App\Db\Query())->select(['vtiger_links.*', 'mdw.userid', 'mdw.data', 'mdw.active', 'mdw.title', 'mdw.size', 'mdw.filterid',

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

         */

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

            \App\Log::trace('Entering ' . __METHOD__ . '(' . $moduleName . ')');

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

                $row['owners'] = htmlspecialchars_decode($row['owners'] ?? '');

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

                }

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

            ksort($modules);

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

         */

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

                ->leftJoin('vtiger_module_dashboard_widgets mdw', 'vtiger_links.linkid = mdw.linkid')

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

                if ($widget->isViewable()) {

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

        {

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

         * @return Vtiger_DashBoard_Model

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

            return $instance->setModule($moduleModel);

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

        /**

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

                ->orWhere(['authorized' => $currentUser->getRole()])

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

                    $modules[$tabId] = \App\Module::getModuleName($tabId);

    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 returns List of User's selected Dashboard Widgets.

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

         */

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

            $query = (new \App\Db\Query())->select(['vtiger_links.*', 'mdw.userid', 'mdw.data', 'mdw.active', 'mdw.title', 'mdw.size', 'mdw.filterid',

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

            return [];

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

         *

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

                ->where(['vtiger_module_dashboard.blockid' => $blockId])

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

                $row['size'] = htmlspecialchars_decode($row['size']) ?? '';

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

                        'title' => $row['title'],

    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 Vtiger_Module_Model $moduleInstance - module model

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

            $moduleModel = $this->getModule();

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

            return $widgets;

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

                    continue;

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

                    $active = $row['isdefault'] ? 1 : 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

            $instance = new $modelClassName();

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

         */

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

        {

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

                    $widgets[] = $widget;

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

                        'module' => $row['tabid'],

    Line exceeds 120 characters; contains 130 characters
    Open

            $query = (new \App\Db\Query())->select(['vtiger_module_dashboard_widgets.module', 'vtiger_module_dashboard_blocks.tabid'])

    Line exceeds 120 characters; contains 127 characters
    Open

                ->leftJoin('vtiger_module_dashboard_blocks', 'vtiger_module_dashboard_blocks.id = vtiger_module_dashboard.blockid')

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

                ->leftJoin('vtiger_module_dashboard_widgets', 'vtiger_module_dashboard_widgets.templateid = vtiger_module_dashboard.id')

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

            $dataReader = $query->createCommand()->query();

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

                if (!isset($modules[$tabId])) {

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

         * Get widget special.

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

         * @return Vtiger_Module_Model

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

        }

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

         * @return Vtiger_Widget_Model[]

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

                'widgetid' => 'mdw.id', 'mdw.position', 'id' => 'vtiger_links.linkid', 'mdw.limit', 'mdw.cache', 'mdw.owners', 'mdw.isdefault', 'mdw.module'])

    Line exceeds 120 characters; contains 154 characters
    Open

                'widgetid' => 'mdw.id', 'mdw.position', 'id' => 'vtiger_links.linkid', 'mdw.limit', 'mdw.cache', 'mdw.owners', 'mdw.isdefault', 'mdw.module'])

    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

                }

    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

                ->from('vtiger_module_dashboard')

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

                        'size' => $row['size'],

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

         *

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

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

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

         *

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

         * @param string $moduleName - module name

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

         * @param mixed  $dashboard

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

        {

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

                ->where(['userid' => $currentUser->getId(), 'vtiger_module_dashboard_widgets.dashboardid' => $dashboard])

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

            return ['ChartFilter', 'MiniList', 'Notebook', 'Rss', 'Multifilter', 'Multifilter', 'UpcomingEvents'];

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

         * Function to get Module instance.

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

        public function setModule($moduleInstance)

    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 getDashboards(int $action = 1)

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

        {

    Line exceeds 120 characters; contains 217 characters
    Open

                ->where(['mdw.userid' => $userPrivModel->getId(), 'vtiger_links.linktype' => 'DASHBOARDWIDGET', 'mdw.module' => $moduleModel->getId(), 'active' => $action, 'mdw.dashboardid' => $this->get('dashboardId')]);

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

                $row['linkid'] = $row['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

         * @param string $moduleName

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

                return;

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

                    ->where(['userid' => $currentUser->getId(), 'templateid' => $row['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

            $query = (new \App\Db\Query())->select(['vtiger_module_dashboard_widgets.module', 'vtiger_module_dashboard_blocks.tabid'])

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

                ->from('vtiger_module_dashboard')

    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

                ->where(['mdw.userid' => $userPrivModel->getId(), 'vtiger_links.linktype' => 'DASHBOARDWIDGET', 'mdw.module' => $moduleModel->getId(), 'active' => $action, 'mdw.dashboardid' => $this->get('dashboardId')]);

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

                $widget = Vtiger_Widget_Model::getInstanceFromValues($row);

    Line exceeds 120 characters; contains 145 characters
    Open

            $blockId = Settings_WidgetsManagement_Module_Model::getBlocksFromModule($moduleName, $currentUser->getRole(), $this->get('dashboardId'));

    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

         * Function to get the instance.

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

        public static function getModulesWithWidgets($moduleName, $dashboard)

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

         * Function to set the module instance.

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

        /**

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

         * @return string - name of the module

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

         * @param int $action

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

            $userPrivModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

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

            $blockId = Settings_WidgetsManagement_Module_Model::getBlocksFromModule($moduleName, $currentUser->getRole(), $this->get('dashboardId'));

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

                $widget = Vtiger_Widget_Model::getInstanceFromValues($row);

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

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

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

                $row['data'] = htmlspecialchars_decode($row['data'] ?? '');

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

                        'filterid' => $row['filterid'],

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

                        'active' => $active,

    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

        }

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

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

                unset($modules[$tabId]);

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

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

            }

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

            $dataReader = (new App\Db\Query())

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

                if (!(new App\Db\Query())->from('vtiger_module_dashboard_widgets')

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

            $modules = [];

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

                }

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

        /**

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

         *

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

            return $this->module;

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

            return $this->getModule()->get('name');

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

            $widgets = [];

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

         * Function to get the default widgets(Deprecated).

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

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

            if (0 == \count($blockId)) {

    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

         *

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

         * @return Vtiger_DetailView_Model

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

         *  Function to get the module name.

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

         */

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

        /**

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

        public function getDefaultWidgets()

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

         *

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

                    ->exists()) {

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

                        'templateid' => $row['id'],

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

                        'cache' => $row['cache'],

    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

                $modules = array_merge([$tabId => $moduleName], $modules);

    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 void

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

        public function verifyDashboard($moduleName)

    Line exceeds 120 characters; contains 132 characters
    Open

                ->leftJoin('vtiger_module_dashboard_widgets', 'vtiger_module_dashboard_widgets.templateid = vtiger_module_dashboard.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

                ->from('vtiger_links')

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

         */

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

            $currentUser = Users_Record_Model::getCurrentUserModel();

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

                }

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

                    App\Db::getInstance()->createCommand()->insert('vtiger_module_dashboard_widgets', [

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

                        'userid' => $currentUser->getId(),

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

                        'limit' => $row['limit'],

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

                        'isdefault' => $row['isdefault'],

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

                        'date' => $row['date'],

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

         * Function to get modules with widgets.

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

         *

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

        /**

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

         *

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

            $this->module = $moduleInstance;

    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

            $dataReader = $query->createCommand()->query();

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

        }

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

        }

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

                \App\Log::trace('Exiting ' . __METHOD__);

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

                        'data' => $row['data'],

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

            \App\Log::trace('Exiting ' . __METHOD__);

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

        public static function getInstance($moduleName)

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

            $modelClassName = Vtiger_Loader::getComponentClassName('Model', 'DashBoard', $moduleName);

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

         * @return <Array> $modules

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

         * @return string[]

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

        public static function getWidgetSpecial(): array

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

         */

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

        /**

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

         * Sync widgets on dashboard.

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

                ->innerJoin('vtiger_links', 'vtiger_links.linkid = vtiger_module_dashboard.linkid')

    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

                        'linkid' => $row['linkid'],

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

                        'owners' => $row['owners'],

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

                        'dashboardid' => $this->get('dashboardId'),

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

         * @param string $moduleName - module name

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

            $currentUser = Users_Privileges_Model::getCurrentUserModel();

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

                ->leftJoin('vtiger_module_dashboard_blocks', 'vtiger_module_dashboard_blocks.id = vtiger_module_dashboard.blockid')

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

                ->groupBy('module, tabid');

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

                $tabId = $row['module'] ?: $row['tabid'];

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

            if ($moduleName && ($tabId = \App\Module::getModuleId($moduleName))) {

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

            return $modules;

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

    class Vtiger_DashBoard_Model extends \App\Base

    There are no issues that match your filters.

    Category
    Status