YetiForceCompany/YetiForceCRM

View on GitHub
modules/OSSMailScanner/scanneractions/CreatedHelpDesk.php

Summary

Maintainability
B
6 hrs
Test Coverage
F
0%

Method add has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function add()
    {
        $contactId = (int) $this->mail->findEmailAddress('from_email', 'Contacts', false);
        $parentId = (int) $this->mail->findEmailAddress('from_email', 'Accounts', false);
        $record = Vtiger_Record_Model::getCleanInstance('HelpDesk');
Severity: Major
Found in modules/OSSMailScanner/scanneractions/CreatedHelpDesk.php - About 2 hrs to fix

    Function add has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function add()
        {
            $contactId = (int) $this->mail->findEmailAddress('from_email', 'Contacts', false);
            $parentId = (int) $this->mail->findEmailAddress('from_email', 'Accounts', false);
            $record = Vtiger_Record_Model::getCleanInstance('HelpDesk');
    Severity: Minor
    Found in modules/OSSMailScanner/scanneractions/CreatedHelpDesk.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

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

        public function process(OSSMail_Mail_Model $mail)
        {
            $this->mail = $mail;
            $id = $recordId = 0;
            $this->prefix = \App\Mail\RecordFinder::getRecordNumberFromString($mail->get('subject'), 'HelpDesk');
    Severity: Minor
    Found in modules/OSSMailScanner/scanneractions/CreatedHelpDesk.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

    The method add() has an NPath complexity of 2880. The configured NPath complexity threshold is 200.
    Open

        public function add()
        {
            $contactId = (int) $this->mail->findEmailAddress('from_email', 'Contacts', false);
            $parentId = (int) $this->mail->findEmailAddress('from_email', 'Accounts', false);
            $record = Vtiger_Record_Model::getCleanInstance('HelpDesk');

    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 add() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
    Open

        public function add()
        {
            $contactId = (int) $this->mail->findEmailAddress('from_email', 'Contacts', false);
            $parentId = (int) $this->mail->findEmailAddress('from_email', 'Accounts', false);
            $record = Vtiger_Record_Model::getCleanInstance('HelpDesk');

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

        public function add()

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

    See

    Missing class import via use statement (line '57', column '21').
    Open

                $parentId = (new App\Db\Query())->select(['parentid'])->from('vtiger_contactdetails')->where(['contactid' => $contactId])->scalar();

    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 '104', column '18').
    Open

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

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

                $queryGenerator = new \App\QueryGenerator('ServiceContracts');

    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 'Vtiger_Record_Model' in method 'add'.
    Open

            $record = Vtiger_Record_Model::getCleanInstance('HelpDesk');

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

            $exceptionsAll = OSSMailScanner_Record_Model::getConfig('exceptions');

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

                } else {
                    $queryGenerator->addCondition('contract_status', 'In Progress', 'e');
                }

    ElseExpression

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Mail\RecordFinder' in method 'process'.
    Open

                $this->prefix = \App\Mail\RecordFinder::getRecordNumberFromString($mail->get('body'), 'HelpDesk', true);

    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 '65', column '116').
    Open

        public function add()
        {
            $contactId = (int) $this->mail->findEmailAddress('from_email', 'Contacts', false);
            $parentId = (int) $this->mail->findEmailAddress('from_email', 'Accounts', false);
            $record = Vtiger_Record_Model::getCleanInstance('HelpDesk');

    IfStatementAssignment

    Since: 2.7.0

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

    Example

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

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

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

            $record->set('description', \App\TextUtils::htmlTruncate($this->mail->getContent(), $record->getField('description')->getMaxValue()));

    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\RecordStatus' in method 'add'.
    Open

                if (($queryGenerator->getModuleField('contract_status')->getFieldParams()['isProcessStatusField'] ?? false) && ($status = \App\RecordStatus::getStates('ServiceContracts', \App\RecordStatus::RECORD_STATE_OPEN))) {

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'App\Fields\Picklist' in method 'add'.
    Open

                    if (App\Fields\Picklist::isExists('ticketpriorities', $serviceContracts['contract_priority'])) {

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

            $this->prefix = \App\Mail\RecordFinder::getRecordNumberFromString($mail->get('subject'), 'HelpDesk');

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

        public function add()
        {
            $contactId = (int) $this->mail->findEmailAddress('from_email', 'Contacts', false);
            $parentId = (int) $this->mail->findEmailAddress('from_email', 'Accounts', false);
            $record = Vtiger_Record_Model::getCleanInstance('HelpDesk');

    IfStatementAssignment

    Since: 2.7.0

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

    Example

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

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

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

            $record->setFromUserValue('ticket_title', \App\TextUtils::textTruncate($this->mail->get('subject'), $record->getField('ticket_title')->getMaxValue()));

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

                if (($queryGenerator->getModuleField('contract_status')->getFieldParams()['isProcessStatusField'] ?? false) && ($status = \App\RecordStatus::getStates('ServiceContracts', \App\RecordStatus::RECORD_STATE_OPEN))) {

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

                $queryGenerator->setFields(['id', 'contract_priority']);

    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->prefix = \App\Mail\RecordFinder::getRecordNumberFromString($mail->get('subject'), 'HelpDesk');

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

                    if (false !== strpos($mail->get('from_email'), $exception)) {

    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.

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

            if (!empty(\Config\Modules\OSSMailScanner::$helpdeskCreateDefaultStatus)) {

    Call to method getConfig from undeclared class \OSSMailScanner_Record_Model
    Open

            $exceptionsAll = OSSMailScanner_Record_Model::getConfig('exceptions');

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

                $queryGenerator->permissions = false;

    Declaration of function add() : int should be compatible with function add() : array defined in /code/modules/OSSMailScanner/models/PrefixScannerAction.php:70
    Open

        public function add()

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

                $queryGenerator->addNativeCondition(['vtiger_servicecontracts.sc_related_to' => $parentId]);

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

                    $queryGenerator->addCondition('contract_status', $status, 'e');

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

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

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

            if (empty($this->prefix) && \Config\Modules\OSSMailScanner::$searchPrefixInBody) {

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

                if (($queryGenerator->getModuleField('contract_status')->getFieldParams()['isProcessStatusField'] ?? false) && ($status = \App\RecordStatus::getStates('ServiceContracts', \App\RecordStatus::RECORD_STATE_OPEN))) {

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

                $queryGenerator = new \App\QueryGenerator('ServiceContracts');

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

            if (!$contactId && !$parentId && !\Config\Modules\OSSMailScanner::$helpdeskCreateWithoutNoRelation) {

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

                    $queryGenerator->addCondition('contract_status', 'In Progress', 'e');

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

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

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

                $record->set('ticketstatus', \Config\Modules\OSSMailScanner::$helpdeskCreateDefaultStatus);

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

                $parentId = (new App\Db\Query())->select(['parentid'])->from('vtiger_contactdetails')->where(['contactid' => $contactId])->scalar();

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

                $queryGenerator->setFields(['id', 'contract_priority']);

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

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

    Avoid excessively long class names like OSSMailScanner_CreatedHelpDesk_ScannerAction. Keep class name length under 40.
    Open

    class OSSMailScanner_CreatedHelpDesk_ScannerAction extends OSSMailScanner_BindHelpDesk_ScannerAction
    {
        /** {@inheritdoc} */
        public function process(OSSMail_Mail_Model $mail)
        {

    LongClassName

    Since: 2.9

    Detects when classes or interfaces are declared with excessively long names.

    Example

    class ATooLongClassNameThatHintsAtADesignProblem {
    
    }
    
    interface ATooLongInterfaceNameThatHintsAtADesignProblem {
    
    }

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

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

    class OSSMailScanner_CreatedHelpDesk_ScannerAction extends OSSMailScanner_BindHelpDesk_ScannerAction

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

            $id = $recordId = 0;

    ShortVariable

    Since: 0.2

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

    Example

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

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

    The class OSSMailScanner_CreatedHelpDesk_ScannerAction is not named in CamelCase.
    Open

    class OSSMailScanner_CreatedHelpDesk_ScannerAction extends OSSMailScanner_BindHelpDesk_ScannerAction
    {
        /** {@inheritdoc} */
        public function process(OSSMail_Mail_Model $mail)
        {

    CamelCaseClassName

    Since: 0.2

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

    Example

    class class_name {
    }

    Source

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

            $id = $record->getId();

    ShortVariable

    Since: 0.2

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

    Example

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

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

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

            $exceptionsAll = OSSMailScanner_Record_Model::getConfig('exceptions');

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

                foreach ($exceptions as $exception) {

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

        {

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

            $record = Vtiger_Record_Model::getCleanInstance('HelpDesk');

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

                $record->set('parent_id', $parentId);

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

        {

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

                        return '';

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

            if (!$contactId && !$parentId && !\Config\Modules\OSSMailScanner::$helpdeskCreateWithoutNoRelation) {

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

                return 0;

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

            $accountOwner = $this->mail->getAccountOwner();

    Line exceeds 120 characters; contains 142 characters
    Open

            $record->set('description', \App\TextUtils::htmlTruncate($this->mail->getContent(), $record->getField('description')->getMaxValue()));

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

                    'relatedModule' => 'Contacts',

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

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

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

                $this->prefix = \App\Mail\RecordFinder::getRecordNumberFromString($mail->get('body'), 'HelpDesk', true);

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

            if (!$recordId) {

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

        }

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

                $queryGenerator->addNativeCondition(['vtiger_servicecontracts.sc_related_to' => $parentId]);

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

            $record->setFromUserValue('ticket_title', \App\TextUtils::textTruncate($this->mail->get('subject'), $record->getField('ticket_title')->getMaxValue()));

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

            if ($contactId) {

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

            $dbCommand->update('vtiger_crmentity', ['createdtime' => $this->mail->get('date'), 'smcreatorid' => $accountOwner], ['crmid' => $id])->execute();

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

                }

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

         *

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

                $record->set('ticketstatus', \Config\Modules\OSSMailScanner::$helpdeskCreateDefaultStatus);

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

            $id = $recordId = 0;

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

            if ($mailId = $this->mail->getMailCrmId()) {

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

                $exceptions = explode(',', $exceptionsAll['crating_tickets']);

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

                $record->ext['relations'][] = [

    Line exceeds 120 characters; contains 224 characters
    Open

                if (($queryGenerator->getModuleField('contract_status')->getFieldParams()['isProcessStatusField'] ?? false) && ($status = \App\RecordStatus::getStates('ServiceContracts', \App\RecordStatus::RECORD_STATE_OPEN))) {

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

                    $queryGenerator->addCondition('contract_status', $status, 'e');

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

                    $record->set('servicecontractsid', $serviceContracts['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

            $record->save();

    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->mail = $mail;

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

            if ($this->prefix) {

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

                    if (false !== strpos($mail->get('from_email'), $exception)) {

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

            if (!empty(\Config\Modules\OSSMailScanner::$helpdeskCreateDefaultStatus)) {

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

        /** {@inheritdoc} */

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

            }

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

         */

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

            $parentId = (int) $this->mail->findEmailAddress('from_email', 'Accounts', false);

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

                $parentId = (new App\Db\Query())->select(['parentid'])->from('vtiger_contactdetails')->where(['contactid' => $contactId])->scalar();

    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

            $record->set('assigned_user_id', $accountOwner);

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

            $record->set('description', \App\TextUtils::htmlTruncate($this->mail->getContent(), $record->getField('description')->getMaxValue()));

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

            if ($mailId) {

    Line exceeds 120 characters; contains 138 characters
    Open

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

    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($exceptionsAll['crating_tickets'])) {

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

         * Creating a HelpDesk from an email.

    Line exceeds 120 characters; contains 159 characters
    Open

            $record->setFromUserValue('ticket_title', \App\TextUtils::textTruncate($this->mail->get('subject'), $record->getField('ticket_title')->getMaxValue()));

    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 = $this->add();

    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

                    $serviceContracts = $dataReader->read();

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

                $record->ext['relations'][] = [

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

            $id = $record->getId();

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

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

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

            }

    Line exceeds 120 characters; contains 144 characters
    Open

                $parentId = (new App\Db\Query())->select(['parentid'])->from('vtiger_contactdetails')->where(['contactid' => $contactId])->scalar();

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

                    $queryGenerator->addCondition('contract_status', 'In Progress', 'e');

    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 int

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

            if ($parentId) {

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

                if (($queryGenerator->getModuleField('contract_status')->getFieldParams()['isProcessStatusField'] ?? false) && ($status = \App\RecordStatus::getStates('ServiceContracts', \App\RecordStatus::RECORD_STATE_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

                    'params' => $this->mail->get('date'),

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

            return $id;

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

            $this->prefix = \App\Mail\RecordFinder::getRecordNumberFromString($mail->get('subject'), 'HelpDesk');

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

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

            if (empty($parentId) && !empty($contactId)) {

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

                $queryGenerator = new \App\QueryGenerator('ServiceContracts');

    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

                    'relatedRecords' => [$contactId],

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

            }

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

                    'relatedRecords' => [$mailId],

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

            if (empty($this->prefix) && \Config\Modules\OSSMailScanner::$searchPrefixInBody) {

    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

                    'reverse' => true,

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

                    $dbCommand->insert('vtiger_senotesrel', ['crmid' => $id, 'notesid' => $documentId])->execute();

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

                $queryGenerator->setFields(['id', 'contract_priority']);

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

                if (1 === $dataReader->count()) {

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

            }

    Line exceeds 120 characters; contains 153 characters
    Open

            $dbCommand->update('vtiger_crmentity', ['createdtime' => $this->mail->get('date'), 'smcreatorid' => $accountOwner], ['crmid' => $id])->execute();

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

                $recordId = $this->findRecord();

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

                }

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

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

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

        public function process(OSSMail_Mail_Model $mail)

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

        public function add()

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

            $contactId = (int) $this->mail->findEmailAddress('from_email', 'Contacts', false);

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

                $queryGenerator->permissions = false;

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

                    if (App\Fields\Picklist::isExists('ticketpriorities', $serviceContracts['contract_priority'])) {

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

                        $record->set('ticketpriorities', $serviceContracts['contract_priority']);

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

                    'relatedModule' => 'OSSMailView',

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

                ];

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

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

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

                $dataReader->close();

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

    class OSSMailScanner_CreatedHelpDesk_ScannerAction extends OSSMailScanner_BindHelpDesk_ScannerAction

    There are no issues that match your filters.

    Category
    Status