YetiForceCompany/YetiForceCRM

View on GitHub
modules/Import/views/Main.php

Summary

Maintainability
A
3 hrs
Test Coverage
F
0%

The class Import_Main_View has 13 public methods. Consider refactoring Import_Main_View to keep number of public methods under 10.
Open

class Import_Main_View extends \App\Controller\View\Page
{
    public $request;
    public $user;
    public $numberOfRecords;
Severity: Minor
Found in modules/Import/views/Main.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

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

Function saveMap has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function saveMap()
    {
        $saveMap = $this->request->get('save_map');
        $mapName = $this->request->get('save_map_as');
        if ($saveMap && !empty($mapName)) {
Severity: Minor
Found in modules/Import/views/Main.php - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

    public function saveMap()
    {
        $saveMap = $this->request->get('save_map');
        $mapName = $this->request->get('save_map_as');
        if ($saveMap && !empty($mapName)) {
Severity: Minor
Found in modules/Import/views/Main.php - About 1 hr to fix

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

        public static function showImportStatus($importInfo, App\User $user)
        {
            if (empty($importInfo)) {
                Import_Utils_Helper::showErrorPage(\App\Language::translate('ERR_IMPORT_INTERRUPTED', 'Import'));
                throw new \App\Exceptions\AppException('ERR_IMPORT_INTERRUPTED');
    Severity: Minor
    Found in modules/Import/views/Main.php - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    The class Import_Main_View has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13.
    Open

    class Import_Main_View extends \App\Controller\View\Page
    {
        public $request;
        public $user;
        public $numberOfRecords;
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    CouplingBetweenObjects

    Since: 1.1.0

    A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

    Example

    class Foo {
        /**
         * @var \foo\bar\X
         */
        private $x = null;
    
        /**
         * @var \foo\bar\Y
         */
        private $y = null;
    
        /**
         * @var \foo\bar\Z
         */
        private $z = null;
    
        public function setFoo(\Foo $foo) {}
        public function setBar(\Bar $bar) {}
        public function setBaz(\Baz $baz) {}
    
        /**
         * @return \SplObjectStorage
         * @throws \OutOfRangeException
         * @throws \InvalidArgumentException
         * @throws \ErrorException
         */
        public function process(\Iterator $it) {}
    
        // ...
    }

    Source https://phpmd.org/rules/design.html#couplingbetweenobjects

    Missing class import via use statement (line '76', column '31').
    Open

            $importDataController = new Import_Data_Action($importInfo, $this->user);
    Severity: Minor
    Found in modules/Import/views/Main.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 '142', column '17').
    Open

            $viewer = new Vtiger_Viewer();
    Severity: Minor
    Found in modules/Import/views/Main.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 '194', column '9').
    Open

                (new Import_Map_Model($map))->save();
    Severity: Minor
    Found in modules/Import/views/Main.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

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

        public function triggerImport(bool $batchImport = false)
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

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

    Example

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

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

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

                throw new \App\Exceptions\AppException('ERR_IMPORT_INTERRUPTED');
    Severity: Minor
    Found in modules/Import/views/Main.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 '105', column '31').
    Open

            $importDataController = new Import_Data_Action($importInfo, $user);
    Severity: Minor
    Found in modules/Import/views/Main.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 '157', column '17').
    Open

            $viewer = new Vtiger_Viewer();
    Severity: Minor
    Found in modules/Import/views/Main.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 '22', column '14').
    Open

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

                throw new \App\Exceptions\AppException('ERR_FAILED_TO_LOCK_MODULE');
    Severity: Minor
    Found in modules/Import/views/Main.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 '126', column '17').
    Open

            $viewer = new Vtiger_Viewer();
    Severity: Minor
    Found in modules/Import/views/Main.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 '236', column '17').
    Open

            $viewer = new Vtiger_Viewer();
    Severity: Minor
    Found in modules/Import/views/Main.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 'Import_Utils_Helper' in method 'copyFromFileToDB'.
    Open

            Import_Utils_Helper::showErrorPage(\App\Language::translate('ERR_FILE_READ_FAILED', 'Import') . ' - ' .
                    \App\Language::translate($fileReader->getErrorMessage(), 'Import'));
    Severity: Minor
    Found in modules/Import/views/Main.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 'Import_Queue_Action' in method 'triggerImport'.
    Open

