YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Currency/models/Record.php

Summary

Maintainability
A
2 hrs
Test Coverage
A
91%

Method save has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function save()
    {
        $db = \App\Db::getInstance();
        $id = $this->getId();
        $tableName = Settings_Currency_Module_Model::TABLE_NAME;
Severity: Minor
Found in modules/Settings/Currency/models/Record.php - About 1 hr to fix

    Method getRecordLinks has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getRecordLinks(): array
        {
            $links = $recordLinks = [];
            if ($this->isBaseCurrency()) {
                //NO Edit and delete link for base currency
    Severity: Minor
    Found in modules/Settings/Currency/models/Record.php - About 1 hr to fix

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

          public static function getAllNonMapped($includedIds = [])
          {
              if (!\is_array($includedIds)) {
                  if (!empty($includedIds)) {
                      $includedIds = [$includedIds];
      Severity: Minor
      Found in modules/Settings/Currency/models/Record.php - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

              $db = (new App\Db\Query())->from(Settings_Currency_Module_Model::TABLE_NAME);

      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 '189', column '17').
      Open

              $query = (new \App\Db\Query())->select(['vtiger_currencies.*'])->from('vtiger_currencies')->leftJoin('vtiger_currency_info', 'vtiger_currency_info.currency_name = vtiger_currencies.currency_name')->where(['or', ['vtiger_currency_info.currency_name' => null], ['vtiger_currency_info.deleted' => 1]]);

      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 '214', column '17').
      Open

              $query = (new App\Db\Query())->from(Settings_Currency_Module_Model::TABLE_NAME)

      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 'vtlib\Utils' in method 'getInstance'.
      Open

              if (vtlib\Utils::isNumber($id)) {

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

              } else {
                  $db->createCommand()
                      ->insert($tableName, [
                          'currency_name' => $this->get('currency_name'),
                          'currency_code' => $this->get('currency_code'),

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

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

                  } else {
                      $includedIds = [];
                  }

      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\Db' in method 'save'.
      Open

              $db = \App\Db::getInstance();

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

              } else {
                  $query = $db->where(['currency_name' => $id]);
              }

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

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

                  $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

      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\Fields\Currency' in method 'save'.
      Open

              \App\Fields\Currency::clearCache();

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

                  'linkicon' => 'fas fa-redo-alt',

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

                      'conversion_rate' => $this->isBaseCurrency() ? 1 : $this->get('conversion_rate'),

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

              return ('-11' != $this->get('defaultid')) ? false : 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.

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

                  'linkurl' => "javascript:Settings_Currency_Js.triggerDefault(event, '" . $this->getId() . "')",

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

                      'currency_symbol' => $this->get('currency_symbol'),

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

                  'linklabel' => 'LBL_SET_AS_DEFAULT',

      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 "currency_status" 5 times.
      Open

                      'currency_status' => $this->get('currency_status'),

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

                      'currency_code' => $this->get('currency_code'),

      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 "deleted" 5 times.
      Open

              if ($this->has('deleted')) {

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

                  'linkclass' => 'btn-warning btn-sm',

      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 "currency_name" 6 times.
      Open

              return $this->get('currency_name');

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

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

                  $db->createCommand()->update($tableName, [

      Return type of getInstance() is undeclared type \self
      Open

          public static function getInstance($id)

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

              $query = (new App\Db\Query())->from(Settings_Currency_Module_Model::TABLE_NAME)

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

                      $db->createCommand()->update($tableName, ['defaultid' => 0], ['and', ['defaultid' => -11], ['not', ['id' => $id]]])->execute();

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

                  $db->createCommand()

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

              $query = (new \App\Db\Query())->select(['vtiger_currencies.*'])->from('vtiger_currencies')->leftJoin('vtiger_currency_info', 'vtiger_currency_info.currency_name = vtiger_currencies.currency_name')->where(['or', ['vtiger_currency_info.currency_name' => null], ['vtiger_currency_info.deleted' => 1]]);

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

              $db = (new App\Db\Query())->from(Settings_Currency_Module_Model::TABLE_NAME);

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

      class Settings_Currency_Record_Model extends Settings_Vtiger_Record_Model

      Avoid variables with short names like $id. Configured minimum length is 3.
      Open

          public static function getInstance($id)

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

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

      Avoid variables with short names like $db. Configured minimum length is 3.
      Open

              $db = \App\Db::getInstance();

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

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

      The class Settings_Currency_Record_Model is not named in CamelCase.
      Open

      class Settings_Currency_Record_Model extends Settings_Vtiger_Record_Model
      {
          /**
           * Changes value.
           *

      CamelCaseClassName

      Since: 0.2

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

      Example

      class class_name {
      }

      Source

      Avoid variables with short names like $id. Configured minimum length is 3.
      Open

              $id = $this->getId();

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

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

      Avoid variables with short names like $db. Configured minimum length is 3.
      Open

              $db = (new App\Db\Query())->from(Settings_Currency_Module_Model::TABLE_NAME);

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

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

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

           * @return bool

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

           */

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

                  'linklabel' => 'LBL_DELETE',

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

                  'linkclass' => 'btn-sm btn-danger',

      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

          /**

      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

              $recordLinks[] = [

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

                  'linkicon' => 'fas fa-trash-alt',

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

              return 0;

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

                      'currency_status' => $this->get('currency_status'),

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

                      ->insert($tableName, [

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

                      ])->execute();

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

              \App\Fields\Currency::clearCache();

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

              $recordLinks[] = [

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

                  'linkclass' => 'btn-info btn-sm',

      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

              foreach ($recordLinks as $recordLink) {

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

                      'currency_symbol' => $this->get('currency_symbol'),

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

                          'currency_name' => $this->get('currency_name'),

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

           *

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

           * @return \self

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

           * @return int|null

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

              return $this->get('id');

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

           * @return string

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

              return $this->get('currency_name');

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

          }

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

                  $this->changes[$key] = $this->get($key);

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

              return $this;

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

           */

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

                  return $instance;

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

          /**

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

          public function isBaseCurrency()

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

              $recordLinks[] = [

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

                  'linkurl' => "javascript:Settings_Currency_Js.triggerDefault(event, '" . $this->getId() . "')",

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

                  $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

      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 (null !== $this->getId() && $this->value[$key] !== $value) {

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

                      'defaultid' => $this->get('defaultid'),

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

                      'deleted' => $this->getDeleteStatus(),

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

                          'currency_code' => $this->get('currency_code'),

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

              $row = $query->createCommand()->queryOne();

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

                  $instance = new self();

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

          }

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

           * Changes value.

      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 currency id.

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

          public function getRecordLinks(): array

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

              }

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

          }

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

                      'currency_name' => $this->get('currency_name'),

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

                      $db->createCommand()->update($tableName, ['defaultid' => 0], ['and', ['defaultid' => -11], ['not', ['id' => $id]]])->execute();

      Line exceeds 120 characters; contains 143 characters
      Open

                      $db->createCommand()->update($tableName, ['defaultid' => 0], ['and', ['defaultid' => -11], ['not', ['id' => $id]]])->execute();

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

           */

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

          public function getId()

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

           * Return currency name.

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

              $this->value[$key] = $value;

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

          {

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

                  $db->createCommand()

      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

                  'linkurl' => "javascript:Settings_Currency_Js.triggerDelete(event,'" . $this->getId() . "')",

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

              if (!empty($id)) {

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

              if (vtlib\Utils::isNumber($id)) {

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

                  $query = $db->where(['currency_name' => $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

          {

      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 = $recordLinks = [];

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

                  'linklabel' => 'LBL_EDIT',

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

           * Populate changes to database.

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

           * @param int $id

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

              return ('-11' != $this->get('defaultid')) ? false : 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

          /** {@inheritdoc} */

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

          public function set($key, $value)

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

          public function save()

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

              $tableName = Settings_Currency_Module_Model::TABLE_NAME;

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

                          'conversion_rate' => $this->get('conversion_rate'),

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

          public static function getInstance($id)

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

          public function getName()

      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

                  'linklabel' => 'LBL_SET_AS_DEFAULT',

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

                  'linkclass' => 'btn-warning btn-sm',

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

           *

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

                      'currency_code' => $this->get('currency_code'),

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

          /**

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

          protected $changes = [];

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

          }

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

           */

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

                  return $this->get('deleted');

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

              //by default non deleted

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

              $db = \App\Db::getInstance();

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

              $id = $this->getId();

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

                  $db->createCommand()->update($tableName, [

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

                  if (isset($this->changes['defaultid'])) {

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

                          'defaultid' => 0,

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

                  $id = $db->getLastInsertID('vtiger_currency_info_id_seq');

      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

           * Check if currency is base.

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

              if ($this->isBaseCurrency()) {

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

                  'linkicon' => 'fas fa-redo-alt',

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

          public function getDeleteStatus()

      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' => $id])->execute();

      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

                          'currency_symbol' => $this->get('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

              $db = (new App\Db\Query())->from(Settings_Currency_Module_Model::TABLE_NAME);

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

              return $currencyModelList;

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

          public static function getAll($excludedIds = [])

      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

                  //NO Edit and delete link for base 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

           * return delete state of 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

           * @return int

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

          {

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

              if ($this->has('deleted')) {

      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

              if ($row) {

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

                  $instance->setData($row);

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

                  $query->orWhere(['vtiger_currency_info.id' => $includedIds]);

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

           * @return \Settings_Currency_Record_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

          {

      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

                          'currency_status' => $this->get('currency_status'),

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

                          'deleted' => 0,

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

          }

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

           * Returns instance of self.

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

                  $query = $db->where(['id' => $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

           * @return \Settings_Currency_Record_Model[]

      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

                  $query->andWhere(['<>', 'id', $excludedIds]);

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

              $instanceList = [];

      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 getAllNonMapped($includedIds = [])

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

           * @var array

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

          {

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

              }

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

                  'linkurl' => "javascript:Settings_Currency_Js.triggerEdit(event, '" . $this->getId() . "')",

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

           * @return int

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

                      'conversion_rate' => $this->isBaseCurrency() ? 1 : $this->get('conversion_rate'),

      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 $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 (!empty($excludedIds)) {

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

                      $includedIds = [$includedIds];

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

                  $modelInstance->setData($row);

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

           * @param array $excludedIds

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

              $query = (new \App\Db\Query())->select(['vtiger_currencies.*'])->from('vtiger_currencies')->leftJoin('vtiger_currency_info', 'vtiger_currency_info.currency_name = vtiger_currencies.currency_name')->where(['or', ['vtiger_currency_info.currency_name' => null], ['vtiger_currency_info.deleted' => 1]]);

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

                  $modelInstance = new self();

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

      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 all non mapped currences.

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

              while ($row = $dataReader->read()) {

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

           *

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

           */

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

              }

      Line exceeds 120 characters; contains 307 characters
      Open

              $query = (new \App\Db\Query())->select(['vtiger_currencies.*'])->from('vtiger_currencies')->leftJoin('vtiger_currency_info', 'vtiger_currency_info.currency_name = vtiger_currencies.currency_name')->where(['or', ['vtiger_currency_info.currency_name' => null], ['vtiger_currency_info.deleted' => 1]]);

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

                  ->where(['deleted' => 0, 'currency_status' => 'Active']);

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

          }

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

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

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

                  $instanceList[$row['id']] = new self($row);

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

              $dataReader->close();

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

           *

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

           *

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

                  if (!empty($includedIds)) {

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

              if (!empty($includedIds)) {

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

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

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

              }

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

          /**

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

              $dataReader->close();

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

           * @param array $includedIds

      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 (!\is_array($includedIds)) {

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

              }

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

              $currencyModelList = [];

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

                  $currencyModelList[$row['currencyid']] = $modelInstance;

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

                      $includedIds = [];

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

              $query = (new App\Db\Query())->from(Settings_Currency_Module_Model::TABLE_NAME)

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

              }

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

              while ($row = $dataReader->read()) {

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

           * Return currences.

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

      class Settings_Currency_Record_Model extends Settings_Vtiger_Record_Model

      There are no issues that match your filters.

      Category
      Status