mambax7/cardealer

View on GitHub
admin/workorder.php

Summary

Maintainability
D
1 day
Test Coverage

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

    case 'delete':
        $workorderObject = $workorderHandler->get(Request::getString('id', ''));
        if (1 == Request::getInt('ok', 0)) {
            if (!$GLOBALS['xoopsSecurity']->check()) {
                redirect_header('workorder.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors()));
Severity: Major
Found in admin/workorder.php and 6 other locations - About 7 hrs to fix
admin/customer.php on lines 81..98
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/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 7 locations. Consider refactoring.
Open

                $workorderArray['edit_delete'] = "<a href='workorder.php?op=edit&id=" . $i . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a>
               <a href='workorder.php?op=delete&id=" . $i . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _DELETE . "' title='" . _DELETE . "'></a>
               <a href='workorder.php?op=clone&id=" . $i . "'><img src=" . $pathIcon16 . "/editcopy.png alt='" . _CLONE . "' title='" . _CLONE . "'></a>";
Severity: Major
Found in admin/workorder.php and 6 other locations - About 3 hrs to fix
admin/customer.php on lines 161..164
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/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 ($workorderTempRows > $workorderPaginationLimit) {
            xoops_load('XoopsPageNav');

            $pagenav = new \XoopsPageNav($workorderTempRows, $workorderPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
            $GLOBALS['xoopsTpl']->assign('pagenav', null === $pagenav ? $pagenav->renderNav() : '');
Severity: Major
Found in admin/workorder.php and 6 other locations - About 1 hr to fix
admin/customer.php on lines 127..132
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/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 ($workorderCount > $workorderPaginationLimit) {
                xoops_load('XoopsPageNav');
                $pagenav = new \XoopsPageNav($workorderCount, $workorderPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
                $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
            }
Severity: Major
Found in admin/workorder.php and 6 other locations - About 50 mins to fix
admin/customer.php on lines 171..175
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/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_WORKORDER, 'workorder.php?op=new', 'add');
        $adminObject->addItemButton(AM_CARDEALER_WORKORDER_LIST, 'workorder.php', 'list');
        $adminObject->displayButton('left');
        $workorderObject = $workorderHandler->get(Request::getString('id', ''));
Severity: Major
Found in admin/workorder.php and 6 other locations - About 35 mins to fix
admin/customer.php on lines 72..79
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/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

Blank line found at start of control structure
Open

            foreach (array_keys($workorderTempArray) as $i) {
Severity: Minor
Found in admin/workorder.php by phpcodesniffer

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

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

Line exceeds 120 characters; contains 180 characters
Open

                $workorderArray['edit_delete'] = "<a href='workorder.php?op=edit&id=" . $i . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a>
Severity: Minor
Found in admin/workorder.php by phpcodesniffer

Line exceeds 120 characters; contains 162 characters
Open

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

Line exceeds 120 characters; contains 154 characters
Open

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

Line exceeds 120 characters; contains 161 characters
Open

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

Line exceeds 120 characters; contains 127 characters
Open

                $workorderArray['orderdate'] = date(_SHORTDATESTRING, strtotime($workorderTempArray[$i]->getVar('orderdate')));
Severity: Minor
Found in admin/workorder.php by phpcodesniffer

Line exceeds 120 characters; contains 153 characters
Open

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

Line exceeds 120 characters; contains 131 characters
Open

                $workorderArray['custnum'] = $customerHandler->get($workorderTempArray[$i]->getVar('custnum'))->getVar('custname');
Severity: Minor
Found in admin/workorder.php by phpcodesniffer

Line exceeds 120 characters; contains 129 characters
Open

                $workorderArray['carnum'] = $vehicleHandler->get($workorderTempArray[$i]->getVar('carnum'))->getVar('serialnum');
Severity: Minor
Found in admin/workorder.php by phpcodesniffer

Line exceeds 120 characters; contains 147 characters
Open

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

Line exceeds 120 characters; contains 172 characters
Open

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

There are no issues that match your filters.

Category
Status