YetiForceCompany/YetiForceCRM

View on GitHub
modules/Products/Products.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

    public function setRelationTables($secmodule = false)
Severity: Minor
Found in modules/Products/Products.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

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

Example

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

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

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

    public $tab_name_index = ['vtiger_crmentity' => 'crmid', 'vtiger_products' => 'productid', 'vtiger_productcf' => 'productid', 'vtiger_seproductsrel' => 'productid'];
Severity: Critical
Found in modules/Products/Products.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_seproductsrel" 4 times.
Open

    public $tab_name_index = ['vtiger_crmentity' => 'crmid', 'vtiger_products' => 'productid', 'vtiger_productcf' => 'productid', 'vtiger_seproductsrel' => 'productid'];
Severity: Critical
Found in modules/Products/Products.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 "products" 3 times.
Open

        'Product Name' => ['products' => 'productname'],
Severity: Critical
Found in modules/Products/Products.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_productcf" 3 times.
Open

    public $customFieldTable = ['vtiger_productcf', 'productid'];
Severity: Critical
Found in modules/Products/Products.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 "productname" 4 times.
Open

        'Product Name' => 'productname',
Severity: Critical
Found in modules/Products/Products.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 "productid" 15 times.
Open

    public $table_index = 'productid';
Severity: Critical
Found in modules/Products/Products.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_products" 9 times.
Open

    public $table_name = 'vtiger_products';
Severity: Critical
Found in modules/Products/Products.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.

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

class Products extends CRMEntity

The property $tab_name_index is not named in camelCase.
Open

class Products extends CRMEntity
{
    public $table_name = 'vtiger_products';
    public $table_index = 'productid';
    public $column_fields = [];
Severity: Minor
Found in modules/Products/Products.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 property $default_sort_order is not named in camelCase.
Open

class Products extends CRMEntity
{
    public $table_name = 'vtiger_products';
    public $table_index = 'productid';
    public $column_fields = [];
Severity: Minor
Found in modules/Products/Products.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 property $def_basicsearch_col is not named in camelCase.
Open

class Products extends CRMEntity
{
    public $table_name = 'vtiger_products';
    public $table_index = 'productid';
    public $column_fields = [];
Severity: Minor
Found in modules/Products/Products.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 property $list_fields_name is not named in camelCase.
Open

class Products extends CRMEntity
{
    public $table_name = 'vtiger_products';
    public $table_index = 'productid';
    public $column_fields = [];
Severity: Minor
Found in modules/Products/Products.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 property $search_fields is not named in camelCase.
Open

class Products extends CRMEntity
{
    public $table_name = 'vtiger_products';
    public $table_index = 'productid';
    public $column_fields = [];
Severity: Minor
Found in modules/Products/Products.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 property $default_order_by is not named in camelCase.
Open

class Products extends CRMEntity
{
    public $table_name = 'vtiger_products';
    public $table_index = 'productid';
    public $column_fields = [];
Severity: Minor
Found in modules/Products/Products.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 property $table_name is not named in camelCase.
Open

class Products extends CRMEntity
{
    public $table_name = 'vtiger_products';
    public $table_index = 'productid';
    public $column_fields = [];
Severity: Minor
Found in modules/Products/Products.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 property $table_index is not named in camelCase.
Open

class Products extends CRMEntity
{
    public $table_name = 'vtiger_products';
    public $table_index = 'productid';
    public $column_fields = [];
Severity: Minor
Found in modules/Products/Products.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 property $tab_name is not named in camelCase.
Open

class Products extends CRMEntity
{
    public $table_name = 'vtiger_products';
    public $table_index = 'productid';
    public $column_fields = [];
Severity: Minor
Found in modules/Products/Products.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 property $mandatory_fields is not named in camelCase.
Open

class Products extends CRMEntity
{
    public $table_name = 'vtiger_products';
    public $table_index = 'productid';
    public $column_fields = [];
Severity: Minor
Found in modules/Products/Products.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 property $column_fields is not named in camelCase.
Open

class Products extends CRMEntity
{
    public $table_name = 'vtiger_products';
    public $table_index = 'productid';
    public $column_fields = [];
Severity: Minor
Found in modules/Products/Products.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 property $search_fields_name is not named in camelCase.
Open

class Products extends CRMEntity
{
    public $table_name = 'vtiger_products';
    public $table_index = 'productid';
    public $column_fields = [];
Severity: Minor
Found in modules/Products/Products.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

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

    //Added these variables which are used as default order by and sortorder in ListView

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

     * @param bool|string $secmodule secondary module name

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

        if (false === $secmodule) {

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

    /**

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

        'Part Number' => 'productcode',

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

            'Contacts' => ['vtiger_seproductsrel' => ['productid', 'crmid'], 'vtiger_products' => 'productid'],

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

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

        return $relTables[$secmodule];

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

        'Unit Price' => ['products' => 'unit_price'],

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

    }

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

    /** @var string[] List of fields in the RelationListView */

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

            'Leads' => ['vtiger_seproductsrel' => ['productid', 'crmid'], 'vtiger_products' => 'productid'],

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

    public $table_index = 'productid';

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

    public $default_sort_order = 'ASC';

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

    // Refers to vtiger_field.fieldname values.

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

            'Accounts' => ['vtiger_seproductsrel' => ['productid', 'crmid'], 'vtiger_products' => 'productid'],

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

            'Documents' => ['vtiger_senotesrel' => ['crmid', 'notesid'], 'vtiger_products' => 'productid'],

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

    public $customFieldTable = ['vtiger_productcf', 'productid'];

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

    public $search_fields_name = [];

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

        $relTables = [

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

            'HelpDesk' => ['vtiger_troubletickets' => ['product_id', 'ticketid'], 'vtiger_products' => 'productid'],

Line exceeds 120 characters; contains 169 characters
Open

    public $tab_name_index = ['vtiger_crmentity' => 'crmid', 'vtiger_products' => 'productid', 'vtiger_productcf' => 'productid', 'vtiger_seproductsrel' => 'productid'];

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

    public $list_fields_name = [

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

    public $table_name = 'vtiger_products';

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

    public $tab_name_index = ['vtiger_crmentity' => 'crmid', 'vtiger_products' => 'productid', 'vtiger_productcf' => 'productid', 'vtiger_seproductsrel' => 'productid'];

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

        'Product Name' => 'productname',

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

    public $default_order_by = '';

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

            'PriceBooks' => ['vtiger_pricebookproductrel' => ['productid', 'pricebookid'], 'vtiger_products' => 'productid'],

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 $tab_name = ['vtiger_crmentity', 'vtiger_products', 'vtiger_productcf'];

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

    public $search_fields = [

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

     * Function to get the relation tables for related modules.

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

     * Mandatory table for supporting custom fields.

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

        'Commission Rate' => 'commissionrate',

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

    // Used when enabling/disabling the mandatory fields for the module.

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

    public $column_fields = [];

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 setRelationTables($secmodule = 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

        'Qty/Unit' => 'qty_per_unit',

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

        'Unit Price' => 'unit_price',

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

        'Product Name' => ['products' => 'productname'],

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

        'Part Number' => ['products' => 'productcode'],

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

    public $def_basicsearch_col = 'productname';

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

     * @return array returns the array with table names and fieldnames storing relations between module and this 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

            return $relTables;

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 $mandatory_fields = ['createdtime', 'modifiedtime', 'productname', 'assigned_user_id'];

Line exceeds 120 characters; contains 125 characters
Open

            'PriceBooks' => ['vtiger_pricebookproductrel' => ['productid', 'pricebookid'], 'vtiger_products' => 'productid'],

There are no issues that match your filters.

Category
Status