YetiForceCompany/YetiForceCRM

View on GitHub
modules/Leads/views/ConvertLead.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '41', column '14').
Open

            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

MissingImport

Since: 2.7.0

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

Example

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

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

Missing class import via use statement (line '44', column '14').
Open

            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

MissingImport

Since: 2.7.0

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

Example

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

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

Missing class import via use statement (line '38', column '14').
Open

            throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

MissingImport

Since: 2.7.0

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

Example

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

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

Missing class import via use statement (line '34', column '14').
Open

            throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

MissingImport

Since: 2.7.0

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

Example

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

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

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

        if (!\App\Privilege::isPermitted($moduleName, 'ConvertLead')) {
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

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

        $marketingProcessConfig = Vtiger_Processes_Model::getConfig('marketing', 'conversion');
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

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

        $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

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

        } else {
            $assignedToFieldModel->set('fieldvalue', $this->record->get('assigned_user_id'));
        }
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

ElseExpression

Since: 1.4.0

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

Example

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

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

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

        $currentUserPriviligeModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

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

            $assignedToFieldModel->set('fieldvalue', App\User::getCurrentUserId());
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

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

        $this->record = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

Avoid using static access to class 'Leads_Module_Model' in method 'checkPermission'.
Open

        if (!Leads_Module_Model::checkIfAllowedToConvert($this->record->get('leadstatus'))) {
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

StaticAccess

Since: 1.4.0

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

Example

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

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

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('RECORD', $this->record);
Severity: Critical
Found in modules/Leads/views/ConvertLead.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('CONVERT_LEAD_FIELDS', $this->record->getConvertLeadFields());
Severity: Critical
Found in modules/Leads/views/ConvertLead.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('ASSIGN_TO', $assignedToFieldModel);
Severity: Critical
Found in modules/Leads/views/ConvertLead.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
Severity: Critical
Found in modules/Leads/views/ConvertLead.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('CONVERSION_CONFIG', $marketingProcessConfig);
Severity: Critical
Found in modules/Leads/views/ConvertLead.php by phan

Assigning false to property but \Leads_ConvertLead_View->record is \Vtiger_Record_Model
Open

    protected $record = false;
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('CURRENT_USER_PRIVILEGE', $currentUserPriviligeModel);
Severity: Critical
Found in modules/Leads/views/ConvertLead.php by phan

Call to undeclared method \Vtiger_Record_Model::getConvertLeadFields
Open

        $viewer->assign('CONVERT_LEAD_FIELDS', $this->record->getConvertLeadFields());
Severity: Critical
Found in modules/Leads/views/ConvertLead.php by phan

Call to method getCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
Open

            $assignedToFieldModel->set('fieldvalue', App\User::getCurrentUserId());
Severity: Critical
Found in modules/Leads/views/ConvertLead.php by phan

Call to undeclared method \Vtiger_Viewer::assign
Open

        $viewer->assign('MODULE', $moduleName);
Severity: Critical
Found in modules/Leads/views/ConvertLead.php by phan

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

        $currentUserPriviligeModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

LongVariable

Since: 0.2

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

Example

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

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

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

        $marketingProcessConfig = Vtiger_Processes_Model::getConfig('marketing', 'conversion');
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

LongVariable

Since: 0.2

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

Example

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

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

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

class Leads_ConvertLead_View extends Vtiger_Index_View

The class Leads_ConvertLead_View is not named in CamelCase.
Open

class Leads_ConvertLead_View extends Vtiger_Index_View
{
    /**
     * Record model instance.
     *
Severity: Minor
Found in modules/Leads/views/ConvertLead.php by phpmd

CamelCaseClassName

Since: 0.2

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

Example

class class_name {
}

Source

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

        if (!$this->record->isEditable()) {

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

        $moduleModel = $this->record->getModule();

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

        $marketingProcessConfig = Vtiger_Processes_Model::getConfig('marketing', 'conversion');

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

        $viewer->assign('RECORD', $this->record);

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

        if ('true' === $marketingProcessConfig['change_owner']) {

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

        if (!Leads_Module_Model::checkIfAllowedToConvert($this->record->get('leadstatus'))) {

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

        $viewer->assign('CONVERSION_CONFIG', $marketingProcessConfig);

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

        $viewer->assign('ASSIGN_TO', $assignedToFieldModel);

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

        $viewer->view('ConvertLead.tpl', $moduleName);

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

        $recordId = $request->getInteger('record');

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

            throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

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

        $viewer = $this->getViewer($request);

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

        $viewer->assign('CURRENT_USER_PRIVILEGE', $currentUserPriviligeModel);

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

            $assignedToFieldModel->set('fieldvalue', $this->record->get('assigned_user_id'));

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

     *

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

    /**

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

     * @throws \App\Exceptions\NoPermittedToRecord

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

        }

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

        } else {

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

    /**

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

        $viewer->assign('MODULE', $moduleName);

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

            throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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

        if (!\App\Privilege::isPermitted($moduleName, 'ConvertLead')) {

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

        $moduleName = $request->getModule();

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

     */

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

        $moduleName = $request->getModule();

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

        $this->record = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);

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 Vtiger_Record_Model

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

     * @param \App\Request $request

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

     * @throws \App\Exceptions\NoPermitted

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

        $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());

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

     * Record model instance.

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

            $assignedToFieldModel->set('fieldvalue', App\User::getCurrentUserId());

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

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

            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

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

        $viewer->assign('CONVERT_LEAD_FIELDS', $this->record->getConvertLeadFields());

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

     */

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

    protected $record = false;

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

     * Function to check permission.

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

     *

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

        }

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

    public function process(App\Request $request)

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

        $assignedToFieldModel = $moduleModel->getFieldByName('assigned_user_id');

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

    public function checkPermission(App\Request $request)

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

    {

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

        $currentUserPriviligeModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

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

class Leads_ConvertLead_View extends Vtiger_Index_View

There are no issues that match your filters.

Category
Status