YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
C
1 day
Test Coverage
F
0%

Function getStructure has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStructure(Vtiger_Record_Model $recordModel, App\Request $request): array
    {
        Vtiger_Field_Model::$tabIndexDefaultSeq = 1000;
        $values = [];
        $moduleModel = $recordModel->getModule();
Severity: Minor
Found in modules/Vtiger/views/QuickEditModal.php - About 4 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

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

    public function process(App\Request $request)
    {
        $moduleName = $request->getModule();
        $record = $request->getInteger('record');
        $recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
Severity: Major
Found in modules/Vtiger/views/QuickEditModal.php - About 3 hrs to fix

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

        public function process(App\Request $request)
        {
            $moduleName = $request->getModule();
            $record = $request->getInteger('record');
            $recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
    Severity: Minor
    Found in modules/Vtiger/views/QuickEditModal.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

    Method getStructure has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getStructure(Vtiger_Record_Model $recordModel, App\Request $request): array
        {
            Vtiger_Field_Model::$tabIndexDefaultSeq = 1000;
            $values = [];
            $moduleModel = $recordModel->getModule();
    Severity: Minor
    Found in modules/Vtiger/views/QuickEditModal.php - About 1 hr to fix

      The method getStructure() has an NPath complexity of 728. The configured NPath complexity threshold is 200.
      Open

          public function getStructure(Vtiger_Record_Model $recordModel, App\Request $request): array
          {
              Vtiger_Field_Model::$tabIndexDefaultSeq = 1000;
              $values = [];
              $moduleModel = $recordModel->getModule();

      NPathComplexity

      Since: 0.1

      The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

      Example

      class Foo {
          function bar() {
              // lots of complicated code
          }
      }

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

      The method process() has an NPath complexity of 336. The configured NPath complexity threshold is 200.
      Open

          public function process(App\Request $request)
          {
              $moduleName = $request->getModule();
              $record = $request->getInteger('record');
              $recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);

      NPathComplexity

      Since: 0.1

      The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

      Example

      class Foo {
          function bar() {
              // lots of complicated code
          }
      }

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

      The method getStructure() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
      Open

          public function getStructure(Vtiger_Record_Model $recordModel, App\Request $request): array
          {
              Vtiger_Field_Model::$tabIndexDefaultSeq = 1000;
              $values = [];
              $moduleModel = $recordModel->getModule();

      CyclomaticComplexity

      Since: 0.1

      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

      Example

      // Cyclomatic Complexity = 11
      class Foo {
      1   public function example() {
      2       if ($a == $b) {
      3           if ($a1 == $b1) {
                      fiddle();
      4           } elseif ($a2 == $b2) {
                      fiddle();
                  } else {
                      fiddle();
                  }
      5       } elseif ($c == $d) {
      6           while ($c == $d) {
                      fiddle();
                  }
      7        } elseif ($e == $f) {
      8           for ($n = 0; $n < $h; $n++) {
                      fiddle();
                  }
              } else {
                  switch ($z) {
      9               case 1:
                          fiddle();
                          break;
      10              case 2:
                          fiddle();
                          break;
      11              case 3:
                          fiddle();
                          break;
                      default:
                          fiddle();
                          break;
                  }
              }
          }
      }

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

      The method process() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
      Open

          public function process(App\Request $request)
          {
              $moduleName = $request->getModule();
              $record = $request->getInteger('record');
              $recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);

      CyclomaticComplexity

      Since: 0.1

      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

      Example

      // Cyclomatic Complexity = 11
      class Foo {
      1   public function example() {
      2       if ($a == $b) {
      3           if ($a1 == $b1) {
                      fiddle();
      4           } elseif ($a2 == $b2) {
                      fiddle();
                  } else {
                      fiddle();
                  }
      5       } elseif ($c == $d) {
      6           while ($c == $d) {
                      fiddle();
                  }
      7        } elseif ($e == $f) {
      8           for ($n = 0; $n < $h; $n++) {
                      fiddle();
                  }
              } else {
                  switch ($z) {
      9               case 1:
                          fiddle();
                          break;
      10              case 2:
                          fiddle();
                          break;
      11              case 3:
                          fiddle();
                          break;
                      default:
                          fiddle();
                          break;
                  }
              }
          }
      }

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

      Refactor this function to reduce its Cognitive Complexity from 32 to the 15 allowed.
      Open

          public function getStructure(Vtiger_Record_Model $recordModel, App\Request $request): array

      Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

      See

      Refactor this function to reduce its Cognitive Complexity from 21 to the 15 allowed.
      Open

          public function process(App\Request $request)

      Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

      See

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

      class Vtiger_QuickEditModal_View extends \App\Controller\Modal
      {
          /** {@inheritdoc} */
          public $modalSize = 'modal-xl';
          /** {@inheritdoc} */

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

                  throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 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 '84', 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

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

              } else {
                  $fieldModelList = $moduleModel->getQuickCreateFields();
              }

      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\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 'Vtiger_Link_Model' in method 'getLinks'.
      Open

              $links['QUICKEDIT_VIEW_HEADER'][] = Vtiger_Link_Model::getInstanceFromValues([
                  'linktype' => 'QUICKEDIT_VIEW_HEADER',
                  'linkhint' => 'LBL_GO_TO_FULL_FORM',
                  'showLabel' => 1,
                  'linkicon' => 'yfi yfi-full-editing-view',

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              $recordModel = Vtiger_Record_Model::getInstanceById($record, $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

      Avoid using static access to class '\App\Privilege' in method 'checkPermission'.
      Open

              if ($request->isEmpty('record', true) || !\App\Privilege::isPermitted($request->getModule(), 'EditView', $request->getInteger('record'))) {

      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\FieldsDependency' in method 'getStructure'.
      Open

              $fieldsDependency = \App\FieldsDependency::getByRecordModel('QuickEdit', $recordModel);

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              $recordModel = Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule());

      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

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

              $viewer->assign('RECORD_STRUCTURE_MODEL', Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel));

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'Vtiger_Link_Model' in method 'getLinks'.
      Open

              $links = Vtiger_Link_Model::getAllByType($recordModel->getModule()->getId(), ['QUICKCREATE_VIEW_HEADER', 'EDIT_VIEW_RECORD_COLLECTOR'], []);

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

              $viewer->assign('RECORD_ACTIVITY_NOTIFIER', $record && \App\Config::performance('recordActivityNotifier', false) && $moduleModel->isTrackingEnabled() && $moduleModel->isPermitted('RecordActivityNotifier'));

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

              $layout = $request->getByType('showLayout') ?: Config\Performance::$quickEditLayout ?? 'blocks';

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

              if ($request->isEmpty('record', true) || !\App\Privilege::isPermitted($request->getModule(), 'EditView', $request->getInteger('record'))) {

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

              if (!$request->isEmpty('editFields', true)) {

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

      Avoid unused local variables such as '$value'.
      Open

              foreach (array_intersect_key($recordStructure, $changedFields) as $key => $value) {

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

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

      Call to undeclared method \Vtiger_QuickEditModal_View::getViewer
      Open

              $viewer = $this->getViewer($request);
      Severity: Critical
      Found in modules/Vtiger/views/QuickEditModal.php by phan

      Call to undeclared method \Vtiger_QuickEditModal_View::getViewer
      Open

              $viewer = $this->getViewer($request);
      Severity: Critical
      Found in modules/Vtiger/views/QuickEditModal.php by phan

      Call to undeclared method \Vtiger_QuickEditModal_View::checkAndConvertJsScripts
      Open

              return $this->checkAndConvertJsScripts([
      Severity: Critical
      Found in modules/Vtiger/views/QuickEditModal.php by phan

      Reference to undeclared class \App\Controller\Modal
      Open

              parent::preProcessAjax($request);
      Severity: Critical
      Found in modules/Vtiger/views/QuickEditModal.php by phan

      Class extends undeclared class \App\Controller\Modal
      Open

      class Vtiger_QuickEditModal_View extends \App\Controller\Modal
      Severity: Critical
      Found in modules/Vtiger/views/QuickEditModal.php by phan

      Call to deprecated function \Vtiger_Field_Model::getFieldLabel() defined at /code/modules/Vtiger/models/Field.php:215
      Open

                      $noFieldsAccess[$fieldModel->getFieldLabel()] = $fieldModel->getDisplayValue($recordModel->get($fieldName));

      Call to deprecated function \Vtiger_Field_Model::getFieldLabel() defined at /code/modules/Vtiger/models/Field.php:215
      Open

                          $noFieldsAccess[$fieldModel->getFieldLabel()] = '-';

      Saw an @param annotation for recordMode, but it was not found in the param list of function getLinks(\Vtiger_Record_Model $recordModel) : \Vtiger_Link_Model[]
      Open

           * @param \Vtiger_Record_Model $recordMode

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

      class Vtiger_QuickEditModal_View extends \App\Controller\Modal

      The class Vtiger_QuickEditModal_View is not named in CamelCase.
      Open

      class Vtiger_QuickEditModal_View extends \App\Controller\Modal
      {
          /** {@inheritdoc} */
          public $modalSize = 'modal-xl';
          /** {@inheritdoc} */

      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

              $recordModel = Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule());

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

                      $uitypeModel = $fieldModel->getUITypeModel();

      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

              $eventHandler->trigger('EditViewBefore');

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

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

      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

          {

      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

              $request->validateReadAccess();

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

                  }

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

                  $fieldModelList = $moduleModel->getQuickCreateFields();

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

              $fieldsDependency = \App\FieldsDependency::getByRecordModel('QuickEdit', $recordModel);

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

                  }

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

              $links = Vtiger_Link_Model::getAllByType($recordModel->getModule()->getId(), ['QUICKCREATE_VIEW_HEADER', 'EDIT_VIEW_RECORD_COLLECTOR'], []);

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

                  'linktype' => 'QUICKEDIT_VIEW_HEADER',

      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

          public function getPageTitle(App\Request $request)

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

                      $uitypeModel->setValueFromRequest($request, $recordModel);

      Line exceeds 120 characters; contains 124 characters
      Open

                      $noFieldsAccess[$fieldModel->getFieldLabel()] = $fieldModel->getDisplayValue($recordModel->get($fieldName));

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

              $layout = 'Calendar' === $moduleName ? 'standard' : $layout;

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

                  foreach ($recordStructure as $fieldModel) {

      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']);

      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

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

                              if ('picklist' === $fieldModel->getFieldDataType() && isset($picklistValues[$fieldName])) {

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

                  if ($fieldModel->get('tabindex') > Vtiger_Field_Model::$tabIndexLastSeq) {

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

                      $fieldModel->set('hideField', true);

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

              return $links;

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

          public $modalSize = 'modal-xl';

      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

              $record = $request->getInteger('record');

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

                      } elseif ($fieldModel->isViewEnabled()) {

      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

                  foreach ($blockModels as $blockModel) {

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

                      }

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

                  unset($changedFields[$key]);

      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

              return $this->checkAndConvertJsScripts([

      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

              $moduleModel = $recordModel->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

              ++Vtiger_Field_Model::$tabIndexLastSeq;

      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\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

      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

          }

      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

                      if ($uitypeModel->validateValue($recordModel->get($fieldName))) {

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

                          $noFieldsAccess[$fieldModel->getFieldLabel()] = '-';

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

                  } elseif ($fieldModel->isViewEnabled()) {

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

                  if (($mandatoryFields && \in_array($fieldName, $mandatoryFields)) || ($fieldsDependency['mandatory'] && \in_array($fieldName, $fieldsDependency['mandatory']))) {

      Line exceeds 120 characters; contains 148 characters
      Open

              $links = Vtiger_Link_Model::getAllByType($recordModel->getModule()->getId(), ['QUICKCREATE_VIEW_HEADER', 'EDIT_VIEW_RECORD_COLLECTOR'], []);

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

              $links['QUICKEDIT_VIEW_HEADER'][] = Vtiger_Link_Model::getInstanceFromValues([

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

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

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

          protected function preProcessTplName(App\Request $request)

      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

              $moduleModel = $recordModel->getModule();

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

              $changedFieldsExist = false;

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

                  $fieldModel = $fieldList[$fieldName];

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

                      $noFieldsAccess[$fieldModel->getFieldLabel()] = $fieldModel->getDisplayValue($recordModel->get($fieldName));

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

              $viewer->assign('RECORD_STRUCTURE_MODEL', Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel));

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

              $viewer->assign('RECORD_ACTIVITY_NOTIFIER', $record && \App\Config::performance('recordActivityNotifier', false) && $moduleModel->isTrackingEnabled() && $moduleModel->isPermitted('RecordActivityNotifier'));

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

              $viewer->view('Modals/QuickEdit.tpl', $request->getModule());

      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

           * Function to get the values in stuctured format.

      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 ($fieldsDependency['hide']['frontend'] && \in_array($fieldName, $fieldsDependency['hide']['frontend'])) {

      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

                  'linkdata' => ['js' => 'click', 'url' => $recordModel->getEditViewUrl()],

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

              if ($request->isEmpty('record', true) || !\App\Privilege::isPermitted($request->getModule(), 'EditView', $request->getInteger('record'))) {

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

                      }

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

          {

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

                          $fieldModel->set('fieldvalue', $recordModel->get($fieldName));

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

              $eventHandler->setRecordModel($recordModel);

      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

              }

      Line exceeds 120 characters; contains 214 characters
      Open

              $viewer->assign('RECORD_ACTIVITY_NOTIFIER', $record && \App\Config::performance('recordActivityNotifier', false) && $moduleModel->isTrackingEnabled() && $moduleModel->isPermitted('RecordActivityNotifier'));

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

                  "modules.$moduleName.resources.QuickEditModal",

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

                  if ('none' !== $request->getRaw('editFields')) {

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

                              $fieldModelList[$fieldName] = $fieldModel;

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

              foreach ($fieldModelList as $fieldName => $fieldModel) {

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

                  $fieldModel->set('fieldvalue', $recordModel->get($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

           * Function to get the list of links for the module.

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

           * @return Vtiger_Link_Model[] - Associate array of Link Type to List of Vtiger_Link_Model 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

              return 'Modals/QuickEditHeader.tpl';

      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

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

      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

              $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('VIEW', $request->getByType('view', 1));

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

           * @return Vtiger_Field_Model[]

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

                      }

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

           *

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

          {

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

              parent::preProcessAjax($request);

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

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

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

              }

      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

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

                      Vtiger_Field_Model::$tabIndexLastSeq = $fieldModel->get('tabindex');

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

                  }

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

                  $values[$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

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

                  'viewInstance' => $this,

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

                  }

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

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

              } 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

                  }

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

              return $values;

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

                  'showLabel' => 1,

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

                  'linkclass' => 'btn-light js-full-editlink fontBold u-text-ellipsis mb-2 mb-md-0 col-12',

      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

                  'layout' => $layout,

      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

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

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

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

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

              $viewer->assign('CHANGED_FIELDS', $changedFields);

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

           *

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

              Vtiger_Field_Model::$tabIndexDefaultSeq = 1000;

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

                          $fieldModel = $moduleModel->getFieldByName($fieldName);

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

                      $fieldModel->set('isMandatory', true);

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

                  'linkhint' => 'LBL_GO_TO_FULL_FORM',

      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

                  $changedFieldsExist = true;

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

                          $changedFields[$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

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

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

              $layout = $request->getByType('showLayout') ?: Config\Performance::$quickEditLayout ?? 'blocks';

      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

              foreach (array_intersect_key($recordStructure, $changedFields) as $key => $value) {

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

                  'modules.Vtiger.resources.Edit',

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

                  'modules.Vtiger.resources.QuickEditModal',

      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

                      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

           * @param Vtiger_Record_Model  $recordModel

      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 $request->has('modalTitle') ? $request->getByType('modalTitle', 'Text') : '';

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

              $fieldList = $moduleModel->getFields();

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

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

          }

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

          }

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

              $values = [];

      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 $showFooter = false;

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

          public function checkPermission(App\Request $request)

      Line exceeds 120 characters; contains 147 characters
      Open

              if ($request->isEmpty('record', true) || !\App\Privilege::isPermitted($request->getModule(), 'EditView', $request->getInteger('record'))) {

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

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

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

          {

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

                  'mode' => 'QuickEdit',

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

                  $layout = 'blocks';

      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

              $viewer->assign('RECORD_ID', $record);

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

          public function getModalScripts(App\Request $request)

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

          public function getStructure(Vtiger_Record_Model $recordModel, App\Request $request): array

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

              $picklistValues = $request->getArray('picklistValues', 'Text') ?? [];

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

              if (!$request->isEmpty('editFields', true)) {

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

                                  $fieldModel->picklistValues = $picklistValues[$fieldName];

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

              $recordStructure = $this->getStructure($recordModel, $request);

      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

              $viewer->assign('SHOW_ALERT_NO_POWERS', ($changedFieldsExist && !$changedFields && !$recordStructure));

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

              $viewer->assign('NO_FIELD_ACCESS', $noFieldsAccess);

      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

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

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

           * @param \Vtiger_Record_Model $recordModel

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

                  $fieldModelList = [];

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

                      foreach ($request->getArray('editFields', 'Alnum') as $fieldName) {

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

          public function preProcessAjax(App\Request $request)

      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

          public function process(App\Request $request)

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

              $recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);

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

              $changedFields = $noFieldsAccess = [];

      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

              }

      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

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

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

              $mandatoryFields = $request->getArray('mandatoryFields', 'Alnum') ?? [];

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

                          if ($fieldModel && $fieldModel->isEditable()) {

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

                  if ($fieldsDependency['hide']['backend'] && \in_array($fieldName, $fieldsDependency['hide']['backend'])) {

      Line exceeds 120 characters; contains 173 characters
      Open

                  if (($mandatoryFields && \in_array($fieldName, $mandatoryFields)) || ($fieldsDependency['mandatory'] && \in_array($fieldName, $fieldsDependency['mandatory']))) {

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

           * @param \Vtiger_Record_Model $recordMode

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

          public function getLinks(Vtiger_Record_Model $recordModel)

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

              ]);

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

      class Vtiger_QuickEditModal_View extends \App\Controller\Modal

      There are no issues that match your filters.

      Category
      Status