mambax7/cardealer

View on GitHub
admin/customer.php

Summary

Maintainability
D
2 days
Test Coverage

Similar blocks of code found in 7 locations. Consider refactoring.
Open

    case 'delete':
        $customerObject = $customerHandler->get(Request::getString('custnum', ''));
        if (1 == Request::getInt('ok', 0)) {
            if (!$GLOBALS['xoopsSecurity']->check()) {
                redirect_header('customer.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors()));
Severity: Major
Found in admin/customer.php and 6 other locations - About 7 hrs to fix
admin/part.php on lines 101..118
admin/service.php on lines 82..99
admin/servpart.php on lines 82..100
admin/vehicle.php on lines 102..120
admin/workorder.php on lines 84..102
admin/workserv.php on lines 81..99

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 202.

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    case 'save':
        if (!$GLOBALS['xoopsSecurity']->check()) {
            redirect_header('customer.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
        }
        if (0 != Request::getInt('custnum', 0)) {
Severity: Major
Found in admin/customer.php and 1 other location - About 7 hrs to fix
admin/workserv.php on lines 51..70

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 187.

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

Similar blocks of code found in 7 locations. Consider refactoring.
Open

                $customerArray['edit_delete']
                                           = "<a href='customer.php?op=edit&custnum=" . $i . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a>
               <a href='customer.php?op=delete&custnum=" . $i . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _DELETE . "' title='" . _DELETE . "'></a>
               <a href='customer.php?op=clone&custnum=" . $i . "'><img src=" . $pathIcon16 . "/editcopy.png alt='" . _CLONE . "' title='" . _CLONE . "'></a>";
Severity: Major
Found in admin/customer.php and 6 other locations - About 3 hrs to fix
admin/part.php on lines 198..201
admin/service.php on lines 167..170
admin/servpart.php on lines 169..171
admin/vehicle.php on lines 200..202
admin/workorder.php on lines 178..180
admin/workserv.php on lines 163..165

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 123.

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

Similar blocks of code found in 7 locations. Consider refactoring.
Open

        if ($customerTempRows > $customerPaginationLimit) {
            xoops_load('XoopsPageNav');

            $pagenav = new \XoopsPageNav($customerTempRows, $customerPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
            $GLOBALS['xoopsTpl']->assign('pagenav', null === $pagenav ? $pagenav->renderNav() : '');
Severity: Major
Found in admin/customer.php and 6 other locations - About 1 hr to fix
admin/part.php on lines 147..152
admin/service.php on lines 128..133
admin/servpart.php on lines 129..134
admin/vehicle.php on lines 149..154
admin/workorder.php on lines 131..136
admin/workserv.php on lines 128..133

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 91.

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

Similar blocks of code found in 7 locations. Consider refactoring.
Open

            if ($customerCount > $customerPaginationLimit) {
                xoops_load('XoopsPageNav');
                $pagenav = new \XoopsPageNav($customerCount, $customerPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
                $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
            }
Severity: Major
Found in admin/customer.php and 6 other locations - About 50 mins to fix
admin/part.php on lines 208..212
admin/service.php on lines 177..181
admin/servpart.php on lines 178..182
admin/vehicle.php on lines 209..213
admin/workorder.php on lines 187..191
admin/workserv.php on lines 172..176

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 81.

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

Similar blocks of code found in 7 locations. Consider refactoring.
Open

    case 'edit':
        $adminObject->addItemButton(AM_CARDEALER_ADD_CUSTOMER, 'customer.php?op=new', 'add');
        $adminObject->addItemButton(AM_CARDEALER_CUSTOMER_LIST, 'customer.php', 'list');
        $adminObject->displayButton('left');
        $customerObject = $customerHandler->get(Request::getString('custnum', ''));
Severity: Major
Found in admin/customer.php and 6 other locations - About 35 mins to fix
admin/part.php on lines 92..99
admin/service.php on lines 73..80
admin/servpart.php on lines 73..80
admin/vehicle.php on lines 93..100
admin/workorder.php on lines 75..82
admin/workserv.php on lines 72..79

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 77.

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

The CASE body must start on the line following the statement
Open

    case 'clone':
Severity: Minor
Found in admin/customer.php by phpcodesniffer

Line exceeds 120 characters; contains 157 characters
Open

               <a href='customer.php?op=delete&custnum=" . $i . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _DELETE . "' title='" . _DELETE . "'></a>
Severity: Minor
Found in admin/customer.php by phpcodesniffer

Line exceeds 120 characters; contains 160 characters
Open

                $pagenav = new \XoopsPageNav($customerCount, $customerPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
Severity: Minor
Found in admin/customer.php by phpcodesniffer

Line exceeds 120 characters; contains 171 characters
Open

            echo $GLOBALS['xoopsTpl']->fetch(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . '/templates/admin/cardealer_admin_customer.tpl');
Severity: Minor
Found in admin/customer.php by phpcodesniffer

Line exceeds 120 characters; contains 147 characters
Open

                          ], Request::getUrl('REQUEST_URI', '', 'SERVER'), sprintf(AM_CARDEALER_FORMSUREDEL, $customerObject->getVar('custname')));
Severity: Minor
Found in admin/customer.php by phpcodesniffer

Line exceeds 120 characters; contains 159 characters
Open

            $pagenav = new \XoopsPageNav($customerTempRows, $customerPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
Severity: Minor
Found in admin/customer.php by phpcodesniffer

Line exceeds 120 characters; contains 180 characters
Open

                                           = "<a href='customer.php?op=edit&custnum=" . $i . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a>
Severity: Minor
Found in admin/customer.php by phpcodesniffer

Line exceeds 120 characters; contains 158 characters
Open

               <a href='customer.php?op=clone&custnum=" . $i . "'><img src=" . $pathIcon16 . "/editcopy.png alt='" . _CLONE . "' title='" . _CLONE . "'></a>";
Severity: Minor
Found in admin/customer.php by phpcodesniffer

There are no issues that match your filters.

Category
Status