YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Leads/models/Mapping.php

Summary

Maintainability
C
1 day
Test Coverage
F
0%

Function save has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function save($mapping)
    {
        $db = \App\Db::getInstance();
        $deleteMappingsList = $updateMappingsList = $createMappingsList = [];
        foreach ($mapping as $mappingDetails) {
Severity: Minor
Found in modules/Settings/Leads/models/Mapping.php - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function getMapping has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMapping($editable = false)
    {
        if (empty($this->mapping)) {
            $query = (new \App\Db\Query())->from('vtiger_convertleadmapping');
            if ($editable) {
Severity: Minor
Found in modules/Settings/Leads/models/Mapping.php - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

    public function save($mapping)
    {
        $db = \App\Db::getInstance();
        $deleteMappingsList = $updateMappingsList = $createMappingsList = [];
        foreach ($mapping as $mappingDetails) {
Severity: Minor
Found in modules/Settings/Leads/models/Mapping.php - About 1 hr to fix

    Method getMapping has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getMapping($editable = false)
        {
            if (empty($this->mapping)) {
                $query = (new \App\Db\Query())->from('vtiger_convertleadmapping');
                if ($editable) {
    Severity: Minor
    Found in modules/Settings/Leads/models/Mapping.php - About 1 hr to fix

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

          public function save($mapping)
          {
              $db = \App\Db::getInstance();
              $deleteMappingsList = $updateMappingsList = $createMappingsList = [];
              foreach ($mapping as $mappingDetails) {

      CyclomaticComplexity

      Since: 0.1

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

      Example

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

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

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

          public function save($mapping)

      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

      Missing class import via use statement (line '211', column '80').
      Open

                  $db->createCommand()->update('vtiger_convertleadmapping', ['leadfid' => new yii\db\Expression($leadExpression), 'accountfid' => new yii\db\Expression($accountExpression)], ['editable' => 1])->execute();

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

          public function getMapping($editable = false)

      BooleanArgumentFlag

      Since: 1.4.0

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

      Example

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

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

      Missing class import via use statement (line '140', column '22').
      Open

              $dataReader = (new App\Db\Query())->select(['fieldid', 'fieldlabel', 'uitype', 'typeofdata', 'fieldname', 'tablename', 'tabid'])

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

          public static function getInstance($editable = false)

      BooleanArgumentFlag

      Since: 1.4.0

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

      Example

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

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

      Missing class import via use statement (line '211', column '136').
      Open

                  $db->createCommand()->update('vtiger_convertleadmapping', ['leadfid' => new yii\db\Expression($leadExpression), 'accountfid' => new yii\db\Expression($accountExpression)], ['editable' => 1])->execute();

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

          public static function deleteMapping($mappingIdsList, $editableParam = false)

      BooleanArgumentFlag

      Since: 1.4.0

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

      Example

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

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

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

                  $query = (new \App\Db\Query())->from('vtiger_convertleadmapping');

      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 '222', column '22').
      Open

              $dataReader = (new \App\Db\Query())->select(['accountfid'])->from('vtiger_convertleadmapping')

      MissingImport

      Since: 2.7.0

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

      Example

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

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

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

              } else {
                  $params = ['cfmid' => $mappingIdsList];
              }

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

              return [Vtiger_Link_Model::getInstanceFromValues([
                  'linktype' => 'DETAIL_VIEW_BASIC',
                  'linklabel' => 'LBL_DELETE',
                  'linkurl' => 'javascript:Settings_LeadMapping_Js.triggerDelete(event,"' . $this->getMappingDeleteUrl() . '")',
                  'linkicon' => '',

      StaticAccess

      Since: 1.4.0

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

      Example

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

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

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

              return [Vtiger_Link_Model::getInstanceFromValues([
                  'linktype' => 'DETAIL_VIEW_BASIC',
                  'linklabel' => 'LBL_EDIT',
                  'linkurl' => 'javascript:Settings_LeadMapping_Js.triggerEdit("' . $this->getEditViewUrl() . '")',
                  'linkicon' => '',

      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_Leads_Field_Model' in method 'getFieldsInfo'.
      Open

                      $fieldModel = Settings_Leads_Field_Model::getCleanInstance();

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

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

              $leadModel = Vtiger_Module_Model::getInstance($this->getName());

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

                              if ((\array_key_exists('deletable', $mappingDetails)) || !$mappingDetails['account']) {

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

                      array_push($fieldIdsList, $mappingDetails['leadfid'], $mappingDetails['accountfid']);

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

                      array_push($fieldIdsList, $mappingDetails['leadfid'], $mappingDetails['accountfid']);

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

                  $query = (new \App\Db\Query())->from('vtiger_convertleadmapping');

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

                      $mapping[$row['cfmid']] = $row;

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

                      $query->where(['editable' => 1]);

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

              $dataReader = (new App\Db\Query())->select(['fieldid', 'fieldlabel', 'uitype', 'typeofdata', 'fieldname', 'tablename', 'tabid'])

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

              $dataReader = (new App\Db\Query())->select(['fieldid', 'fieldlabel', 'uitype', 'typeofdata', 'fieldname', 'tablename', 'tabid'])

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

              return ['Leads' => 'Leads', 'Type' => 'Type', 'Accounts' => 'Accounts'];

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

              $dataReader = (new App\Db\Query())->select(['fieldid', 'fieldlabel', 'uitype', 'typeofdata', 'fieldname', 'tablename', 'tabid'])

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

          public $name = 'Leads';

      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 "index.php?parent=" 3 times.
      Open

              return 'index.php?parent=' . $this->getParentName() . '&module=' . $this->getName() . '&view=MappingDetail';

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

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

      Noncompliant Code Example

      With the default threshold of 3:

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

      Compliant Solution

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

      Exceptions

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

      Define a constant instead of duplicating this literal "&module=" 3 times.
      Open

              return 'index.php?parent=' . $this->getParentName() . '&module=' . $this->getName() . '&view=MappingDetail';

      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.

      Saw unextractable annotation for comment '* @return <array> list of mapping link models <vtiger_link_model>'</vtiger_link_model></array>
      Open

           * @return <Array> list of mapping link models <Vtiger_Link_Model>

      Saw unextractable annotation for comment '* @return <array> list of mapping details'</array>
      Open

           * @return <Array> list of mapping details

      Saw unextractable annotation for comment '* @return <settings_leads_mapping_model>'</settings_leads_mapping_model>
      Open

           * @return <Settings_Leads_Mapping_Model>

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

                      $mapping[$row['cfmid']] = $row;

      Saw possibly unextractable annotation for a fragment of comment '* @param bool true/false': after bool, did not see an element name (will guess based on comment order)
      Open

           * @param bool true/false

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

                      $accountExpression .= " WHEN cfmid = {$db->quoteValue($mappingId)} THEN {$db->quoteValue($mappingDetails['account'])}";
      Severity: Critical
      Found in modules/Settings/Leads/models/Mapping.php by phan

      Call to method __construct from undeclared class \yii\db\Expression
      Open

                  $db->createCommand()->update('vtiger_convertleadmapping', ['leadfid' => new yii\db\Expression($leadExpression), 'accountfid' => new yii\db\Expression($accountExpression)], ['editable' => 1])->execute();
      Severity: Critical
      Found in modules/Settings/Leads/models/Mapping.php by phan

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

                  $db->createCommand()->update('vtiger_convertleadmapping', ['leadfid' => new yii\db\Expression($leadExpression), 'accountfid' => new yii\db\Expression($accountExpression)], ['editable' => 1])->execute();
      Severity: Critical
      Found in modules/Settings/Leads/models/Mapping.php by phan

      Saw unextractable annotation for comment '* @param <array> list of field ids'</array>
      Open

           * @param  <Array> list of field ids

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

                  $query = (new \App\Db\Query())->from('vtiger_convertleadmapping');
      Severity: Critical
      Found in modules/Settings/Leads/models/Mapping.php by phan

      Saw unextractable annotation for comment '* @return <settings_leads_mapping_model>'</settings_leads_mapping_model>
      Open

           * @return <Settings_Leads_Mapping_Model>

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

              $dataReader = (new \App\Db\Query())->select(['accountfid'])->from('vtiger_convertleadmapping')
      Severity: Critical
      Found in modules/Settings/Leads/models/Mapping.php by phan

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

              \App\Db::getInstance()->createCommand()->delete('vtiger_convertleadmapping', $params)->execute();
      Severity: Critical
      Found in modules/Settings/Leads/models/Mapping.php by phan

      Saw unextractable annotation for comment '* @return <array> list of field info'</array>
      Open

           * @return <Array> list of field info

      Saw unextractable annotation for comment '* @return <array> list of detail view link models <vtiger_link_model>'</vtiger_link_model></array>
      Open

           * @return <Array> list of detail view link models <Vtiger_Link_Model>

      Reference to undeclared property \Settings_Leads_Mapping_Model->mapping (Did you mean $mapping)
      Open

              return $this->mapping;

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

                      $leadExpression .= " WHEN cfmid = {$db->quoteValue($mappingId)} THEN {$db->quoteValue($mappingDetails['lead'])}";
      Severity: Critical
      Found in modules/Settings/Leads/models/Mapping.php by phan

      Saw unextractable annotation for comment '* @return <array> headers list'</array>
      Open

           * @return <Array> headers list

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

                  $db->createCommand()->batchInsert('vtiger_convertleadmapping', ['leadfid', 'accountfid'], $insertedData)
      Severity: Critical
      Found in modules/Settings/Leads/models/Mapping.php by phan

      Reference to undeclared property \Settings_Leads_Mapping_Model->mapping
      Open

              if (empty($this->mapping)) {

      Reference to undeclared property \Settings_Leads_Mapping_Model->mapping (Did you mean $mapping)
      Open

                  $this->mapping = $finalMapping;

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

              $dataReader = (new App\Db\Query())->select(['fieldid', 'fieldlabel', 'uitype', 'typeofdata', 'fieldname', 'tablename', 'tabid'])
      Severity: Critical
      Found in modules/Settings/Leads/models/Mapping.php by phan

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

      class Settings_Leads_Mapping_Model extends Settings_Vtiger_Module_Model

      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_Leads_Mapping_Model is not named in CamelCase.
      Open

      class Settings_Leads_Mapping_Model extends Settings_Vtiger_Module_Model
      {
          public $name = 'Leads';
      
          /**

      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

           * Function to get edit view url of this model.

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

              return 'index.php?parent=' . $this->getParentName() . '&module=' . $this->getName() . '&view=MappingEdit';

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

              return ['Leads' => 'Leads', 'Type' => 'Type', 'Accounts' => 'Accounts'];

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

                  'linktype' => 'DETAIL_VIEW_BASIC',

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

           *

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

           * Function to get list of detail view link models.

      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 string url

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

           * @return string url

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

          public function getMappingDeleteUrl()

      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

           * Function to get detail view url of this 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

                  'linkicon' => '',

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

      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 <Array> list of detail view link models <Vtiger_Link_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

                  'linkurl' => 'javascript:Settings_LeadMapping_Js.triggerEdit("' . $this->getEditViewUrl() . '")',

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

              return 'index.php?parent=' . $this->getParentName() . '&module=' . $this->getName() . '&view=MappingDetail';

      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

           * Function to get delete url of this mapping model.

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

           * Function to get headers for detail view.

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

           * @return <Array> headers list

      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_EDIT',

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

           */

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

          /**

      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

           * @return string url

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

              return [Vtiger_Link_Model::getInstanceFromValues([

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

          public function getEditViewUrl()

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

          public function getDetailViewLinks()

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

           * @return <Array> list of mapping link models <Vtiger_Link_Model>

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

          public function getMappingLinks()

      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 getMapping($editable = false)

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

                  foreach ($mapping as $mappingDetails) {

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

                              'editable' => $mappingDetails['editable'],

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

                              } elseif ($mappingDetails['account']) {

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

                  $accountExpression .= ' ELSE accountfid END';

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

      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

                  'linkicon' => '',

      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> list of mapping details

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

                      $mapping[$row['cfmid']] = $row;

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

                      if (isset($fieldLabelsList[$mappingDetails['leadfid']])) {

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

              $dataReader = (new App\Db\Query())->select(['fieldid', 'fieldlabel', 'uitype', 'typeofdata', 'fieldname', 'tablename', 'tabid'])

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

                  }

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

                      $mappingDetails = $createMappingsList[$i];

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

                  $db->createCommand()->batchInsert('vtiger_convertleadmapping', ['leadfid', 'accountfid'], $insertedData)

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

                  $leadExpression .= ' ELSE leadfid END';

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

                  $db->createCommand()->update('vtiger_convertleadmapping', ['leadfid' => new yii\db\Expression($leadExpression), 'accountfid' => new yii\db\Expression($accountExpression)], ['editable' => 1])->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

                      $query->where(['editable' => 1]);

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

                  }

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

                              'Accounts' => $fieldLabelsList[$mappingDetails['accountfid']] ?? null,

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

                  $fieldLabelsList[$rowData['fieldid']] = $fieldInfo;

      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 list of field ids

      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

                  'linklabel' => 'LBL_DELETE',

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

                  }

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

                                  $updateMappingsList[] = $mappingDetails;

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

              while ($accountfId = $dataReader->readColumn(0)) {

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

                  if ($accountfId) {

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

          public $name = 'Leads';

      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 'index.php?parent=' . $this->getParentName() . '&module=' . $this->getName() . '&action=MappingDelete';

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

          }

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

           * Function to get list of mapping link models.

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

           * @param mixed $editable

      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

                  $fieldLabelsList = [];

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

                  if (!empty($fieldIdsList)) {

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

          {

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

                          } elseif ($mappingDetails['account']) {

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

              if ($createMappingsList) {

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

                  $count = \count($createMappingsList);

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

                      $accountExpression .= " WHEN cfmid = {$db->quoteValue($mappingId)} THEN {$db->quoteValue($mappingDetails['account'])}";

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

                      $restrictedIdsList[] = $accountfId;

      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

           * @param mixed $fieldIdsList

      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 ($mapping as $mappingDetails) {

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

                  if (\is_array($mappingDetails)) {

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

                      if ($mappingDetails['lead']) {

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

                                  $deleteMappingsList[] = $mappingId;

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

                              $createMappingsList[] = $mappingDetails;

      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

                  foreach ($updateMappingsList as $mappingDetails) {

      Line exceeds 120 characters; contains 214 characters
      Open

                  $db->createCommand()->update('vtiger_convertleadmapping', ['leadfid' => new yii\db\Expression($leadExpression), 'accountfid' => new yii\db\Expression($accountExpression)], ['editable' => 1])->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

              return $instance;

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

           * Function to delate the mapping.

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

              if ($editableParam) {

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

                  if ($editable) {

      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

                  $finalMapping = $fieldIdsList = [];

      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->mapping = $finalMapping;

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

           *

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

                  $fieldInfo = ['id' => $rowData['fieldid'], 'label' => $rowData['fieldlabel']];

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

                      $fieldInfo['fieldDataType'] = $fieldModel->getFieldDataType();

      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 save($mapping)

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

                      $insertedData[] = [$mappingDetails['lead'], $mappingDetails['account']];

      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

                  }

      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 ['Accounts'];

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

          }

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

              } else {

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

          {

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

                  'linktype' => 'DETAIL_VIEW_BASIC',

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

           *

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

                      array_push($fieldIdsList, $mappingDetails['leadfid'], $mappingDetails['accountfid']);

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

                  foreach ($mapping as $mappingId => $mappingDetails) {

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

                  }

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

                  ->createCommand()->query();

      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

           * @param array $mapping info

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

              }

      Line exceeds 120 characters; contains 135 characters
      Open

                      $accountExpression .= " WHEN cfmid = {$db->quoteValue($mappingId)} THEN {$db->quoteValue($mappingDetails['account'])}";

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

          /**

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

              $restrictedIdsList = [];

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

              }

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

           * Function to get mapping supported modules list.

      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

                  $query = (new \App\Db\Query())->from('vtiger_convertleadmapping');

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

              return $this->mapping;

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

           * @return <Array> list of field info

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

              $leadId = $leadModel->getId();

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

                      $fieldModel->set('typeofdata', $rowData['typeofdata']);

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

           * Function to save the mapping 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

          {

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

                  for ($i = 0; $i < $count; ++$i) {

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

                      $mappingId = $mappingDetails['mappingId'];

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

                      $leadExpression .= " WHEN cfmid = {$db->quoteValue($mappingId)} THEN {$db->quoteValue($mappingDetails['lead'])}";

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

              $dataReader = (new \App\Db\Query())->select(['accountfid'])->from('vtiger_convertleadmapping')

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

           * Function to get 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

              $instance = new self();

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

              return 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

                  $params = ['cfmid' => $mappingIdsList];

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

              \App\Db::getInstance()->createCommand()->delete('vtiger_convertleadmapping', $params)->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 static function getInstance($editable = false)

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

              }

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

           *

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

              if (empty($this->mapping)) {

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

                  }

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

                      $fieldLabelsList = $this->getFieldsInfo(array_unique($fieldIdsList));

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

          /**

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

                      $fieldModel = Settings_Leads_Field_Model::getCleanInstance();

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

              $deleteMappingsList = $updateMappingsList = $createMappingsList = [];

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

                      $mappingId = $mappingDetails['mappingId'] ?? '';

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

                          if ($mappingId) {

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

           * Function to get restricted field ids list.

      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

          public static function getCleanInstance()

      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

           * Function to get fields info.

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

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

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

                      $fieldModel->set('name', $rowData['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 $fieldLabelsList;

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

                  $insertedData = [];

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

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

              $fieldLabelsList = [];

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

              }

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

                  ->createCommand()->query();

      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

              return $restrictedIdsList;

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

                  $leadExpression = 'CASE ';

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

          public static function getRestrictedFieldIdsList()

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

           * @param bool true/false

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

          {

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

           * @param mixed $editable

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

           * Function to get instance.

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

              return [Vtiger_Link_Model::getInstanceFromValues([

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

              $leadModel = Vtiger_Module_Model::getInstance($this->getName());

      Line exceeds 120 characters; contains 136 characters
      Open

              $dataReader = (new App\Db\Query())->select(['fieldid', 'fieldlabel', 'uitype', 'typeofdata', 'fieldname', 'tablename', 'tabid'])

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

                      $fieldModel->set('uitype', $rowData['uitype']);

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

                  }

      Line exceeds 120 characters; contains 129 characters
      Open

                      $leadExpression .= " WHEN cfmid = {$db->quoteValue($mappingId)} THEN {$db->quoteValue($mappingDetails['lead'])}";

      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

          /**

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

          {

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

          /**

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

          public static function deleteMapping($mappingIdsList, $editableParam = false)

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

                              'Leads' => $fieldLabelsList[$mappingDetails['leadfid']],

      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 getFieldsInfo($fieldIdsList)

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

                  if ((int) $rowData['tabid'] === $leadId) {

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

                              if ((\array_key_exists('deletable', $mappingDetails)) || !$mappingDetails['account']) {

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

          public static function getSupportedModulesList()

      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 array $mappingIdsList

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

           */

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

                  ->where(['fieldid' => $fieldIdsList, 'presence' => [0, 2]])

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

                      $fieldModel->set('table', $rowData['tablename']);

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

                              }

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

                  self::deleteMapping($deleteMappingsList, true);

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

                  $accountExpression = 'CASE ';

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

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

           * @param bool  $editableParam

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

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

      Line exceeds 120 characters; contains 122 characters
      Open

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

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

           * Function to get mapping details.

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

          {

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

                          $finalMapping[$mappingId] = [

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

           * @param  <Array> list of field ids

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

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

              if ($deleteMappingsList) {

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

           */

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

                  ->where(['editable' => 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

           *

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

                  $params = ['cfmid' => $mappingIdsList, 'editable' => 1];

      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

              $instance->getMapping($editable);

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

      class Settings_Leads_Mapping_Model extends Settings_Vtiger_Module_Model

      There are no issues that match your filters.

      Category
      Status