YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/actions/Inventory.php

Summary

Maintainability
B
5 hrs
Test Coverage
F
0%

Method checkLimits has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function checkLimits(App\Request $request)
    {
        $moduleName = $request->getModule();
        $record = $request->getInteger('record');
        if (!\App\Privilege::isPermitted($moduleName, 'EditView', $record)) {
Severity: Major
Found in modules/Vtiger/actions/Inventory.php - About 2 hrs to fix

    Method getRecordDetail has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getRecordDetail(int $recordId, ?int $currencyId, string $moduleName, string $fieldName): array
        {
            $recordModel = Vtiger_Record_Model::getInstanceById($recordId);
            if (!$recordModel->isViewable()) {
                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in modules/Vtiger/actions/Inventory.php - About 1 hr to fix

      Function getRecordDetail has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getRecordDetail(int $recordId, ?int $currencyId, string $moduleName, string $fieldName): array
          {
              $recordModel = Vtiger_Record_Model::getInstanceById($recordId);
              if (!$recordModel->isViewable()) {
                  throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.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

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

          public function checkLimits(App\Request $request)
          {
              $moduleName = $request->getModule();
              $record = $request->getInteger('record');
              if (!\App\Privilege::isPermitted($moduleName, 'EditView', $record)) {
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php - About 35 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          public static function getRecordDetail(int $recordId, ?int $currencyId, string $moduleName, string $fieldName): array
      Severity: Critical
      Found in modules/Vtiger/actions/Inventory.php by sonar-php

      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_Inventory_Action has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13.
      Open

      class Vtiger_Inventory_Action extends \App\Controller\Action
      {
          use \App\Controller\ExposeMethod;
      
          /** {@inheritdoc} */
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      CouplingBetweenObjects

      Since: 1.1.0

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

      Example

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

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

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

                  throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

                  $viewer = new Vtiger_Viewer();
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

                  throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

              $response = new Vtiger_Response();
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      MissingImport

      Since: 2.7.0

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

      Example

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

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

      Missing class import via use statement (line '55', column '19').
      Open

              $response = new Vtiger_Response();
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

                  throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

                  throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

                  throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      MissingImport

      Since: 2.7.0

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

      Example

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

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

      Missing class import via use statement (line '169', column '23').
      Open

              $eventHandler = new App\EventHandler();
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      MissingImport

      Since: 2.7.0

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

      Example

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

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

      Missing class import via use statement (line '208', column '19').
      Open

              $response = new Vtiger_Response();
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      MissingImport

      Since: 2.7.0

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

      Example

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

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

      Avoid using static access to class '\App\Fields\Currency' in method 'checkLimits'.
      Open

                  $selectedCurrency = \App\Fields\Currency::getById($currency);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              } else {
                  foreach ($request->getArray('idlist', 'Integer') as $id) {
                      $info[] = self::getRecordDetail($id, $currencyId, $moduleName, $fieldName);
                  }
              }
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

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

              $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              $recordModel = Vtiger_Record_Model::getInstanceById($record, 'Accounts');
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

          public static function getRecordDetail(int $recordId, ?int $currencyId, string $moduleName, string $fieldName): array
          {
              $recordModel = Vtiger_Record_Model::getInstanceById($recordId);
              if (!$recordModel->isViewable()) {
                  throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      IfStatementAssignment

      Since: 2.7.0

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

      Example

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

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

      Avoid using static access to class 'Vtiger_InventoryLimit_UIType' in method 'checkLimits'.
      Open

      }
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'Vtiger_Field_Model' in method 'checkLimits'.
      Open

              $balanceField = Vtiger_Field_Model::getInstance($balanceFieldName, $moduleInstance);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              } else {
                  $response->setResult(['status' => true]);
                  $response->emit();
      
                  return;
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

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

              if (!\App\Privilege::isPermitted($moduleName, 'EditView', $record)) {
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'Vtiger_Util_Helper' in method 'checkLimits'.
      Open

              $baseCurrency = Vtiger_Util_Helper::getBaseCurrency();
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'Vtiger_Inventory_Model' in method 'getRecordDetail'.
      Open

              $inventory = Vtiger_Inventory_Model::getInstance($moduleName);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              $recordModel = Vtiger_Record_Model::getInstanceById($srcRecord, $srcModule);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              $moduleInstance = Vtiger_Module_Model::getInstance('Accounts');
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'Vtiger_Field_Model' in method 'checkLimits'.
      Open

              $limitField = Vtiger_Field_Model::getInstance($limitFieldName, $moduleInstance);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'App\Purifier' in method 'getRecordDetail'.
      Open

                  'name' => App\Purifier::decodeHtml($recordModel->getName()),
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              $recordModel = Vtiger_Record_Model::getInstanceById($recordId);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

          public static function getRecordDetail(int $recordId, ?int $currencyId, string $moduleName, string $fieldName): array
          {
              $recordModel = Vtiger_Record_Model::getInstanceById($recordId);
              if (!$recordModel->isViewable()) {
                  throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      IfStatementAssignment

      Since: 2.7.0

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

      Example

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

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

      Avoid using static access to class '\App\Record' in method 'getTableData'.
      Open

                  $item['moduleName'] = \App\Record::getType($item['info']['id']);
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              if (!\App\Privilege::isPermitted($srcModule, 'DetailView', $srcRecord)) {
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'Settings_Inventory_Record_Model' in method 'getRecordDetail'.
      Open

                      $taxModel = Settings_Inventory_Record_Model::getInstanceById($recordModel->get('taxes'), 'Taxes');
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

                  } else {
                      $productTaxes = explode(',', $recordModel->get('taxes'));
                      $taxModel = Settings_Inventory_Record_Model::getInstanceById(reset($productTaxes), 'Taxes');
                  }
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

      Avoid using static access to class 'Settings_Inventory_Record_Model' in method 'getRecordDetail'.
      Open

                      $taxModel = Settings_Inventory_Record_Model::getInstanceById(reset($productTaxes), 'Taxes');
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

                  throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
      Severity: Critical
      Found in modules/Vtiger/actions/Inventory.php by sonar-php

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

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

                  $response->setResult(['status' => true]);
      Severity: Critical
      Found in modules/Vtiger/actions/Inventory.php by sonar-php

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

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

                  $limit = Vtiger_InventoryLimit_UIType::getValues($limitID)['value'];
      Severity: Critical
      Found in modules/Vtiger/actions/Inventory.php by sonar-php

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

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

                  'moduleName' => $moduleName,
      Severity: Critical
      Found in modules/Vtiger/actions/Inventory.php by sonar-php

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

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

              if (!$recordModel->isEmpty('taxes')) {
      Severity: Critical
      Found in modules/Vtiger/actions/Inventory.php by sonar-php

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

      Call to undeclared method \Vtiger_Viewer::assign
      Open

                  $viewer->assign('LIMIT', $limit);
      Severity: Critical
      Found in modules/Vtiger/actions/Inventory.php by phan

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

                      $info[] = self::getRecordDetail($id, $currencyId, $moduleName, $fieldName);
      Severity: Info
      Found in modules/Vtiger/actions/Inventory.php by phan

      Call to undeclared method \Vtiger_Viewer::assign
      Open

                  $viewer->assign('SYMBOL', $symbol);
      Severity: Critical
      Found in modules/Vtiger/actions/Inventory.php by phan

      Call to undeclared method \Vtiger_Viewer::assign
      Open

                  $viewer->assign('TOTALS', $totalPrice);
      Severity: Critical
      Found in modules/Vtiger/actions/Inventory.php by phan

      Call to undeclared method \Vtiger_Viewer::assign
      Open

                  $viewer->assign('BALANCE', $balance);
      Severity: Critical
      Found in modules/Vtiger/actions/Inventory.php by phan

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

              if (!$userPrivilegesModel->hasModulePermission($request->getModule())) {
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phan

      Call to undeclared method \Vtiger_Viewer::assign
      Open

                  $viewer->assign('PRICE', $price);
      Severity: Critical
      Found in modules/Vtiger/actions/Inventory.php by phan

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

      class Vtiger_Inventory_Action extends \App\Controller\Action

      The class Vtiger_Inventory_Action is not named in CamelCase.
      Open

      class Vtiger_Inventory_Action extends \App\Controller\Action
      {
          use \App\Controller\ExposeMethod;
      
          /** {@inheritdoc} */
      Severity: Minor
      Found in modules/Vtiger/actions/Inventory.php by phpmd

      CamelCaseClassName

      Since: 0.2

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

      Example

      class class_name {
      }

      Source

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

          use \App\Controller\ExposeMethod;

      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

              parent::__construct();

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

              }

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

              $limitFieldName = 'creditlimit';

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

              $balanceField = Vtiger_Field_Model::getInstance($balanceFieldName, $moduleInstance);

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

              }

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

                  }

      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

              $autoFields = [];

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

              }

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

          }

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

          public function __construct()

      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

              } else {

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

                  $price = (float) $price * $selectedCurrency['conversion_rate'];

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

              $status = $totalPrice > $limit ? false : true;

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

                  $viewer->assign('BALANCE', $balance);

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

              $response->setResult($info);

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

           *

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

              $info = [

      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('InventoryRecordDetails');

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

              $response->emit();

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

                  $selectedCurrency = \App\Fields\Currency::getById($currency);

      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

                      $fieldModel = $recordModel->getField($field['field']);

      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

              $balanceFieldName = 'inventorybalance';

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

              $moduleInstance = Vtiger_Module_Model::getInstance('Accounts');

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

                  $symbol = $selectedCurrency['currency_symbol'];

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

           * @param int|null $currencyId

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

                  $html = $viewer->view('InventoryLimitAlert.tpl', $moduleName, true);

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

              $currencyId = $request->getInteger('currency_id');

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

           * @param string   $moduleName

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

                  $info = self::getRecordDetail($request->getInteger('record'), $currencyId, $moduleName, $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

                  'id' => $recordId,

      Line exceeds 120 characters; contains 121 characters
      Open

          public static function getRecordDetail(int $recordId, ?int $currencyId, string $moduleName, string $fieldName): array

      Line exceeds 120 characters; contains 165 characters
      Open

                          $autoFields[$field['tofield']] = $fieldModel->isReferenceField() ? $fieldValue : $fieldModel->getEditViewDisplayValue($fieldValue, $recordModel);

      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

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

              $eventHandler = new App\EventHandler();

      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

                  'info' => $info,

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

              $info = $eventHandler->getParam('info');

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

           * @throws \App\Exceptions\NoPermittedToRecord

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

           */

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

              $data = $recordModel->getInventoryData();

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

                  $item['basetableid'] = Vtiger_Module_Model::getInstance($item['moduleName'])->get('basetableid');

      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;

      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 ($fieldModel && ($fieldValue = $recordModel->get($field['field']))) {

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

              $info['autoFields'] = $autoFields;

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

                  'moduleName' => $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

           * @param \App\Request $request

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

          public function getTableData(App\Request $request)

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

              $response = new Vtiger_Response();

      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->assign('LIMIT', $limit);

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

              }

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

                  foreach ($request->getArray('idlist', 'Integer') as $id) {

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

              $recordModel = Vtiger_Record_Model::getInstanceById($recordId);

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

              if ($autoCompleteField = ($inventory->getAutoCompleteFields()[$recordModuleName] ?? [])) {

      Line exceeds 120 characters; contains 135 characters
      Open

                          $autoFields[$field['tofield'] . 'Text'] = $fieldModel->getDisplayValue($fieldValue, $recordId, $recordModel, true);

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

                  if (false === strpos($recordModel->get('taxes'), ',')) {

      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

                      'type' => 'group',

      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

                  $item['moduleName'] = \App\Record::getType($item['info']['id']);

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

          }

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

           */

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

              if (!$limitField->isActiveField() || !$balanceField->isActiveField()) {

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

              }

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

              $response = new Vtiger_Response();

      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 detail for inventory table.

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

           * @param int      $recordId

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

              $recordModuleName = $recordModel->getModuleName();

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

           * @throws \App\Exceptions\IllegalValue

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

              $srcModule = $request->getByType('src_module', \App\Purifier::ALNUM);

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

              foreach ($data as &$item) {

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

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

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

              $limitField = Vtiger_Field_Model::getInstance($limitFieldName, $moduleInstance);

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

                  $response->setResult(['status' => true]);

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

                  return;

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

              $symbol = $baseCurrency['currency_symbol'];

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

              }

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

           * @throws \App\Exceptions\NoPermittedToRecord

      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

                  $response->emit();

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

              $response->setResult([

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

              if ($request->isEmpty('idlist')) {

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

                  'description' => $recordModel->get('description'),

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

                          $autoFields[$field['tofield'] . 'Text'] = $fieldModel->getDisplayValue($fieldValue, $recordId, $recordModel, true);

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

                      }

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

                      $productTaxes = explode(',', $recordModel->get('taxes'));

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

                      'value' => $taxModel->get('value'),

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

              $srcRecord = $request->getInteger('src_record');

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

              if (!\App\Privilege::isPermitted($srcModule, 'DetailView', $srcRecord)) {

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

          public function checkPermission(App\Request $request)

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

          {

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

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

              $limitID = $recordModel->get($limitFieldName);

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

                  $viewer->assign('PRICE', $price);

      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 (!$recordModel->isViewable()) {

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

                  foreach ($autoCompleteField as $field) {

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

                  $info['taxes'] = [

      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->setModuleName($recordModuleName);

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

                  'currencyId' => $currencyId,

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

           * Get products and services from source invoice to display in correcting invoice before block.

      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

          {

      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

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

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

              }

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

              }

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

              $baseCurrency = Vtiger_Util_Helper::getBaseCurrency();

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

                  $viewer = new Vtiger_Viewer();

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

                  $viewer->assign('TOTALS', $totalPrice);

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

                  'status' => $status,

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

                  'html' => $html,

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

              $response->emit();

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

              if (!$recordModel->isEmpty('taxes')) {

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

              return [$recordId => array_merge($info, $inventory->getCustomAutoComplete($fieldName, $recordModel))];

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

           * Function verifies whether the Account's credit limit has been reached.

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

              $response = new Vtiger_Response();

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

                  $response->setResult(['status' => true]);

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

              if (!empty($limitID)) {

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

                  $limit = Vtiger_InventoryLimit_UIType::getValues($limitID)['value'];

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

              $totalPrice = $price + $balance;

      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

                      $info[] = self::getRecordDetail($id, $currencyId, $moduleName, $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

           * @return array

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

              $this->exposeMethod('getDetails');

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

              $this->exposeMethod('getTableData');

      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

              $balance = $recordModel->get($balanceFieldName);

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

              if ($baseCurrency['id'] != $currency) {

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

                  $viewer->assign('SYMBOL', $symbol);

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

          public function getDetails(App\Request $request)

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

              $fieldName = $request->getByType('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 ($request->isEmpty('src_record', true) || $request->isEmpty('src_module', true)) {

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

              $this->exposeMethod('checkLimits');

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

          }

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

           *

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

           * @param \App\Request $request

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

              $recordModel = Vtiger_Record_Model::getInstanceById($record, 'Accounts');

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

              if (!$status) {

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

           * @param string   $fieldName

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

                  'name' => App\Purifier::decodeHtml($recordModel->getName()),

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

              $inventory = Vtiger_Inventory_Model::getInstance($moduleName);

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

                      $taxModel = Settings_Inventory_Record_Model::getInstanceById($recordModel->get('taxes'), 'Taxes');

      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

              $recordModel = Vtiger_Record_Model::getInstanceById($srcRecord, $srcModule);

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

                  $item['info'] = $this->getRecordDetail($item['name'], $item['currency'] ?? 0, $request->getModule(), 'name')[$item['name']];

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

              if (!\App\Privilege::isPermitted($moduleName, 'EditView', $record)) {

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

              $price = $request->getByType('price', 'Double');

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

                  $response->emit();

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

              $response->emit();

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

          }

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

          public static function getRecordDetail(int $recordId, ?int $currencyId, string $moduleName, string $fieldName): array

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

                          $autoFields[$field['tofield']] = $fieldModel->isReferenceField() ? $fieldValue : $fieldModel->getEditViewDisplayValue($fieldValue, $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

                      $taxModel = Settings_Inventory_Record_Model::getInstanceById(reset($productTaxes), 'Taxes');

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

                  'fieldName' => $fieldName,

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

              }

      Line exceeds 120 characters; contains 136 characters
      Open

                  $item['info'] = $this->getRecordDetail($item['name'], $item['currency'] ?? 0, $request->getModule(), 'name')[$item['name']];

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

              $response->setResult($data);

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

      class Vtiger_Inventory_Action extends \App\Controller\Action

      There are no issues that match your filters.

      Category
      Status