CORE-POS/IS4C

View on GitHub
fannie/modules/plugins2.0/DeliInventory/index3.js

Summary

Maintainability
F
1 wk
Test Coverage

Function saveitem has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function saveitem(id){
    var item = escape(document.getElementById('itemname'+id).value);
    var orderno = document.getElementById('orderno'+id).value;
    var units = document.getElementById('units'+id).value;
    var cases = document.getElementById('cases'+id).value;
Severity: Minor
Found in fannie/modules/plugins2.0/DeliInventory/index3.js - About 1 hr to fix

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

    function saveitem(id){
        var item = escape(document.getElementById('itemname'+id).value);
        var orderno = document.getElementById('orderno'+id).value;
        var units = document.getElementById('units'+id).value;
        var cases = document.getElementById('cases'+id).value;
    Severity: Major
    Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 3 days to fix
    fannie/modules/plugins2.0/DeliInventory/index.js on lines 70..103

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

    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

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

    function edititem(id){
        if (in_queue(id)) return;
        else queue_add(id);
    
        var item = document.getElementById('item'+id+'col0').innerHTML;
    Severity: Major
    Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 3 days to fix
    fannie/modules/plugins2.0/DeliInventory/index.js on lines 31..54

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

    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

    function additem(category){
        var item = escape(document.getElementById('newitem'+category).value);
        var orderno = document.getElementById('neworderno'+category).value;
        var units = document.getElementById('newunits'+category).value;
        var price = document.getElementById('newprice'+category).value;
    Severity: Major
    Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 2 days to fix
    fannie/modules/plugins2.0/DeliInventory/index.js on lines 2..29

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

    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

    function saveCat(id){
        var newcat = document.getElementById('catSelect'+id).value;
        var clearName =  newcat.replace(/_/,' ');
        $.ajax({
            url: 'DeliInventoryPage2.php',
    Severity: Major
    Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 7 hrs to fix
    fannie/modules/plugins2.0/DeliInventory/index.js on lines 159..173

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

    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

    function deleteitem(id){
        if (confirm("Delete this item?")){
            saveAll();
    
            $.ajax({
    Severity: Major
    Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 5 hrs to fix
    fannie/modules/plugins2.0/DeliInventory/index.js on lines 105..124

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

    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

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

    function renameCategory(category){
        var curName = document.getElementById('category'+category).innerHTML;
        var clearName =  curName.replace(/_/,' ');
        var form = "<input type=text id=renameCategory"+category+" value=\""+clearName+"\" />";
        var link = " (<a href=\"\" onclick=\"saveCategory('"+category+"'); return false;\">Save</a>)";
    Severity: Major
    Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 4 hrs to fix
    fannie/modules/plugins2.0/DeliInventory/index.js on lines 126..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 132.

    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

    function saveCategory(category){
        var newcat = document.getElementById('renameCategory'+category).value;
        var dstr = 'action=saveCategory&oldcat='+category+'&newcat='+newcat;
        $.ajax({
            url: 'DeliInventoryPage2.php',
    Severity: Major
    Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 3 hrs to fix
    fannie/modules/plugins2.0/DeliInventory/index.js on lines 135..145

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

    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

    function catList(id,category){
        var dstr = 'action=catList&id='+id+'&category='+category;
        $.ajax({
            url: 'DeliInventoryPage2.php',
            type: 'get',
    Severity: Major
    Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 3 hrs to fix
    fannie/modules/plugins2.0/DeliInventory/index.js on lines 147..157

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

    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

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

    function queue_rm(val){
        var temp = new Array();
        for (var i = 0; i < editQueue.length; i++){
            if (editQueue[i] != val) temp.push(editQueue[i]);
        }
    Severity: Major
    Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 2 hrs to fix
    fannie/modules/plugins2.0/DeliInventory/index.js on lines 200..206

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

    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

        if(confirm("Are you sure you want to clear all totals?")) {
            $.ajax({
                url: 'DeliInventoryPage2.php',
                type: 'get',
                data: 'action=clearAll',
    Severity: Major
    Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 2 hrs to fix
    fannie/modules/plugins2.0/DeliInventory/index.js on lines 175..184

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

    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

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

    function in_queue(val){
        for (var i = 0; i < editQueue.length; i++){
            if (editQueue[i] == val) return true;
        }    
        return false;
    Severity: Minor
    Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 55 mins to fix
    fannie/modules/plugins2.0/DeliInventory/index.js on lines 189..194

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

    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

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

    function saveAll(){
        saveCount = 0;
        while (editQueue.length > 0){
            saveitem(editQueue.pop());
            saveCount++;
    Severity: Minor
    Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 40 mins to fix
    fannie/modules/plugins2.0/DeliInventory/index.js on lines 62..68

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

    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

    There are no issues that match your filters.

    Category
    Status