            $importInfo = Import_Queue_Action::getImportInfo($moduleName, $this->user);
    Severity: Minor
    Found in modules/Import/views/Main.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 '84', column '68').
    Open

        public function triggerImport(bool $batchImport = false)
        {
            $moduleName = $this->request->getModule();
            $importInfo = Import_Queue_Action::getImportInfo($moduleName, $this->user);
            $importDataController = new Import_Data_Action($importInfo, $this->user);
    Severity: Minor
    Found in modules/Import/views/Main.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 'Import_Queue_Action' in method 'queueDataImport'.
    Open

            Import_Queue_Action::add($this->request, $this->user);
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            $currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
    Severity: Minor
    Found in modules/Import/views/Main.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 'Import_Queue_Action' in method 'import'.
    Open

                $importInfo = Import_Queue_Action::getUserCurrentImportInfo($importController->user);
    Severity: Minor
    Found in modules/Import/views/Main.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 '84', column '8').
    Open

        public function triggerImport(bool $batchImport = false)
        {
            $moduleName = $this->request->getModule();
            $importInfo = Import_Queue_Action::getImportInfo($moduleName, $this->user);
            $importDataController = new Import_Data_Action($importInfo, $this->user);
    Severity: Minor
    Found in modules/Import/views/Main.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 'Import_Utils_Helper' in method 'showImportStatus'.
    Open

                Import_Utils_Helper::showErrorPage(\App\Language::translate('ERR_IMPORT_INTERRUPTED', 'Import'));
    Severity: Minor
    Found in modules/Import/views/Main.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 'Import_Queue_Action' in method 'triggerImport'.
    Open

            Import_Queue_Action::updateStatus($importInfo['id'], Import_Queue_Action::$IMPORT_STATUS_HALTED);
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Language' in method 'showImportStatus'.
    Open

                Import_Utils_Helper::showErrorPage(\App\Language::translate('ERR_IMPORT_INTERRUPTED', 'Import'));
    Severity: Minor
    Found in modules/Import/views/Main.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 'Import_Module_Model' in method 'saveMap'.
    Open

                $fileReader = Import_Module_Model::getFileReader($this->request, $this->user);
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                } else {
                    $saveMapping = array_flip($fieldMapping);
                }
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

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

    Avoid using static access to class '\App\Language' in method 'copyFromFileToDB'.
    Open

            Import_Utils_Helper::showErrorPage(\App\Language::translate('ERR_FILE_READ_FAILED', 'Import') . ' - ' .
    Severity: Minor
    Found in modules/Import/views/Main.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\Config' in method 'queueDataImport'.
    Open

            $immediateImportRecordLimit = \App\Config::module('Import', 'IMMEDIATE_IMPORT_LIMIT');
    Severity: Minor
    Found in modules/Import/views/Main.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 'Import_Queue_Action' in method 'triggerImport'.
    Open

            $importInfo = Import_Queue_Action::getImportInfo($moduleName, $this->user);
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            } else {
                $importController->triggerImport();
            }
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

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

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

            } else {
                $continueImport = false;
            }
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

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

    Avoid using static access to class '\App\Language' in method 'copyFromFileToDB'.
    Open

                    \App\Language::translate($fileReader->getErrorMessage(), 'Import'));
    Severity: Minor
    Found in modules/Import/views/Main.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 'Import_Map_Model' in method 'deleteMap'.
    Open

                Import_Map_Model::markAsDeleted($mapId);
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            } else {
                $importDataController->finishImport();
                self::showResult($importInfo, $importStatusCount);
            }
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

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

    Avoid using static access to class 'Import_Module_Model' in method 'copyFromFileToDB'.
    Open

            $fileReader = Import_Module_Model::getFileReader($this->request, $this->user);
    Severity: Minor
    Found in modules/Import/views/Main.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 'Import_Utils_Helper' in method 'triggerImport'.
    Open

                Import_Utils_Helper::showErrorPage(\App\Language::translate('ERR_FAILED_TO_LOCK_MODULE', 'Import'));
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Language' in method 'triggerImport'.
    Open

                Import_Utils_Helper::showErrorPage(\App\Language::translate('ERR_FAILED_TO_LOCK_MODULE', 'Import'));
    Severity: Minor
    Found in modules/Import/views/Main.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 'Import_Map_Model' in method 'deleteMap'.
    Open

            $viewer->assign('SAVED_MAPS', Import_Map_Model::getAllByModule($moduleName));
    Severity: Minor
    Found in modules/Import/views/Main.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 "relationId" 4 times.
    Open

            if (($relationId = $this->request->getInteger('relationId')) && ($srcRecord = $this->request->getInteger('src_record'))) {
    Severity: Critical
    Found in modules/Import/views/Main.php by sonar-php

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

            if (($relationId = $this->request->getInteger('relationId')) && ($srcRecord = $this->request->getInteger('src_record'))) {
    Severity: Critical
    Found in modules/Import/views/Main.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 "Import" 14 times.
    Open

                Import_Utils_Helper::showErrorPage(\App\Language::translate('ERR_FAILED_TO_LOCK_MODULE', 'Import'));
    Severity: Critical
    Found in modules/Import/views/Main.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 "FOR_MODULE" 4 times.
    Open

            $viewer->assign('FOR_MODULE', $moduleName);
    Severity: Critical
    Found in modules/Import/views/Main.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 "module" 5 times.
    Open

            $moduleName = $importInfo['module'];
    Severity: Critical
    Found in modules/Import/views/Main.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.

    Avoid unused parameters such as '$request'.
    Open

        public function process(App\Request $request)
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    UnusedFormalParameter

    Since: 0.2

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

    Example

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

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

    Parameter $user has undeclared type \App\User (Did you mean class \Tests\App\User)
    Open

        public static function import(App\Request $request, App\User $user)
    Severity: Minor
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('IMPORT_RESULT', $importStatusCount);
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('OWNER_ID', $importInfo['user_id']);
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODULE_MODEL', $importModule);
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Suspicious array access to int
    Open

            $totalRecords = $importStatusCount['TOTAL'];
    Severity: Minor
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MERGE_ENABLED', $importInfo['merge_type']);
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODULE', 'Import');
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('CONTINUE_IMPORT', $continueImport);
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

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

                $map['assigned_user_id'] = $this->user->getCurrentUserId();
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SAVED_MAPS', Import_Map_Model::getAllByModule($moduleName));
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Parameter $user has undeclared type \App\User (Did you mean class \Tests\App\User)
    Open

        public function __construct(App\Request $request, App\User $user)
    Severity: Minor
    Found in modules/Import/views/Main.php by phan

    Parameter $user has undeclared type \App\User (Did you mean class \Tests\App\User)
    Open

        public static function showImportStatus($importInfo, App\User $user)
    Severity: Minor
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('FOR_MODULE', $moduleName);
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODULE_NAME', 'Import');
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('IMPORT_ID', $importId);
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Module_Model::setImportModule
    Open

            $importModule = Vtiger_Module_Model::getInstance('Import')
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('FOR_MODULE', $moduleName);
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('IMPORT_ID', $importId);
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Suspicious array access to int
    Open

            if ($totalRecords > ($importStatusCount['IMPORTED'] + $importStatusCount['FAILED'])) {
    Severity: Minor
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('FOR_MODULE', $moduleName);
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODULE', 'Import');
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Argument 1 (mixed) is string but \Users_Privileges_Model::hasModulePermission() takes int defined at /code/modules/Users/models/Privileges.php:101
    Open

            if (!$currentUserPrivilegesModel->hasModulePermission($request->getModule())) {
    Severity: Minor
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('FOR_MODULE', $moduleName);
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Argument 1 (importInfo) is ?array|?array{relationId:int}|?array{src_record:int} but \Import_Main_View::showImportStatus() takes array defined at /code/modules/Import/views/Main.php:99
    Open

            self::showImportStatus($importInfo, $this->user);
    Severity: Minor
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('IMPORT_RESULT', $importStatusCount);
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODULE_NAME', 'Import');
    Severity: Critical
    Found in modules/Import/views/Main.php by phan

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

                        $saveMapping["$headers[$index]"] = $fieldName;
    Severity: Info
    Found in modules/Import/views/Main.php by phan

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

            $currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

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

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

            $immediateImportRecordLimit = \App\Config::module('Import', 'IMMEDIATE_IMPORT_LIMIT');
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

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

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

            $numberOfRecordsToImport = $this->numberOfRecords;
    Severity: Minor
    Found in modules/Import/views/Main.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

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

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

    class Import_Main_View extends \App\Controller\View\Page

    The class Import_Main_View is not named in CamelCase.
    Open

    class Import_Main_View extends \App\Controller\View\Page
    {
        public $request;
        public $user;
        public $numberOfRecords;
    Severity: Minor
    Found in modules/Import/views/Main.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

        public $user;

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

        public function process(App\Request $request)

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

        }

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

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

         *

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

        }

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

        public $request;

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

         * Constructor.

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

         * @param \App\Request $request

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

        {

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

            $currentUserPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

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

            if (!$currentUserPrivilegesModel->hasModulePermission($request->getModule())) {

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

        {

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

        public $numberOfRecords;

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

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

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

            }

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

         * @param App\User     $user

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

        }

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

                $importController->queueDataImport();

    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::showImportStatus($importInfo, $this->user);

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

            $viewer->assign('MODULE_NAME', 'Import');

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

            $viewer->assign('IMPORT_RESULT', $importStatusCount);

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

            $viewer->view('ImportResult.tpl', 'Import');

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

            $importId = $importInfo['id'];

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

            $viewer->view('ImportSchedule.tpl', 'Import');

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

            $saveMap = $this->request->get('save_map');

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

            $mapName = $this->request->get('save_map_as');

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

                    $firstRowData = $fileReader->getFirstRowData($hasHeader);

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

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

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

            Import_Queue_Action::updateStatus($importInfo['id'], Import_Queue_Action::$IMPORT_STATUS_HALTED);

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

         * @throws \App\Exceptions\AppException

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

                || $importInfo['temp_status'] === Import_Queue_Action::$IMPORT_STATUS_NONE) {

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

        public static function showResult($importInfo, $importStatusCount)

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

                $hasHeader = $fileReader->hasHeader();

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

                } else {

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

         *

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

        public static function import(App\Request $request, App\User $user)

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

            }

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

                $importDataController->finishImport();

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

        {

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

            $viewer = new Vtiger_Viewer();

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

        public function saveMap()

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

            if ($fileReadStatus) {

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

        {

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

         * Show import status.

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

                throw new \App\Exceptions\AppException('ERR_IMPORT_INTERRUPTED');

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

        public static function showCurrentStatus($importInfo, $importStatusCount, $continueImport)

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

            $viewer->assign('IMPORT_ID', $importId);

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

        {

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

         * @param \App\Request $request

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

         */

    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

         * @throws \App\Exceptions\AppException

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

            $importDataController = new Import_Data_Action($importInfo, $user);

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

        }

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

        }

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

            $moduleName = $importInfo['module'];

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

            $viewer->assign('MODULE', 'Import');

    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->request = $request;

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

            $isImportScheduled = $importController->request->get('is_scheduled');

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

         *

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

         */

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

        public static function showImportStatus($importInfo, App\User $user)

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

            $importStatusCount = $importDataController->getImportStatusCount();

    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

            $moduleName = $importInfo['module'];

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

                ->set('relationId', $importInfo['relationId'] ?? 0);

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

            $viewer->assign('OWNER_ID', $importInfo['user_id']);

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

                    foreach ($fieldMapping as $fieldName => $index) {

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

                $map['content'] = $saveMapping;

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

            $this->user = $user;

    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

            $viewer->view('ImportStatus.tpl', 'Import');

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

        {

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

            $viewer = new Vtiger_Viewer();

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

        public static function showScheduledStatus($importInfo)

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

            $viewer->assign('FOR_MODULE', $moduleName);

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

                    }

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

                    }

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

            }

    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

                $continueImport = true;

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

            $viewer->assign('FOR_MODULE', $moduleName);

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

                        $headers = array_merge($headers, array_keys($firstRowData['LBL_INVENTORY_FIELDS']));

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

                }

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

         *

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

         * Import data from file.

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

            $importController = new self($request, $user);

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

            $importController->saveMap();

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

            $fileReadStatus = $importController->copyFromFileToDB();

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

            }

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

                $importInfo = Import_Queue_Action::getUserCurrentImportInfo($importController->user);

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

            $importDataController->importData();

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

                $importInfo['relationId'] = $relationId;

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

        {

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

            if ($totalRecords > ($importStatusCount['IMPORTED'] + $importStatusCount['FAILED'])) {

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

            $importModule = Vtiger_Module_Model::getInstance('Import')

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

                ->set('src_record', $importInfo['src_record'] ?? 0)

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

                    $saveMapping = array_flip($fieldMapping);

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

                (new Import_Map_Model($map))->save();

    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

            $numberOfRecordsToImport = $this->numberOfRecords;

    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

            $viewer->assign('SAVED_MAPS', Import_Map_Model::getAllByModule($moduleName));

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

            $viewer->view('Import_Saved_Maps.tpl', 'Import');

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

                $importController->triggerImport();

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

        public function triggerImport(bool $batchImport = false)

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

            $importInfo = Import_Queue_Action::getImportInfo($moduleName, $this->user);

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

                $continueImport = 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

                self::showCurrentStatus($importInfo, $importStatusCount, $continueImport);

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

                self::showResult($importInfo, $importStatusCount);

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

            $viewer->assign('MERGE_ENABLED', $importInfo['merge_type']);

    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

                    $headers = array_keys($firstRowData['LBL_STANDARD_FIELDS']);

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

        {

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

         * Delete map.

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

        public static function deleteMap(App\Request $request)

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

                throw new \App\Exceptions\AppException('ERR_FAILED_TO_LOCK_MODULE');

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

         * @param \App\User $user

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

            if ($importInfo['temp_status'] === Import_Queue_Action::$IMPORT_STATUS_HALTED

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

            $importId = $importInfo['id'];

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

            $viewer->assign('CONTINUE_IMPORT', $continueImport);

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

            $viewer->assign('FOR_MODULE', $moduleName);

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

            $moduleName = $importInfo['module'];

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

                $fieldMapping = $this->request->get('field_mapping');

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

                        $saveMapping["$headers[$index]"] = $fieldName;

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

                $map['name'] = $mapName;

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

                    \App\Language::translate($fileReader->getErrorMessage(), 'Import'));

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

         *

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

                $importInfo['src_record'] = $srcRecord;

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

            $totalRecords = $importStatusCount['TOTAL'];

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

            }

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

            $mapId = $request->getInteger('mapid');

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

                Import_Map_Model::markAsDeleted($mapId);

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

            $importInfo = Import_Queue_Action::getImportInfo($moduleName, $this->user);

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

            $viewer->assign('MODULE', 'Import');

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

            }

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

                Import_Utils_Helper::showErrorPage(\App\Language::translate('ERR_IMPORT_INTERRUPTED', 'Import'));

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

                $fileReader = Import_Module_Model::getFileReader($this->request, $this->user);

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

                if (null === $fileReader) {

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

                if ($hasHeader) {

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

                    if (isset($firstRowData['LBL_INVENTORY_FIELDS'])) {

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

                $map = [];

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

                $map['module'] = $this->request->get('module');

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

            Import_Utils_Helper::showErrorPage(\App\Language::translate('ERR_FILE_READ_FAILED', 'Import') . ' - ' .

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

            $immediateImportRecordLimit = \App\Config::module('Import', 'IMMEDIATE_IMPORT_LIMIT');

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

        /**

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

         * @param \App\Request $request

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

        }

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

        /**

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

         * @param App\User     $user

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

         * Trigger import.

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

         * @param bool $batchImport

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

            $importDataController = new Import_Data_Action($importInfo, $this->user);

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

            if (($relationId = $this->request->getInteger('relationId')) && ($srcRecord = $this->request->getInteger('src_record'))) {

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

         *

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

         * @param array     $importInfo

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

            $viewer->assign('MODULE_NAME', 'Import');

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

        {

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

            $viewer->assign('IMPORT_ID', $importId);

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

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

            if ($numberOfRecordsToImport > $immediateImportRecordLimit) {

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

                $this->request->set('is_scheduled', true);

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

        {

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

                self::showScheduledStatus($importInfo);

    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 (!$batchImport && !$importDataController->initializeImport()) {

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

                Import_Utils_Helper::showErrorPage(\App\Language::translate('ERR_FAILED_TO_LOCK_MODULE', 'Import'));

    Line exceeds 120 characters; contains 130 characters
    Open

            if (($relationId = $this->request->getInteger('relationId')) && ($srcRecord = $this->request->getInteger('src_record'))) {

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

         */

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

            if (empty($importInfo)) {

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

                ->setImportModule($moduleName)

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

            $viewer = new Vtiger_Viewer();

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

            if ($saveMap && !empty($mapName)) {

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

            }

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

            $fileReader->deleteFile();

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

                return true;

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

            }

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

         */

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

        public function __construct(App\Request $request, App\User $user)

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

            if ($isImportScheduled) {

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

            }

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

            } else {

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

            $viewer->assign('IMPORT_RESULT', $importStatusCount);

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

            $viewer->assign('MODULE_MODEL', $importModule);

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

        {

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

                $map['assigned_user_id'] = $this->user->getCurrentUserId();

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

            $fileReader = Import_Module_Model::getFileReader($this->request, $this->user);

    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

            $viewer->assign('FOR_MODULE', $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

            $fileReader->read();

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

            Import_Queue_Action::add($this->request, $this->user);

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

         */

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

            $moduleName = $request->getModule();

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

            $viewer = new Vtiger_Viewer();

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

            if ('success' === $fileReader->getStatus()) {

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

        public function queueDataImport()

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

                $map['has_header'] = ($hasHeader) ? 1 : 0;

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

                $this->numberOfRecords = $fileReader->getNumberOfRecordsRead();

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

            if (!empty($mapId)) {

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

    class Import_Main_View extends \App\Controller\View\Page

    There are no issues that match your filters.

    Category
    Status