YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/views/QuickCreateAjax.php

Summary

Maintainability
B
5 hrs
Test Coverage
B
82%

Method process has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process(App\Request $request)
    {
        $moduleName = $request->getModule();
        $this->recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
        $moduleModel = $this->recordModel->getModule();
Severity: Major
Found in modules/Vtiger/views/QuickCreateAjax.php - About 2 hrs to fix

    Function loadFieldValuesFromSource has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        public function loadFieldValuesFromSource(App\Request $request): array
        {
            $fieldValues = [];
            $sourceRelatedField = $this->recordModel->getModule()->getValuesFromSource($request);
            foreach ($sourceRelatedField as $fieldName => $fieldValue) {
    Severity: Minor
    Found in modules/Vtiger/views/QuickCreateAjax.php - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        public function process(App\Request $request)
        {
            $moduleName = $request->getModule();
            $this->recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
            $moduleModel = $this->recordModel->getModule();
    Severity: Minor
    Found in modules/Vtiger/views/QuickCreateAjax.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

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

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

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

            $eventHandler = new App\EventHandler();

    MissingImport

    Since: 2.7.0

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

    Example

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

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

    Avoid using static access to class 'Vtiger_Record_Model' in method 'process'.
    Open

            $this->recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Json' in method 'process'.
    Open

            $viewer->assign('MAPPING_RELATED_FIELD', \App\Json::encode(\App\ModuleHierarchy::getRelationFieldByHierarchy($moduleName)));

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            } else {
                $viewer->assign('RECORD_STRUCTURE', $this->recordStructure);
            }

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

                } else {
                    if (isset($this->fields[$fieldName]) && $this->fields[$fieldName]->isEditable()) {
                        $fieldModel = $this->fields[$fieldName];
                        $fieldModel->set('fieldvalue', $fieldValue);
                        $fieldValues[$fieldName] = $fieldModel;

    ElseExpression

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'Vtiger_RecordStructure_Model' in method 'getRecordStructure'.
    Open

            return Vtiger_RecordStructure_Model::getInstanceFromRecordModel($this->recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);

    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\ModuleHierarchy' in method 'process'.
    Open

            $viewer->assign('LIST_FILTER_FIELDS', \App\Json::encode(\App\ModuleHierarchy::getFieldsForListFilter($moduleName)));

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

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

            $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());

    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\ModuleHierarchy' in method 'process'.
    Open

            $viewer->assign('MAPPING_RELATED_FIELD', \App\Json::encode(\App\ModuleHierarchy::getRelationFieldByHierarchy($moduleName)));

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Json' in method 'process'.
    Open

            $viewer->assign('LIST_FILTER_FIELDS', \App\Json::encode(\App\ModuleHierarchy::getFieldsForListFilter($moduleName)));

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                    if ($this->fields[$fieldName]->isEditable() && ('' === $this->recordStructure[$fieldName]->get('fieldvalue') || null === $this->recordStructure[$fieldName]->get('fieldvalue'))) {

    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 \Vtiger_Viewer::assign
    Open

            $viewer->assign('IS_RELATION_OPERATION', $isRelationOperation);
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('BLOCK_LIST', $blockModels);
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('SOURCE_MODULE', $request->getByType('sourceModule', \App\Purifier::ALNUM));
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('SOURCE_RECORD', $request->getInteger('sourceRecord'));
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('LIST_FILTER_FIELDS', \App\Json::encode(\App\ModuleHierarchy::getFieldsForListFilter($moduleName)));
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('VIEW', $request->getByType('view', 1));
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SOURCE_RELATED_FIELD', $fieldValues);
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SINGLE_MODULE', 'SINGLE_' . $moduleName);
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('RECORD_STRUCTURE', $this->recordStructure);
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MAPPING_RELATED_FIELD', \App\Json::encode(\App\ModuleHierarchy::getRelationFieldByHierarchy($moduleName)));
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('CURRENTDATE', date('Y-n-j'));
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

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

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('RECORD', $this->recordModel);
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('LAYOUT', $layout);
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODE', 'edit');
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Returning type \App\Controller\View\Vtiger_JsScript_Model[] but getFooterScripts() is declared to return \Vtiger_JsScript_Model[]
    Open

            return $this->checkAndConvertJsScripts([

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SCRIPTS', $this->getFooterScripts($request));
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('ADDRESS_BLOCK_LABELS', ['LBL_ADDRESS_INFORMATION', 'LBL_ADDRESS_MAILING_INFORMATION', 'LBL_ADDRESS_DELIVERY_INFORMATION', 'LBL_ADDRESS_BILLING', 'LBL_ADDRESS_SHIPPING']);
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('QUICKCREATE_LINKS', $viewLinks);
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('RECORD_STRUCTURE', $blockRecordStructure);
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('MODULE_MODEL', $moduleModel);
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('FROM_VIEW', $this->fromView);
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('HIDDEN_INPUT', $this->hiddenInput);
    Severity: Critical
    Found in modules/Vtiger/views/QuickCreateAjax.php by phan

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

            $recordStructureInstance = $this->getRecordStructure();

    LongVariable

    Since: 0.2

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

    Example

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

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

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

    class Vtiger_QuickCreateAjax_View extends Vtiger_IndexAjax_View

    The class Vtiger_QuickCreateAjax_View is not named in CamelCase.
    Open

    class Vtiger_QuickCreateAjax_View extends Vtiger_IndexAjax_View
    {
        /**
         * Function to check permission.
         *

    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

            $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

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

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

            $moduleModel = $this->recordModel->getModule();

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

            $this->fields = $moduleModel->getFields();

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

            $eventHandler = new App\EventHandler();

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

                $blockRecordStructure = $blockIdFieldMap = [];

    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

            ['layout' => $layout, 'viewLinks' => $viewLinks] = $eventHandler->getParams();

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

                $viewer->assign('RECORD_STRUCTURE', $blockRecordStructure);

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

        /**

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

         * Function to check permission.

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

        /** {@inheritdoc} */

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

            $viewer = $this->getViewer($request);

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

                'mode' => 'QuickCreate',

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

                    if (isset($blockIdFieldMap[$blockModel->get('id')])) {

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

         * @throws \App\Exceptions\NoPermitted

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

         */

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

                throw new \App\Exceptions\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

                $blockModels = $moduleModel->getBlocks();

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

                        $blockModel->setFields($blockIdFieldMap[$blockModel->get('id')]);

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

            if (!$userPrivilegesModel->hasModuleActionPermission($request->getModule(), 'CreateView')) {

    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

                'viewInstance' => $this,

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

                foreach ($blockModels as $blockModel) {

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

         * @var Vtiger_Field_Model[] Field instances.

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

         * @var Vtiger_Field_Model[] Field instances.

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

         * @var array Hidden inputs.

    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

            $fieldValues = $this->loadFieldValuesFromSource($request);

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

                    $blockRecordStructure[$fieldModel->block->label][$fieldModel->name] = $fieldModel;

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

         */

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

         * @var string From view name.

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

            $this->recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);

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

            $viewLinks = Vtiger_QuickCreateView_Model::getInstance($moduleName)->getLinks([]);

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

            $eventHandler->setParams([

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

                'layout' => $layout,

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

            $recordStructureInstance = $this->getRecordStructure();

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

            $this->recordStructure = $recordStructureInstance->getStructure();

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

        public $recordModel;

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

        public $hiddenInput = [];

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

        public $fromView = 'QuickCreate';

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

            $layout = $moduleModel->getLayoutTypeForQuickCreate();

    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

            $moduleName = $request->getModule();

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

            $this->loadFieldValuesFromRequest($request);

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

            $eventHandler->setRecordModel($this->recordModel);

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

                'viewLinks' => $viewLinks,

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

                foreach ($this->recordStructure as $fieldModel) {

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

                    $blockIdFieldMap[$fieldModel->getBlockId()][$fieldModel->getName()] = $fieldModel;

    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

        public function checkPermission(App\Request $request)

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

         * @var Vtiger_Record_Model Record model instance.

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

        /**

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

        /**

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

            $eventHandler->trigger('EditViewBefore');

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

            if ('blocks' === $layout) {

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

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

            $eventHandler->setModuleName($moduleName);

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

                $viewer->assign('BLOCK_LIST', $blockModels);

    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

         * Load field values from source.

    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('IS_RELATION_OPERATION', $isRelationOperation);

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

            }

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

        }

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

         * Load field values from 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

                    if ($this->fields[$fieldName]->isEditable() && ('' === $this->recordStructure[$fieldName]->get('fieldvalue') || null === $this->recordStructure[$fieldName]->get('fieldvalue'))) {

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

                "modules.$moduleName.resources.Edit",

    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('QUICKCREATE_LINKS', $viewLinks);

    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

        public function loadFieldValuesFromSource(App\Request $request): 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

            parent::postProcessAjax($request);

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

            $viewer->assign('LIST_FILTER_FIELDS', \App\Json::encode(\App\ModuleHierarchy::getFieldsForListFilter($moduleName)));

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

            $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);

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

            $viewer->assign('HIDDEN_INPUT', $this->hiddenInput);

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

            foreach (array_intersect($request->getKeys(), array_keys($this->fields)) as $fieldName) {

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

        }

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

         *

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

                if (isset($this->recordStructure[$fieldName])) {

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

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

                "modules.$moduleName.resources.QuickCreate",

    Line exceeds 120 characters; contains 132 characters
    Open

            $viewer->assign('MAPPING_RELATED_FIELD', \App\Json::encode(\App\ModuleHierarchy::getRelationFieldByHierarchy($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

                    continue;

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

            }

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

         * Get record structure.

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

            return Vtiger_RecordStructure_Model::getInstanceFromRecordModel($this->recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);

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

        public function getFooterScripts(App\Request $request)

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

            return $this->checkAndConvertJsScripts([

    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('MODULE', $moduleName);

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

            $viewer->assign('RECORD', $this->recordModel);

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

                        $fieldValues[$fieldName] = $fieldModel;

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

        {

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

            $isRelationOperation = $request->getBoolean('relationOperation');

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

            $viewer->assign('MAPPING_RELATED_FIELD', \App\Json::encode(\App\ModuleHierarchy::getRelationFieldByHierarchy($moduleName)));

    Line exceeds 120 characters; contains 124 characters
    Open

            $viewer->assign('LIST_FILTER_FIELDS', \App\Json::encode(\App\ModuleHierarchy::getFieldsForListFilter($moduleName)));

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

            $viewer->assign('VIEW', $request->getByType('view', 1));

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

            $viewer->assign('MODE', 'edit');

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

            foreach ($sourceRelatedField as $fieldName => $fieldValue) {

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

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

         * @return Vtiger_Field_Model[] Field instances

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

        {

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

        /** {@inheritdoc} */

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

        }

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

                $viewer->assign('SOURCE_RECORD', $request->getInteger('sourceRecord'));

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

            $viewer->assign('ADDRESS_BLOCK_LABELS', ['LBL_ADDRESS_INFORMATION', 'LBL_ADDRESS_MAILING_INFORMATION', 'LBL_ADDRESS_DELIVERY_INFORMATION', 'LBL_ADDRESS_BILLING', 'LBL_ADDRESS_SHIPPING']);

    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->recordStructure[$fieldName]->set('fieldvalue', $fieldValue);

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

                        $fieldModel->set('fieldvalue', $fieldValue);

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

            $viewer->assign('SINGLE_MODULE', 'SINGLE_' . $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

                    }

    Line exceeds 120 characters; contains 157 characters
    Open

            return Vtiger_RecordStructure_Model::getInstanceFromRecordModel($this->recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);

    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('RECORD_STRUCTURE', $this->recordStructure);

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

                $viewer->assign('SOURCE_MODULE', $request->getByType('sourceModule', \App\Purifier::ALNUM));

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

            $viewer->assign('FROM_VIEW', $this->fromView);

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

            $viewer->assign('SCRIPTS', $this->getFooterScripts($request));

    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

                    }

    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 = $this->getViewer($request);

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

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

    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

                if ($fieldModel->isWritable()) {

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

                    $fieldModel->getUITypeModel()->setValueFromRequest($request, $this->recordModel);

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

            $fieldValues = [];

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

            $sourceRelatedField = $this->recordModel->getModule()->getValuesFromSource($request);

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

                if ('' === $fieldValue) {

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

                    if (isset($this->fields[$fieldName]) && $this->fields[$fieldName]->isEditable()) {

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

        public function getRecordStructure(): Vtiger_RecordStructure_Model

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

            $viewer->view('QuickCreate.tpl', $request->getModule());

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

        public function validateRequest(App\Request $request)

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

            $request->validateWriteAccess();

    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

            return $fieldValues;

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

        }

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

        /** {@inheritdoc} */

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

            $moduleName = $request->getModule();

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

            $viewer->assign('LAYOUT', $layout);

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

            $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());

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

                $fieldModel = $this->fields[$fieldName];

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

                }

    Line exceeds 120 characters; contains 194 characters
    Open

                    if ($this->fields[$fieldName]->isEditable() && ('' === $this->recordStructure[$fieldName]->get('fieldvalue') || null === $this->recordStructure[$fieldName]->get('fieldvalue'))) {

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

        /** {@inheritdoc} */

    Line exceeds 120 characters; contains 195 characters
    Open

            $viewer->assign('ADDRESS_BLOCK_LABELS', ['LBL_ADDRESS_INFORMATION', 'LBL_ADDRESS_MAILING_INFORMATION', 'LBL_ADDRESS_DELIVERY_INFORMATION', 'LBL_ADDRESS_BILLING', 'LBL_ADDRESS_SHIPPING']);

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

            $viewer->assign('SOURCE_RELATED_FIELD', $fieldValues);

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

            $viewer->assign('CURRENTDATE', date('Y-n-j'));

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

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

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

                        $fieldModel = $this->fields[$fieldName];

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

                }

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

    class Vtiger_QuickCreateAjax_View extends Vtiger_IndexAjax_View

    There are no issues that match your filters.

    Category
    Status