YetiForceCompany/YetiForceCRM

View on GitHub
app/TextParser/ProductsTableImages.php

Summary

Maintainability
D
1 day
Test Coverage
F
0%

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

    public function process()
    {
        $html = '';
        if (!$this->textParser->recordModel->getModule()->isInventory()) {
            return $html;
Severity: Minor
Found in app/TextParser/ProductsTableImages.php - About 1 day 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 process has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process()
    {
        $html = '';
        if (!$this->textParser->recordModel->getModule()->isInventory()) {
            return $html;
Severity: Major
Found in app/TextParser/ProductsTableImages.php - About 4 hrs to fix

    The method process() has an NPath complexity of 14336. The configured NPath complexity threshold is 200.
    Open

        public function process()
        {
            $html = '';
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
                return $html;

    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 process() has 118 lines of code. Current threshold is set to 100. Avoid really long methods.
    Open

        public function process()
        {
            $html = '';
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
                return $html;

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

        public function process()
        {
            $html = '';
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
                return $html;

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

        public function process()

    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

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

                    $item['headerHtml'] = "<th class=\"col-type-{$fieldModel->getType()}\" style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . '</th>';

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

                        $imageData = \App\Json::decode($imageDataJson);

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

        public function process()
        {
            $html = '';
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
                return $html;

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

                            $base64 = \App\Fields\File::getImageBaseData($imageData[0]['path']);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            $baseCurrency = \Vtiger_Util_Helper::getBaseCurrency();

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

                } else {
                    $currency = $baseCurrency['id'];
                }

    ElseExpression

    Since: 1.4.0

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

    Example

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

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

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

            $inventory = \Vtiger_Inventory_Model::getInstance($this->textParser->moduleName);

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

            } else {
                $currencySymbol = \App\Fields\Currency::getDefault()['currency_symbol'];
            }

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

                        } else {
                            $itemValue = $inventoryRow[$columnName];
                            if ('Name' === $typeName) {
                                $fieldValue = '<strong>' . $fieldModel->getDisplayValue($itemValue) . '</strong>';
                                foreach ($inventory->getFieldsByType('Comment') as $commentField) {

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

                            } else {
                                $fieldValue = $fieldModel->getDisplayValue($itemValue);
                            }

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

                        $footerHtml .= \CurrencyField::appendCurrencySymbol(\CurrencyField::convertToUserFormat($sum, null, true), $currencySymbol);

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

                                $fieldValue = \CurrencyField::appendCurrencySymbol($fieldModel->getDisplayValue($itemValue, $inventoryRow), $currencySymbol);

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

                    } else {
                        $columnName = $fieldModel->getColumnName();
                        $typeName = $fieldModel->getType();
                        if ('ItemNumber' === $typeName) {
                            $columnHtml = "<td class=\"col-type-{$typeName}\" style=\"{$bodyStyle}text-align:center;\"><strong>" . $counter++ . '</strong></td>';

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

                        $footerHtml .= \CurrencyField::appendCurrencySymbol(\CurrencyField::convertToUserFormat($sum, null, true), $currencySymbol);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Fields\Currency' in method 'process'.
    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\Language' in method 'process'.
    Open

                'headerHtml' => "<th style=\"{$headerStyle}\">" . \App\Language::translate('PLL_IMAGE', 'Settings:PDF') . '</th>',

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

        public function process()
        {
            $html = '';
            if (!$this->textParser->recordModel->getModule()->isInventory()) {
                return $html;

    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

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

                    $item['footerHtml'] = $footerHtml;

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

                    $item['headerHtml'] = "<th class=\"col-type-{$fieldModel->getType()}\" style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . '</th>';

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

                    $item['model'] = $fieldModel;

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

                    $item['headerHtml'] = "<th class=\"col-type-{$fieldModel->getType()}\" style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . '</th>';

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

            if ($inventory->isField('currency')) {

    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 instance property recordModel from undeclared class \App\TextParser
    Open

            if (!$this->textParser->recordModel->getModule()->isInventory()) {
    Severity: Minor
    Found in app/TextParser/ProductsTableImages.php by phan

    Reference to instance property moduleName from undeclared class \App\TextParser
    Open

            $inventory = \Vtiger_Inventory_Model::getInstance($this->textParser->moduleName);
    Severity: Minor
    Found in app/TextParser/ProductsTableImages.php by phan

    Argument 2 (user) is null but \CurrencyField::convertToUserFormat() takes \App\User defined at /code/include/fields/CurrencyField.php:144
    Open

                        $footerHtml .= \CurrencyField::appendCurrencySymbol(\CurrencyField::convertToUserFormat($sum, null, true), $currencySymbol);
    Severity: Minor
    Found in app/TextParser/ProductsTableImages.php by phan

    Reference to instance property moduleName from undeclared class \App\TextParser
    Open

                    $item['headerHtml'] = "<th class=\"col-type-{$fieldModel->getType()}\" style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . '</th>';
    Severity: Minor
    Found in app/TextParser/ProductsTableImages.php by phan

    Argument 1 (currencyValue) is string but \CurrencyField::appendCurrencySymbol() takes \Number defined at /code/include/fields/CurrencyField.php:225
    Open

                        $footerHtml .= \CurrencyField::appendCurrencySymbol(\CurrencyField::convertToUserFormat($sum, null, true), $currencySymbol);
    Severity: Minor
    Found in app/TextParser/ProductsTableImages.php by phan

    Reference to instance property recordModel from undeclared class \App\TextParser
    Open

            $inventoryRows = $this->textParser->recordModel->getInventoryData();
    Severity: Minor
    Found in app/TextParser/ProductsTableImages.php by phan

    Call to deprecated function \CurrencyField::convertToUserFormat() defined at /code/include/fields/CurrencyField.php:144
    Open

                        $footerHtml .= \CurrencyField::appendCurrencySymbol(\CurrencyField::convertToUserFormat($sum, null, true), $currencySymbol);
    Severity: Minor
    Found in app/TextParser/ProductsTableImages.php by phan

    Identical blocks of code found in 11 locations. Consider refactoring.
    Open

            if ($inventory->isField('currency')) {
                if (!empty($firstRow) && null !== $firstRow['currency']) {
                    $currency = $firstRow['currency'];
                } else {
                    $currency = $baseCurrency['id'];
    Severity: Major
    Found in app/TextParser/ProductsTableImages.php and 10 other locations - About 45 mins to fix
    app/TextParser/ProductsTableCorrectingBefore.php on lines 38..47
    app/TextParser/ProductsTableLongVTwoLang.php on lines 37..46
    app/TextParser/ProductsTableLongVersion.php on lines 37..46
    app/TextParser/ProductsTableNew.php on lines 37..46
    app/TextParser/ProductsTableShortVersion.php on lines 37..46
    app/TextParser/TableCorrectTaxSummary.php on lines 46..55
    app/TextParser/TableDiscountSTwoLang.php on lines 38..47
    app/TextParser/TableDiscountSummary.php on lines 38..47
    app/TextParser/TableTaxSTwoLang.php on lines 38..47
    app/TextParser/TableTaxSummary.php on lines 38..47

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 96.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

            $html = '';

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

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

        public $type = 'pdf';

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

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

         * Process.

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

            if (!$this->textParser->recordModel->getModule()->isInventory()) {

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

        public $name = 'LBL_PRODUCTS_TABLE_IMAGES';

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

            $inventory = \Vtiger_Inventory_Model::getInstance($this->textParser->moduleName);

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

        /** @var mixed Parser type */

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

        /** @var string Class name */

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

            }

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

            $baseCurrency = \Vtiger_Util_Helper::getBaseCurrency();

    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

                    $footerHtml .= '</th>';

    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

                $html .= $field['headerHtml'];

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

                ++$counter;

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

            $displayFields = [];

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

            $html .= '</tr></tfoot></table>';

    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

                                        $fieldValue .= '<br />' . $comment;

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

                                $fieldValue = $fieldModel->getDisplayValue($itemValue);

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

            } else {

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

                    }

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

                    $item = [];

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

                    $fieldModel = $field['model'];

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

                        if ('ItemNumber' === $typeName) {

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

                            $columnHtml = "<td class=\"col-type-barcode\" style=\"{$bodyStyle}\"><div data-barcode=\"EAN13\" data-code=\"$code\" data-size=\"1\" data-height=\"16\">{$code}</div></td>";

    Line exceeds 120 characters; contains 153 characters
    Open

                                $fieldValue = \CurrencyField::appendCurrencySymbol($fieldModel->getDisplayValue($itemValue, $inventoryRow), $currencySymbol);

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

                            } else {

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

            }

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

            $html .= '</tr></thead><tbody>';

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

            foreach ($displayRows as $rowHtml) {

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

            $inventoryRows = $this->textParser->recordModel->getInventoryData();

    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

            $headerStyle = 'font-size:9px;padding:0px 4px;text-align:center;';

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

                    $footerHtml = "<th class=\"col-type-{$fieldModel->getType()}\" style=\"{$headerStyle}\">";

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

                    if ($fieldModel->isSummary()) {

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

                'model' => 'image',

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

                $rowHtml = '';

    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

                            } elseif (\in_array($typeName, ['TotalPrice', 'GrossPrice', 'UnitPrice'])) {

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

            foreach ($displayFields as $field) {

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

                    $currency = $firstRow['currency'];

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

                $currencySymbol = \App\Fields\Currency::getById($currency)['currency_symbol'];

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

            $displayRows = [];

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

                foreach ($displayFields as $field) {

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

                            $columnHtml = "<td class=\"col-type-{$typeName}\" style=\"{$bodyStyle}text-align:center;\"><strong>" . $counter++ . '</strong></td>';

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

                        } elseif ('ean' === $columnName) {

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

                                foreach ($inventory->getFieldsByType('Comment') as $commentField) {

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

            }

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

                $html .= "<tr class=\"row-$counter\">$rowHtml</tr>";

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

                    $item['footerHtml'] = $footerHtml;

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

            array_splice($displayFields, 1, 0, [[

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

            foreach ($inventoryRows as $inventoryRow) {

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

                        if (!empty($imageData) && !empty($imageData[0]['path'])) {

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

                            $itemValue = $inventoryRow[$columnName];

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

                            $columnHtml = $itemHtml;

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

                }

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

                $displayRows[] = $rowHtml;

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

            }

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

                    if (!$fieldModel->isVisible()) {

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

                    $displayFields[] = $item;

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

            }

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

                'footerHtml' => '<th></th>',

    Line exceeds 120 characters; contains 157 characters
    Open

                            $columnHtml = "<td class=\"col-type-{$typeName}\" style=\"{$bodyStyle}text-align:center;\"><strong>" . $counter++ . '</strong></td>';

    Line exceeds 120 characters; contains 193 characters
    Open

                                    if ($commentField->isVisible() && ($value = $inventoryRow[$commentField->getColumnName()]) && $comment = $commentField->getDisplayValue($value, $inventoryRow)) {

    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 (['ItemNumber', 'Name', 'Quantity', 'UnitPrice', 'TotalPrice', 'GrossPrice'] as $fieldType) {

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

                        $sum = 0;

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

                            $sum += $inventoryRow[$columnName];

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

            if (empty($displayFields)) {

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

                                $fieldValue = '<strong>' . $fieldModel->getDisplayValue($itemValue) . '</strong>';

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

                                    if ($commentField->isVisible() && ($value = $inventoryRow[$commentField->getColumnName()]) && $comment = $commentField->getDisplayValue($value, $inventoryRow)) {

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

                                $fieldStyle = $bodyStyle . 'text-align:right;';

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

            $html .= '</tbody><tfoot><tr>';

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

            }

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

            $firstRow = current($inventoryRows);

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

                foreach ($inventory->getFieldsByType($fieldType) as $fieldModel) {

    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 ('image' === $fieldModel) {

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

                        }

    Line exceeds 120 characters; contains 144 characters
    Open

                        $columnHtml = "<td class=\"col-type-image\" style=\"border:1px solid #ddd;padding:0px 4px;text-align:center;\">$image</td>";

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

                $html .= $field['footerHtml'];

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

            if ($inventory->isField('currency')) {

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

            $bodyStyle = 'font-size:8px;border:1px solid #ddd;padding:0px 4px;';

    Line exceeds 120 characters; contains 144 characters
    Open

                        $footerHtml .= \CurrencyField::appendCurrencySymbol(\CurrencyField::convertToUserFormat($sum, null, true), $currencySymbol);

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

                        $columnHtml = "<td class=\"col-type-image\" style=\"border:1px solid #ddd;padding:0px 4px;text-align:center;\">$image</td>";

    Line exceeds 120 characters; contains 196 characters
    Open

                            $columnHtml = "<td class=\"col-type-barcode\" style=\"{$bodyStyle}\"><div data-barcode=\"EAN13\" data-code=\"$code\" data-size=\"1\" data-height=\"16\">{$code}</div></td>";

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

            $counter = 0;

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

            return $html;

    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

                    $item['model'] = $fieldModel;

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

                        foreach ($inventoryRows as $inventoryRow) {

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

                        $footerHtml .= \CurrencyField::appendCurrencySymbol(\CurrencyField::convertToUserFormat($sum, null, true), $currencySymbol);

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

                'headerHtml' => "<th style=\"{$headerStyle}\">" . \App\Language::translate('PLL_IMAGE', 'Settings:PDF') . '</th>',

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

                    $rowHtml .= $columnHtml;

    Line exceeds 120 characters; contains 126 characters
    Open

                'headerHtml' => "<th style=\"{$headerStyle}\">" . \App\Language::translate('PLL_IMAGE', 'Settings:PDF') . '</th>',

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

            $counter = 1;

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

                        $typeName = $fieldModel->getType();

    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($firstRow) && null !== $firstRow['currency']) {

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

                }

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

                    $item['headerHtml'] = "<th class=\"col-type-{$fieldModel->getType()}\" style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . '</th>';

    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

                        $image = '';

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

                            $image = '<img src="' . $base64 . '" style="width:80px;height:auto;">';

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

                        $columnName = $fieldModel->getColumnName();

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

                        }

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

                    $currency = $baseCurrency['id'];

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

                            $itemHtml = "<td class=\"col-type-{$typeName}\" style=\"{$fieldStyle}\">{$fieldValue}</td>";

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

            $html .= '<table class="products-table-images" style="width:100%; border-collapse:collapse;"><thead><tr>';

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

            foreach ($displayFields as $field) {

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

                $currencySymbol = \App\Fields\Currency::getDefault()['currency_symbol'];

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

                    $columnName = $fieldModel->getColumnName();

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

                            $code = $inventoryRow[$columnName];

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

                            if ('Name' === $typeName) {

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

                                    }

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

                                $fieldValue = \CurrencyField::appendCurrencySymbol($fieldModel->getDisplayValue($itemValue, $inventoryRow), $currencySymbol);

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

                            }

    Line exceeds 120 characters; contains 209 characters
    Open

                    $item['headerHtml'] = "<th class=\"col-type-{$fieldModel->getType()}\" style=\"{$headerStyle}\">" . \App\Language::translate($fieldModel->get('label'), $this->textParser->moduleName) . '</th>';

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

                    }

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

                    $fieldStyle = $bodyStyle;

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

                        $imageDataJson = \Vtiger_Record_Model::getInstanceById($inventoryRow['name'])->get('imagename');

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

                        $imageData = \App\Json::decode($imageDataJson);

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

                            $base64 = \App\Fields\File::getImageBaseData($imageData[0]['path']);

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

        }

    There are no issues that match your filters.

    Category
    Status