YetiForceCompany/YetiForceCRM

View on GitHub
modules/OSSMailView/models/Record.php

Summary

Maintainability
D
2 days
Test Coverage
F
7%

File Record.php has 337 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * OSSMailView record model class.
 *
Severity: Minor
Found in modules/OSSMailView/models/Record.php - About 4 hrs to fix

    The class OSSMailView_Record_Model has 14 public methods. Consider refactoring OSSMailView_Record_Model to keep number of public methods under 10.
    Open

    class OSSMailView_Record_Model extends Vtiger_Record_Model
    {
        const TYPE_COLORS = [
            0 => 'bgGreen',
            1 => 'bgDanger',
    Severity: Minor
    Found in modules/OSSMailView/models/Record.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

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

    The class OSSMailView_Record_Model has an overall complexity of 71 which is very high. The configured complexity threshold is 50.
    Open

    class OSSMailView_Record_Model extends Vtiger_Record_Model
    {
        const TYPE_COLORS = [
            0 => 'bgGreen',
            1 => 'bgDanger',
    Severity: Minor
    Found in modules/OSSMailView/models/Record.php by phpmd

    Function findEmail has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        public function findEmail(int $record, string $module): string
        {
            if (!\App\Record::isExists($record)) {
                return false;
            }
    Severity: Minor
    Found in modules/OSSMailView/models/Record.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 findRecordsById has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        public function findRecordsById($ids)
        {
            $return = false;
            if (!empty($ids)) {
                $recordModelMailScanner = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
    Severity: Minor
    Found in modules/OSSMailView/models/Record.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

    Method showEmailsList has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
        {
            if ('All' === $filter || 'Contacts' === $filter) {
                $relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
                    ->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
    Severity: Major
    Found in modules/OSSMailView/models/Record.php - About 2 hrs to fix

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

          public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
          {
              if ('All' === $filter || 'Contacts' === $filter) {
                  $relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
                      ->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
      Severity: Minor
      Found in modules/OSSMailView/models/Record.php - About 2 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      OSSMailView_Record_Model has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class OSSMailView_Record_Model extends Vtiger_Record_Model
      {
          const TYPE_COLORS = [
              0 => 'bgGreen',
              1 => 'bgDanger',
      Severity: Minor
      Found in modules/OSSMailView/models/Record.php - About 2 hrs to fix

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

            public function findEmail(int $record, string $module): string
            {
                if (!\App\Record::isExists($record)) {
                    return false;
                }
        Severity: Minor
        Found in modules/OSSMailView/models/Record.php - About 1 hr to fix

          Method findRecordsById has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function findRecordsById($ids)
              {
                  $return = false;
                  if (!empty($ids)) {
                      $recordModelMailScanner = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
          Severity: Minor
          Found in modules/OSSMailView/models/Record.php - About 1 hr to fix

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

                public function findEmailInRelated(Vtiger_Record_Model $recordModel): string
                {
                    $relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, 'Contacts');
                    $query = $relationListView->getRelationQuery();
                    $tabIndex = $relationListView->getRelatedModuleModel()->getEntityInstance()->tab_name_index;
            Severity: Minor
            Found in modules/OSSMailView/models/Record.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 showEmailsList has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
            Severity: Minor
            Found in modules/OSSMailView/models/Record.php - About 35 mins to fix

              The method showEmailsList() has an NPath complexity of 6552. The configured NPath complexity threshold is 200.
              Open

                  public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
                  {
                      if ('All' === $filter || 'Contacts' === $filter) {
                          $relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
                              ->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              NPathComplexity

              Since: 0.1

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

              Example

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

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

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

                  public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
                  {
                      if ('All' === $filter || 'Contacts' === $filter) {
                          $relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
                              ->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              CyclomaticComplexity

              Since: 0.1

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

              Example

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

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

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

                  public function findEmail(int $record, string $module): string
                  {
                      if (!\App\Record::isExists($record)) {
                          return false;
                      }
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              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 24 to the 15 allowed.
              Open

                  public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

              See

              Class "OSSMailView_Record_Model" has 21 methods, which is greater than 20 authorized. Split it into smaller classes.
              Open

              class OSSMailView_Record_Model extends Vtiger_Record_Model

              A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

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

                  public function findRecordsById($ids)
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

              See

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

                  public function findEmail(int $record, string $module): string
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

              See

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

              class OSSMailView_Record_Model extends Vtiger_Record_Model
              {
                  const TYPE_COLORS = [
                      0 => 'bgGreen',
                      1 => 'bgDanger',
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              CouplingBetweenObjects

              Since: 1.1.0

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

              Example

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

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

              Missing class import via use statement (line '443', column '15').
              Open

                      return (new App\Db\Query())->select(['name' => 'vtiger_notes.title', 'file' => 'vtiger_notes.filename', 'id' => 'vtiger_notes.notesid'])
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              MissingImport

              Since: 2.7.0

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

              Example

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

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

              Missing class import via use statement (line '74', column '17').
              Open

                      $query = (new \App\Db\Query())->select(['vtiger_ossmailview.*'])->from('vtiger_ossmailview')
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              MissingImport

              Since: 2.7.0

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

              Example

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

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

              Missing class import via use statement (line '73', column '20').
              Open

                      $subQuery = (new \App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview_relation')->where(['crmid' => $relatedId, 'deleted' => 0]);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              MissingImport

              Since: 2.7.0

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

              Example

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

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

              Missing class import via use statement (line '332', column '15').
              Open

                      return (new App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview')->where($where)->scalar();
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              MissingImport

              Since: 2.7.0

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

              Example

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

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

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

                          $relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              MissingImport

              Since: 2.7.0

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

              Example

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

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

              Missing class import via use statement (line '345', column '17').
              Open

                      $query = (new App\Db\Query())->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.setype'])->from('vtiger_ossmailview_relation')->innerJoin('vtiger_crmentity', 'vtiger_ossmailview_relation.crmid = vtiger_crmentity.crmid')->where(['ossmailviewid' => $record, 'vtiger_crmentity.deleted' => 0]);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              MissingImport

              Since: 2.7.0

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

              Example

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

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

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

                      $exists = (new App\Db\Query())->from('s_#__mail_relation_updater')->where(['crmid' => $record])->exists();
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              MissingImport

              Since: 2.7.0

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

              Example

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

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

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

                                  $isExists = (new \App\Db\Query())->from('vtiger_leaddetails')->where(['leadid' => $id, 'converted' => 0])->exists();
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              MissingImport

              Since: 2.7.0

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

              Example

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

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

              Missing class import via use statement (line '262', column '17').
              Open

                      $query = (new \App\Db\Query())->from('vtiger_ossmailview_files')->where(['ossmailviewid' => $recordId]);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              MissingImport

              Since: 2.7.0

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

              Example

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

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

              Missing class import via use statement (line '390', column '9').
              Open

                          (new OSSMailView_Relation_Model())->addRelation((int) $params['mailId'], $newCrmId);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              MissingImport

              Since: 2.7.0

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

              Example

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

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

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

                          if (\App\Privilege::isPermitted('OSSMailView', 'DetailView', $row['ossmailviewid'])) {
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class '\App\PrivilegeQuery' in method 'showEmailsList'.
              Open

                      \App\PrivilegeQuery::getConditions($query, 'OSSMailView', false, $srecord);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class '\App\Mail\Rbl' in method 'showEmailsList'.
              Open

                              $rblInstance = \App\Mail\Rbl::getInstance([]);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                                  $firstLetter = '<span class="fas fa-exclamation-triangle text-danger" title="' . \App\Purifier::encodeHtml($verifySender['info']) . '"></span>';
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class 'App\TextUtils' in method 'showEmailsList'.
              Open

                              'teaser' => App\TextUtils::textTruncate(\App\Utils::htmlToText($content), 190),
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                  public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
                  {
                      if ('All' === $filter || 'Contacts' === $filter) {
                          $relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
                              ->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              IfStatementAssignment

              Since: 2.7.0

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

              Example

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

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

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

                      } else {
                          $emailFields = OSSMailScanner_Record_Model::getEmailSearch($module);
                          if (\count($emailFields) > 0) {
                              $recordModel = Vtiger_Record_Model::getInstanceById($record, $module);
                              foreach ($emailFields as $emailField) {
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              ElseExpression

              Since: 1.4.0

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

              Example

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

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

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

                              $recordModel = Vtiger_Record_Model::getInstanceById($record, $module);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class '\App\Language' in method 'removeRelated'.
              Open

                      return \App\Language::translate('Removed relationship', 'OSSMail');
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class 'App\ModuleHierarchy' in method 'showEmailsList'.
              Open

                      if (!$relatedId || false === App\ModuleHierarchy::getModuleLevel($smodule)) {
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class 'Users_Record_Model' in method 'addRelated'.
              Open

                      $currentUser = Users_Record_Model::getCurrentUserModel();
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                              $subject = \App\Purifier::encodeHtml($row['subject']);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class 'OSSMail_Record_Model' in method 'checkMailExist'.
              Open

                      $mail = OSSMail_Record_Model::getMail($mbox, $uid, false);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                          return App\Purifier::decodeHtml($value);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                          $content = \App\Purifier::purifyHtml(vtlib\Functions::getHtmlOrPlainText($row['content']));
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                              $subject = '<a href="index.php?module=OSSMailView&view=Preview&record=' . $row['ossmailviewid'] . '" target="' . $config['target'] . '"> ' . \App\Purifier::encodeHtml($row['subject']) . '</a>';
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class 'App\TextUtils' in method 'showEmailsList'.
              Open

                          $firstLetter = strtoupper(App\TextUtils::textTruncate(trim(strip_tags($from)), 1, false));
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                              'subjectRaw' => \App\Purifier::encodeHtml($row['subject']),
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                          $recordModelMailScanner = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class 'Vtiger_Relation_Model' in method 'getRelatedRecords'.
              Open

                              'is_related_to_documents' => false !== Vtiger_Relation_Model::getInstance(Vtiger_Module_Model::getInstance($module), $moduleDocuments),
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class '\App\Utils' in method 'showEmailsList'.
              Open

                              'teaser' => App\TextUtils::textTruncate(\App\Utils::htmlToText($content), 190),
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                                  $label = \App\Record::getLabel($id);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                              'label' => \App\Record::getLabel($row['crmid']),
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class 'vtlib\Functions' in method 'showEmailsList'.
              Open

                          $content = \App\Purifier::purifyHtml(vtlib\Functions::getHtmlOrPlainText($row['content']));
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                          $recordModel = Vtiger_Record_Model::getInstanceById($record, $module);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class 'Vtiger_RelationListView_Model' in method 'findEmailInRelated'.
              Open

                      $relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, 'Contacts');
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class 'OSSMailScanner_Record_Model' in method 'findEmailInRelated'.
              Open

                      $emailFields = OSSMailScanner_Record_Model::getEmailSearch('Contacts');
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                          } else {
                              $subject = \App\Purifier::encodeHtml($row['subject']);
                          }
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              ElseExpression

              Since: 1.4.0

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

              Example

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

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

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

                          } else {
                              $idsArray[0] = $ids;
                          }
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              ElseExpression

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class '\vtlib\Functions' in method 'findRecordsById'.
              Open

                              $recordMetaData = \vtlib\Functions::getCRMRecordMetadata($id);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                              if (\App\Record::isExists($accountId)) {
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                                  $returnEmail = $this->findEmail($accountId, \App\Record::getType($accountId));
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class '\App\Module' in method 'setReloadRelationRecord'.
              Open

                              'tabid' => \App\Module::getModuleId($moduleName),
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                      $moduleDocuments = Vtiger_Module_Model::getInstance('Documents');
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class '\App\Language' in method 'addRelated'.
              Open

                      return \App\Language::translate('Add relationship', 'OSSMail');
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                              if (\App\Privilege::isPermitted($module, 'DetailView', $id)) {
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                      if (!\App\Record::isExists($record)) {
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                              'is_related_to_documents' => false !== Vtiger_Relation_Model::getInstance(Vtiger_Module_Model::getInstance($module), $moduleDocuments),
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

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

                      } else {
                          (new OSSMailView_Relation_Model())->addRelation((int) $params['mailId'], $newCrmId);
                      }
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              ElseExpression

              Since: 1.4.0

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

              Example

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

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

              Avoid using static access to class 'OSSMailScanner_Record_Model' in method 'findEmail'.
              Open

                          $emailFields = OSSMailScanner_Record_Model::getEmailSearch($module);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              StaticAccess

              Since: 1.4.0

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

              Example

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

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

              Define a constant instead of duplicating this literal "deleted" 6 times.
              Open

                              ->where(['vtiger_contactdetails.parentid' => $srecord, 'deleted' => 0])->column();
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

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

                      $this->modules_email_actions_widgets['HelpDesk'] = true;
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

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

                          if ($row['orginal_mail'] && '-' !== $row['orginal_mail']) {
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

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

                      $query = (new \App\Db\Query())->select(['vtiger_ossmailview.*'])->from('vtiger_ossmailview')
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

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

                              $subject = '<a href="index.php?module=OSSMailView&view=Preview&record=' . $row['ossmailviewid'] . '" target="' . $config['target'] . '"> ' . \App\Purifier::encodeHtml($row['subject']) . '</a>';
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

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

                      $this->modules_email_actions_widgets['Contacts'] = true;
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

              Define a constant instead of duplicating this literal "vtiger_crmentity" 6 times.
              Open

                              ->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

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

                      $this->modules_email_actions_widgets['SSalesProcesses'] = true;
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

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

                          $query->addSelect([$fieldParams['fieldname'] => $fieldParams['tablename'] . '.' . $fieldParams['columnname']]);
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

              Define a constant instead of duplicating this literal "crmid" 13 times.
              Open

                      $subQuery = (new \App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview_relation')->where(['crmid' => $relatedId, 'deleted' => 0]);
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

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

                      $this->modules_email_actions_widgets['Project'] = true;
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

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

                              $module = $recordMetaData['setype'];
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

              Define a constant instead of duplicating this literal "ossmailviewid" 13 times.
              Open

                      $subQuery = (new \App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview_relation')->where(['crmid' => $relatedId, 'deleted' => 0]);
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

              Define a constant instead of duplicating this literal "tablename" 7 times.
              Open

                          $query->addSelect([$fieldParams['fieldname'] => $fieldParams['tablename'] . '.' . $fieldParams['columnname']]);
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

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

                                  $email = $recordModel->get($emailField['columnname']);
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

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

                      $subQuery = (new \App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview_relation')->where(['crmid' => $relatedId, 'deleted' => 0]);
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by sonar-php

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

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

              Noncompliant Code Example

              With the default threshold of 3:

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

              Compliant Solution

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

              Exceptions

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

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

                              $idsArray[0] = $ids;

              Call to method select from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
              Open

                      $query->select(['vtiger_crmentity.crmid']);
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                                  $isExists = (new \App\Db\Query())->from('vtiger_leaddetails')->where(['leadid' => $id, 'converted' => 0])->exists();
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

              Expected @param annotation for rcId to be before the @param annotation for mbox
              Open

                   * @param object $mbox

              Reference to static property ONE_MAIL_FOR_MULTIPLE_RECIPIENTS from undeclared class \Config\Modules\OSSMailScanner
              Open

                      if (!\Config\Modules\OSSMailScanner::$ONE_MAIL_FOR_MULTIPLE_RECIPIENTS) {
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

              Argument 1 (haystack) is int[] but \strpos() takes string
              Open

                          if (strpos($ids, ',')) {
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phan

              Reference to instance property join from undeclared class \App\QueryGenerator
              Open

                          if (!\in_array($fieldParams['tablename'], $query->from) && !\in_array($fieldParams['tablename'], array_column($query->join, 1))) {
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phan

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

                      return (new App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview')->where($where)->scalar();
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

              Call to method andWhere from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
              Open

                      $query->andWhere($where);
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                      $dbCommand = \App\Db::getInstance()->createCommand();
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

              Argument 1 (mbox) is object but \OSSMail_Record_Model::getMail() takes resource defined at /code/modules/OSSMail/models/Record.php:297
              Open

                      $mail = OSSMail_Record_Model::getMail($mbox, $uid, false);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phan

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

                      $subQuery = (new \App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview_relation')->where(['crmid' => $relatedId, 'deleted' => 0]);
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

              Call to method getEmailSearch from undeclared class \OSSMailScanner_Record_Model
              Open

                      $emailFields = OSSMailScanner_Record_Model::getEmailSearch('Contacts');
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailTypeData[$mailType], 'type' => $mailType], [])->execute();
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                      $query = (new App\Db\Query())->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.setype'])->from('vtiger_ossmailview_relation')->innerJoin('vtiger_crmentity', 'vtiger_ossmailview_relation.crmid = vtiger_crmentity.crmid')->where(['ossmailviewid' => $record, 'vtiger_crmentity.deleted' => 0]);
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

              Call to undeclared method \Vtiger_Record_Model::getConfig
              Open

                          $config = $recordModelMailScanner->getConfig('email_list');
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

              Reference to instance property from from undeclared class \App\QueryGenerator
              Open

                          if (!\in_array($fieldParams['tablename'], $query->from) && !\in_array($fieldParams['tablename'], array_column($query->join, 1))) {
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phan

              Call to method createCommand from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
              Open

                      $dataReader = $query->createCommand()->query();
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                      App\Db::getInstance()->createCommand()->insert('vtiger_ossmails_logs', ['action' => $action, 'info' => $info, 'user' => $user_id, 'start_time' => date('Y-m-d H:i:s')])->execute();
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

              Call to method getEmailSearch from undeclared class \OSSMailScanner_Record_Model
              Open

                          $emailFields = OSSMailScanner_Record_Model::getEmailSearch($module);
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

              Call to method addSelect from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
              Open

                          $query->addSelect([$fieldParams['fieldname'] => $fieldParams['tablename'] . '.' . $fieldParams['columnname']]);
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['verify' => 1], ['ossmailviewid' => $selectedIds])->execute();
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailType[$mail_type], 'type' => $mail_type], ['ossmailviewid' => $selectedIds])->execute();
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                          $relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

              Suspicious array access to null
              Open

                          $relatedId[] = $srecord;
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phan

              Call to method read from undeclared class \yii\db\DataReader
              Open

                      while ($row = $dataReader->read()) {
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                          \App\Db::getInstance()->createCommand()->insert('s_#__mail_relation_updater', [
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                      $query = (new \App\Db\Query())->select(['vtiger_ossmailview.*'])->from('vtiger_ossmailview')
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

              Argument 2 (str) is int[] but \explode() takes string
              Open

                              $idsArray = explode(',', $ids);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phan

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

                      $exists = (new App\Db\Query())->from('s_#__mail_relation_updater')->where(['crmid' => $record])->exists();
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                      $dbCommand = \App\Db::getInstance()->createCommand();
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview_relation', ['deleted' => 1], ['ossmailviewid' => $this->getId()])->execute();
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

              Call to method leftJoin from undeclared class \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
              Open

                              $query->leftJoin($fieldParams['tablename'], "vtiger_crmentity.crmid = {$fieldParams['tablename']}.{$tabIndex[$fieldParams['tablename']]}");
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

              Returning type false but findEmail() is declared to return string
              Open

                          return false;
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phan

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

                      $query = (new \App\Db\Query())->from('vtiger_ossmailview_files')->where(['ossmailviewid' => $recordId]);
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                      return (new App\Db\Query())->select(['name' => 'vtiger_notes.title', 'file' => 'vtiger_notes.filename', 'id' => 'vtiger_notes.notesid'])
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                      \App\Db::getInstance()->createCommand()->delete('vtiger_ossmailview_relation', ['ossmailviewid' => (int) $params['mailId'], 'crmid' => (int) $params['crmid']])->execute();
              Severity: Critical
              Found in modules/OSSMailView/models/Record.php by phan

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

                  protected $modules_email_actions_widgets = [];
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              LongVariable

              Since: 0.2

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

              Example

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

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

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

                          $recordModelMailScanner = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              LongVariable

              Since: 0.2

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

              Example

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

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

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

              class OSSMailView_Record_Model extends Vtiger_Record_Model

              The parameter $mail_type is not named in camelCase.
              Open

                  public function changeTypeSelectedRecords($selectedIds, $mail_type)
                  {
                      $mailType = self::getMailType();
                      $this->addLog('Action_ChangeType', \count($selectedIds));
                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailType[$mail_type], 'type' => $mail_type], ['ossmailviewid' => $selectedIds])->execute();
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              CamelCaseParameterName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name parameters.

              Example

              class ClassName {
                  public function doSomething($user_name) {
                  }
              }

              Source

              The property $modules_email_actions_widgets is not named in camelCase.
              Open

              class OSSMailView_Record_Model extends Vtiger_Record_Model
              {
                  const TYPE_COLORS = [
                      0 => 'bgGreen',
                      1 => 'bgDanger',
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              CamelCasePropertyName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name attributes.

              Example

              class ClassName {
                  protected $property_name;
              }

              Source

              The class OSSMailView_Record_Model is not named in CamelCase.
              Open

              class OSSMailView_Record_Model extends Vtiger_Record_Model
              {
                  const TYPE_COLORS = [
                      0 => 'bgGreen',
                      1 => 'bgDanger',
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              CamelCaseClassName

              Since: 0.2

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

              Example

              class class_name {
              }

              Source

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

                          $to = $this->findRecordsById($row['to_id']);
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              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

                  protected $modules_email_actions_widgets = [];

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

                  public function __construct()

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

                      $this->modules_email_actions_widgets['Accounts'] = true;

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

                      $return = [];

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

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

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

                              'from' => $from,

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

                              'teaser' => App\TextUtils::textTruncate(\App\Utils::htmlToText($content), 190),

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

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

                      $value = parent::get($key);

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

                   * @param int    $srecord

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

                      if ('All' !== $type) {

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

                      $query->orderBy(['date' => SORT_DESC]);

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

                          $to = $this->findRecordsById($row['to_id']);

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

                          $content = \App\Purifier::purifyHtml(vtlib\Functions::getHtmlOrPlainText($row['content']));

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

                                  $firstLetter = '<span class="fas fa-exclamation-triangle text-danger" title="' . \App\Purifier::encodeHtml($verifySender['info']) . '"></span>';

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

                                  $firstLetterBg = 'bg-warning';

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

                              'ccRaw' => $row['cc_email'],

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

                              'bodyRaw' => $row['content'],

              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

                   */

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

                  public function isWidgetEnabled($module)

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

                      return 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

                          $relatedId[] = $srecord;

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

                      \App\PrivilegeQuery::getConditions($query, 'OSSMailView', false, $srecord);

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

                              'date' => $row['date'],

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

                              'url' => "index.php?module=OSSMailView&view=Preview&record={$row['ossmailviewid']}&srecord=$srecord&smodule=$smodule",

              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->modules_email_actions_widgets['Contacts'] = true;

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

                      $this->modules_email_actions_widgets['Project'] = 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

                   * Function return emails list.

              Line exceeds 120 characters; contains 122 characters
              Open

                          $relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')

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

                      if ('' !== $config['widget_limit']) {

              Line exceeds 120 characters; contains 164 characters
              Open

                                  $firstLetter = '<span class="fas fa-exclamation-triangle text-danger" title="' . \App\Purifier::encodeHtml($verifySender['info']) . '"></span>';

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

                              'fromRaw' => $row['from_email'],

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

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

                          foreach ($idsArray as $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

                      $this->modules_email_actions_widgets['HelpDesk'] = true;

              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

                              $subject = '<a href="index.php?module=OSSMailView&view=Preview&record=' . $row['ossmailviewid'] . '" target="' . $config['target'] . '"> ' . \App\Purifier::encodeHtml($row['subject']) . '</a>';

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

                              $rblInstance->parse();

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

                      $query = (new \App\Db\Query())->select(['vtiger_ossmailview.*'])->from('vtiger_ossmailview')

              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

                          ->where(['ossmailviewid' => $subQuery]);

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

                          if (strpos($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

                              'subject' => $subject,

              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 int[] $ids

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

                  public function findRecordsById($ids)

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

                          $config = $recordModelMailScanner->getConfig('email_list');

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

                      parent::__construct();

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

                      if ('uid' === $key) {

              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  $config

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

                   * @param string $type

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

                   * @param string $filter

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

                      if ('Contacts' !== $filter) {

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

                      if (!$relatedId || false === App\ModuleHierarchy::getModuleLevel($smodule)) {

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

                              'firstLetter' => $firstLetter,

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

                  }

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

                              $idsArray[0] = $ids;

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

                              if ('Leads' === $module) {

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

                      $this->modules_email_actions_widgets['SSalesProcesses'] = true;

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

                          return true;

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

                   * @param string $smodule

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

                          $relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')

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

                      }

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

                          $firstLetterBg = self::TYPE_COLORS[$row['type']] ?? '';

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

                              'toRaw' => $row['to_email'],

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

                              'body' => $content,

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

                      return $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

                      }

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

                          $from = $this->findRecordsById($row['from_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

                              $rblInstance = \App\Mail\Rbl::getInstance([]);

              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

                      $widgets = $this->modules_email_actions_widgets;

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

                          $query->andWhere((['type' => $type]));

              Line exceeds 120 characters; contains 209 characters
              Open

                              $subject = '<a href="index.php?module=OSSMailView&view=Preview&record=' . $row['ossmailviewid'] . '" target="' . $config['target'] . '"> ' . \App\Purifier::encodeHtml($row['subject']) . '</a>';

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

                              $recordMetaData = \vtlib\Functions::getCRMRecordMetadata($id);

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

                      $this->modules_email_actions_widgets['Leads'] = true;

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

                  public function get($key)

              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

                          $to = ($to && '' !== $to) ? $to : $row['to_email'];

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

                          if ($row['orginal_mail'] && '-' !== $row['orginal_mail']) {

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

                              'firstLetterBg' => $firstLetterBg,

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

                      }

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

                      0 => 'bgGreen',

              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 App\Purifier::decodeHtml($value);

              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

                              ->where(['vtiger_contactdetails.parentid' => $srecord, 'deleted' => 0])->column();

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

                          $query->limit($config['widget_limit']);

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

                              'id' => $row['ossmailviewid'],

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

                              'attachments' => $row['attachments_exist'],

              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

                          } else {

              Line exceeds 120 characters; contains 136 characters
              Open

                                  $isExists = (new \App\Db\Query())->from('vtiger_leaddetails')->where(['leadid' => $id, 'converted' => 0])->exists();

              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

                              ->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')

              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

                      $subQuery = (new \App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview_relation')->where(['crmid' => $relatedId, 'deleted' => 0]);

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

                          ->innerJoin('vtiger_crmentity', 'vtiger_ossmailview.ossmailviewid = vtiger_crmentity.crmid')

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

                          } else {

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

                              'type' => $row['type'],

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

                      return $return;

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

                      $this->modules_email_actions_widgets['SSingleOrders'] = 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

                      }

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

                  public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')

              Line exceeds 120 characters; contains 154 characters
              Open

                      $subQuery = (new \App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview_relation')->where(['crmid' => $relatedId, 'deleted' => 0]);

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

                          $from = ($from && '' !== $from) ? $from : $row['from_email'];

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

                              $subject = \App\Purifier::encodeHtml($row['subject']);

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

                          $firstLetter = strtoupper(App\TextUtils::textTruncate(trim(strip_tags($from)), 1, false));

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

                              if (($verifySender = $rblInstance->verifySender()) && !$verifySender['status']) {

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

                              'subjectRaw' => \App\Purifier::encodeHtml($row['subject']),

              Line exceeds 120 characters; contains 163 characters
              Open

                                  $return .= '<a href="index.php?module=' . $module . '&view=Detail&record=' . $id . '" target="' . $config['target'] . '"> ' . $label . '</a>,';

              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 false;

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

                      if (\in_array($module, ['HelpDesk', 'Project', 'SSalesProcesses'])) {

              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 142 characters
              Open

                          if (!\in_array($fieldParams['tablename'], $query->from) && !\in_array($fieldParams['tablename'], array_column($query->join, 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

                      return implode(',', $emails);

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

                      $query = (new \App\Db\Query())->from('vtiger_ossmailview_files')->where(['ossmailviewid' => $recordId]);

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

                          $dbCommand->update('vtiger_crmentity', ['deleted' => 1], ['crmid' => $row['documentsid']])->execute();

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

                      return [2 => 'Internal', 0 => 'Sent', 1 => 'Received'];

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

                  const TYPE_COLORS = [

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

                      1 => 'bgDanger',

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

                      if ('All' === $filter || 'Contacts' === $filter) {

              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 (\App\Privilege::isPermitted('OSSMailView', 'DetailView', $row['ossmailviewid'])) {

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

                              $rblInstance->set('rawBody', $row['orginal_mail']);

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

                              }

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

                              'to' => $to,

              Line exceeds 120 characters; contains 134 characters
              Open

                              'url' => "index.php?module=OSSMailView&view=Preview&record={$row['ossmailviewid']}&srecord=$srecord&smodule=$smodule",

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

                   * Find records.

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

                          $recordModelMailScanner = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');

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

                              $idsArray = explode(',', $ids);

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

                              $module = $recordMetaData['setype'];

              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

                                  $email = $recordModel->get($emailField['columnname']);

              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

                      $query->select(['vtiger_crmentity.crmid']);

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

                      $where = ['or'];

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

                          $where[] = ['<>', $fieldParams['tablename'] . '.' . $fieldParams['columnname'], ''];

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

                              $query->leftJoin($fieldParams['tablename'], "vtiger_crmentity.crmid = {$fieldParams['tablename']}.{$tabIndex[$fieldParams['tablename']]}");

              Line exceeds 120 characters; contains 141 characters
              Open

                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['verify' => 1], ['ossmailviewid' => $selectedIds])->execute();

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

                  public static function getMailType()

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

                  }

              Line exceeds 120 characters; contains 197 characters
              Open

                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailType[$mail_type], 'type' => $mail_type], ['ossmailviewid' => $selectedIds])->execute();

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

                      2 => 'bgBlue',

              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 ($widgets[$module]) {

              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 (!$recordMetaData || 1 === $recordMetaData['deleted']) {

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

                                  continue;

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

                                  $isExists = (new \App\Db\Query())->from('vtiger_leaddetails')->where(['leadid' => $id, 'converted' => 0])->exists();

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

                   * @param int    $record

              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

                                  case 'SSalesProcesses':

              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 deleteRel($recordId)

              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

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

              Line exceeds 120 characters; contains 187 characters
              Open

                      App\Db::getInstance()->createCommand()->insert('vtiger_ossmails_logs', ['action' => $action, 'info' => $info, 'user' => $user_id, 'start_time' => date('Y-m-d H:i:s')])->execute();

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

                      $emailFields = OSSMailScanner_Record_Model::getEmailSearch('Contacts');

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

                          foreach ($emailFields as $fieldParams) {

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

                  {

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

                          $dbCommand->update('vtiger_crmentity', ['deleted' => 1], ['crmid' => $row['attachmentsid']])->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

                                  $returnEmail = $this->findEmail($accountId, \App\Record::getType($accountId));

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

                                  if (!empty($email)) {

              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($row[$fieldParams['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

                      $this->addLog('Action_ChangeType', 'all');

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

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

                      }

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

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

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

                              switch ($module) {

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

                          $emailFields = OSSMailScanner_Record_Model::getEmailSearch($module);

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

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

                  /**

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

                                      break;

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

                                      $accountId = $recordModel->get('related_to');

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

                                      break;

              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 Vtiger_Record_Model $recordModel

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

                   */

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

                          if (!\in_array($fieldParams['tablename'], $query->from) && !\in_array($fieldParams['tablename'], array_column($query->join, 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

                  public function bindSelectedRecords($selectedIds)

              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->addLog('Action_Bind', \count($selectedIds));

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

                  {

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

                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview_relation', ['deleted' => 1], ['ossmailviewid' => $this->getId()])->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

                   *

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

                      foreach ($emailFields as $fieldParams) {

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

                      $query->andWhere($where);

              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

                      parent::delete();

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

                   * @param string $module

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

                                      $accountId = $recordModel->get('linktoaccountscontacts');

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

                              }

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

                      $relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, 'Contacts');

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

                      }

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

                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['verify' => 1], ['ossmailviewid' => $selectedIds])->execute();

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

                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailTypeData[$mailType], 'type' => $mailType], [])->execute();

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

                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailType[$mail_type], 'type' => $mail_type], ['ossmailviewid' => $selectedIds])->execute();

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

                      $user_id = Users_Record_Model::getCurrentUserModel()->get('user_name');

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

                              if (\App\Privilege::isPermitted($module, 'DetailView', $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

                   * Find email for record.

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

                  public function findEmail(int $record, string $module): string

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

                      $emails = [];

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

                          }

              Line exceeds 120 characters; contains 168 characters
              Open

                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailTypeData[$mailType], 'type' => $mailType], [])->execute();

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

                  /**

              Line exceeds 120 characters; contains 153 characters
              Open

                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview_relation', ['deleted' => 1], ['ossmailviewid' => $this->getId()])->execute();

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

                                      continue;

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

                                  $return .= '<a href="index.php?module=' . $module . '&view=Detail&record=' . $id . '" target="' . $config['target'] . '"> ' . $label . '</a>,';

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

                          if (!$returnEmail) {

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

                                      $accountId = $recordModel->get('parent_id');

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

                                      $returnEmail = $email;

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

                  public function findEmailInRelated(Vtiger_Record_Model $recordModel): string

              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

                      $mailType = self::getMailType();

              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 trim($return, ',');

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

                   *

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

                              $accountId = '';

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

                              foreach ($emailFields as $emailField) {

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

                                      break;

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

                   * Find email in related records.

              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 = $relationListView->getRelationQuery();

              Line exceeds 120 characters; contains 123 characters
              Open

                          $query->addSelect([$fieldParams['fieldname'] => $fieldParams['tablename'] . '.' . $fieldParams['columnname']]);

              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 addLog($action, $info)

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

                      App\Db::getInstance()->createCommand()->insert('vtiger_ossmails_logs', ['action' => $action, 'info' => $info, 'user' => $user_id, 'start_time' => date('Y-m-d H:i:s')])->execute();

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

                                  case 'HelpDesk':

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

                                      break;

              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->addSelect([$fieldParams['fieldname'] => $fieldParams['tablename'] . '.' . $fieldParams['columnname']]);

              Line exceeds 120 characters; contains 155 characters
              Open

                              $query->leftJoin($fieldParams['tablename'], "vtiger_crmentity.crmid = {$fieldParams['tablename']}.{$tabIndex[$fieldParams['tablename']]}");

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

                      $dbCommand = \App\Db::getInstance()->createCommand();

              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

                      $mailTypeData = self::getMailType();

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

                  public function changeTypeSelectedRecords($selectedIds, $mail_type)

              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->addLog('Action_ChangeType', \count($selectedIds));

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

                      $returnEmail = '';

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

                                  case 'Project':

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

                                  default:

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

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

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

                      $tabIndex = $relationListView->getRelatedModuleModel()->getEntityInstance()->tab_name_index;

              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

                          $returnEmail = $this->findEmailInRelated($recordModel);

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

                                      break;

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

                              if (\App\Record::isExists($accountId)) {

              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 changeTypeAllRecords($mailType)

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

                                  $label = \App\Record::getLabel($id);

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

                   * Function to delete the current 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

                      if (!\App\Record::isExists($record)) {

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

                          if (\count($emailFields) > 0) {

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

                      return $returnEmail;

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

                                  $emails[] = $row[$fieldParams['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

                   * @param int    $uid

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

                      if (!$mail) {

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

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

                              'rel_created_user' => $currentUser->getId(),

              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

                          ->where(['vtiger_crmentity.deleted' => 0, 'vtiger_ossmailview_files.ossmailviewid' => $this->getId()])

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

                   *

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

                   * Get related records.

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

                   *

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

                          $module = $row['setype'];

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

                          $relations[$module][] = [

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

                  public static function addRelated($params)

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

                              'module' => $params['mod'],

              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

                          ->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = vtiger_notes.notesid')

              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 false;

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

                      $query = (new App\Db\Query())->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.setype'])->from('vtiger_ossmailview_relation')->innerJoin('vtiger_crmentity', 'vtiger_ossmailview_relation.crmid = vtiger_crmentity.crmid')->where(['ossmailviewid' => $record, 'vtiger_crmentity.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

                      if ('Products' === $newModule) {

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

                  public static function removeRelated($params)

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

                      return (new App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview')->where($where)->scalar();

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

                      $relations = [];

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

                      $newModule = $params['newModule'];

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

                      } elseif ('Services' === $newModule) {

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

                              'crmid' => (int) $params['crmid'],

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

                          (new OSSMailView_Relation_Model())->addRelation((int) $params['mailId'], $newCrmId);

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

                      return \App\Language::translate('Add relationship', 'OSSMail');

              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 \App\Language::translate('Removed relationship', 'OSSMail');

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

                   * @param string $moduleName

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

                      if (!$exists) {

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

                      }

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

                   * @return array

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

                  public function getAttachments()

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

                   * @param object $mbox

              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

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

                              'productid' => $newCrmId,

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

                   * Check if record is editable.

              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 int    $record

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

                   * @param mixed  $rcId

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

                      if (!\Config\Modules\OSSMailScanner::$ONE_MAIL_FOR_MULTIPLE_RECIPIENTS) {

              Line exceeds 120 characters; contains 301 characters
              Open

                      $query = (new App\Db\Query())->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.setype'])->from('vtiger_ossmailview_relation')->innerJoin('vtiger_crmentity', 'vtiger_ossmailview_relation.crmid = vtiger_crmentity.crmid')->where(['ossmailviewid' => $record, 'vtiger_crmentity.deleted' => 0]);

              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

                      \App\Db::getInstance()->createCommand()->delete('vtiger_ossmailview_relation', ['ossmailviewid' => (int) $params['mailId'], 'crmid' => (int) $params['crmid']])->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 isEditable(): 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

                  }

              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  $folder

              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

                   * Check if mail exist.

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

                   * @return bool|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

                  /**

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

                              'id' => $row['crmid'],

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

                              'setype' => $params['mod'],

              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 $params

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

                              'crmid' => $record,

              Line exceeds 120 characters; contains 144 characters
              Open

                      return (new App\Db\Query())->select(['name' => 'vtiger_notes.title', 'file' => 'vtiger_notes.filename', 'id' => 'vtiger_notes.notesid'])

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

                          ->from('vtiger_notes')

              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 $params

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

                      $currentUser = Users_Record_Model::getCurrentUserModel();

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

                          $dbCommand->insert('vtiger_seproductsrel', [

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

                              'rel_created_time' => date('Y-m-d H:i:s'),

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

                   */

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

                          ->all();

              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

                              'relmodule' => $newModule,

              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

                  public function setReloadRelationRecord($moduleName, $record = 0)

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

                   * Returns basic information about atachments for this mail.

              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

                              'module' => $module,

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

                   * Remove related.

              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

                      $exists = (new App\Db\Query())->from('s_#__mail_relation_updater')->where(['crmid' => $record])->exists();

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

                              'tabid' => \App\Module::getModuleId($moduleName),

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

                  public function checkMailExist($uid, $folder, $rcId, $mbox)

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

                          $where['mbox'] = $folder;

              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

                          $dbCommand->insert('vtiger_crmentityrel', [

              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

                   * @return string

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

                      $where = ['cid' => $mail->getUniqueId()];

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

                   *

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

                              'label' => \App\Record::getLabel($row['crmid']),

              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

                   * Add related.

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

                      $newCrmId = (int) $params['newCrmId'];

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

                              'crmid' => (int) $params['crmid'],

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

                              'relcrmid' => $newCrmId,

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

                      }

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

                   * Set reload relation 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

                          \App\Db::getInstance()->createCommand()->insert('s_#__mail_relation_updater', [

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

                      return (new App\Db\Query())->select(['name' => 'vtiger_notes.title', 'file' => 'vtiger_notes.filename', 'id' => 'vtiger_notes.notesid'])

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

                          $where['rc_user'] = $rcId;

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

                   * @param int $record

              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

                      $moduleDocuments = Vtiger_Module_Model::getInstance('Documents');

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

                  {

              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

                      } else {

              Line exceeds 120 characters; contains 179 characters
              Open

                      \App\Db::getInstance()->createCommand()->delete('vtiger_ossmailview_relation', ['ossmailviewid' => (int) $params['mailId'], 'crmid' => (int) $params['crmid']])->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

                      $mail = OSSMail_Record_Model::getMail($mbox, $uid, false);

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

                          return false;

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

                  public function getRelatedRecords($record): array

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

                              'is_related_to_documents' => false !== Vtiger_Relation_Model::getInstance(Vtiger_Module_Model::getInstance($module), $moduleDocuments),

              Line exceeds 120 characters; contains 151 characters
              Open

                              'is_related_to_documents' => false !== Vtiger_Relation_Model::getInstance(Vtiger_Module_Model::getInstance($module), $moduleDocuments),

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

                  }

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

                      $dbCommand = \App\Db::getInstance()->createCommand();

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

                  /**

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

                          ->leftJoin('vtiger_ossmailview_files', 'vtiger_ossmailview_files.documentsid = vtiger_notes.notesid')

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

              class OSSMailView_Record_Model extends Vtiger_Record_Model

              The variable $mail_type is not named in camelCase.
              Open

                  public function changeTypeSelectedRecords($selectedIds, $mail_type)
                  {
                      $mailType = self::getMailType();
                      $this->addLog('Action_ChangeType', \count($selectedIds));
                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailType[$mail_type], 'type' => $mail_type], ['ossmailviewid' => $selectedIds])->execute();
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              CamelCaseVariableName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name variables.

              Example

              class ClassName {
                  public function doSomething() {
                      $data_module = new DataModule();
                  }
              }

              Source

              The variable $user_id is not named in camelCase.
              Open

                  public function addLog($action, $info)
                  {
                      $user_id = Users_Record_Model::getCurrentUserModel()->get('user_name');
                      App\Db::getInstance()->createCommand()->insert('vtiger_ossmails_logs', ['action' => $action, 'info' => $info, 'user' => $user_id, 'start_time' => date('Y-m-d H:i:s')])->execute();
                  }
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              CamelCaseVariableName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name variables.

              Example

              class ClassName {
                  public function doSomething() {
                      $data_module = new DataModule();
                  }
              }

              Source

              The variable $user_id is not named in camelCase.
              Open

                  public function addLog($action, $info)
                  {
                      $user_id = Users_Record_Model::getCurrentUserModel()->get('user_name');
                      App\Db::getInstance()->createCommand()->insert('vtiger_ossmails_logs', ['action' => $action, 'info' => $info, 'user' => $user_id, 'start_time' => date('Y-m-d H:i:s')])->execute();
                  }
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              CamelCaseVariableName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name variables.

              Example

              class ClassName {
                  public function doSomething() {
                      $data_module = new DataModule();
                  }
              }

              Source

              The variable $mail_type is not named in camelCase.
              Open

                  public function changeTypeSelectedRecords($selectedIds, $mail_type)
                  {
                      $mailType = self::getMailType();
                      $this->addLog('Action_ChangeType', \count($selectedIds));
                      \App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailType[$mail_type], 'type' => $mail_type], ['ossmailviewid' => $selectedIds])->execute();
              Severity: Minor
              Found in modules/OSSMailView/models/Record.php by phpmd

              CamelCaseVariableName

              Since: 0.2

              It is considered best practice to use the camelCase notation to name variables.

              Example

              class ClassName {
                  public function doSomething() {
                      $data_module = new DataModule();
                  }
              }

              Source

              There are no issues that match your filters.

              Category
              Status