View | Details | Raw Unified | Return to bug 25317
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc (-16 lines)
Lines 1-16 Link Here
1
<!-- additem.js.inc -->
2
<script>
3
    var MSG_ADDITEM_JS_ADDITEM = _("Add item");
4
    var MSG_ADDITEM_JS_ADDMULTI = _("Add multiple items");
5
    var MSG_ADDITEM_JS_MULTIVAL = _("Number of items to add");
6
    var MSG_ADDITEM_JS_MULTI_UNIQUE_NOTE = _("NOTE: Fields listed in the \'UniqueItemsFields\' system preference will not be copied");
7
    var MSG_ADDITEM_JS_SUBMITMULTI = _("Add");
8
    var MSG_ADDITEM_JS_UPDATEITEM = _("Update item");
9
    var MSG_ADDITEM_JS_EDIT = _("Edit");
10
    var MSG_ADDITEM_JS_DELETE = _("Delete");
11
    var MSG_ADDITEM_JS_CLEAR = _("Clear");
12
    var MSG_ADDITEM_JS_CANT_RECEIVE_MORE_ITEMS = _("You can't receive any more items");
13
    var MSG_ADDITEM_JS_IS_DUPLICATE = _("is duplicated");
14
    var MSG_ADDITEM_JS_ALREADY_EXISTS_IN_DB = _("already exists in database");
15
</script>
16
<!-- / additem.js.inc -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-1 lines)
Lines 504-510 Link Here
504
[% MACRO jsinclude BLOCK %]
504
[% MACRO jsinclude BLOCK %]
505
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
505
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
506
    [% Asset.js("js/acq.js") | $raw %]
506
    [% Asset.js("js/acq.js") | $raw %]
507
    [% INCLUDE 'additem.js.inc' %]
508
    [% Asset.js("js/additem.js") | $raw %]
507
    [% Asset.js("js/additem.js") | $raw %]
509
    [% Asset.js("js/cataloging.js") | $raw %]
508
    [% Asset.js("js/cataloging.js") | $raw %]
510
    [% INCLUDE 'calendar.inc' %]
509
    [% INCLUDE 'calendar.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-1 lines)
Lines 371-377 Link Here
371
[% MACRO jsinclude BLOCK %]
371
[% MACRO jsinclude BLOCK %]
372
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
372
    [% Asset.js("js/acquisitions-menu.js") | $raw %]
373
[% INCLUDE 'calendar.inc' %]
373
[% INCLUDE 'calendar.inc' %]
374
    [% INCLUDE 'additem.js.inc' %]
375
    [% Asset.js("js/additem.js") | $raw %]
374
    [% Asset.js("js/additem.js") | $raw %]
376
    [% Asset.js("js/cataloging.js") | $raw %]
375
    [% Asset.js("js/cataloging.js") | $raw %]
377
    <script>
376
    <script>
(-)a/koha-tmpl/intranet-tmpl/prog/js/additem.js (-16 / +14 lines)
Lines 1-3 Link Here
1
/* global __ */
1
function addItem( node, unique_item_fields ) {
2
function addItem( node, unique_item_fields ) {
2
    var index = $(node).closest("div").attr('id');
3
    var index = $(node).closest("div").attr('id');
3
    var current_qty = parseInt($("#quantity").val());
4
    var current_qty = parseInt($("#quantity").val());
Lines 12-24 function addItem( node, unique_item_fields ) { Link Here
12
            if ( current_qty < max_qty - 1 )
13
            if ( current_qty < max_qty - 1 )
13
                cloneItemBlock(index, unique_item_fields);
14
                cloneItemBlock(index, unique_item_fields);
14
            addItemInList(index, unique_item_fields);
15
            addItemInList(index, unique_item_fields);
15
            $("#" + index).find("input[name='buttonPlus']").val( (window.MSG_ADDITEM_JS_UPDATEITEM ) );
16
            $("#" + index).find("input[name='buttonPlus']").val( __("Update item") );
16
            $("#"+ index).find("input[name='buttonPlusMulti']").remove();
17
            $("#"+ index).find("input[name='buttonPlusMulti']").remove();
17
            $("#" + index).find("input[name='multiValue']").remove();
18
            $("#" + index).find("input[name='multiValue']").remove();
18
            $("#quantity").val(current_qty + 1).change();
19
            $("#quantity").val(current_qty + 1).change();
19
        } else if ( current_qty >= max_qty ) {
20
        } else if ( current_qty >= max_qty ) {
20
            alert(window.MSG_ADDITEM_JS_CANT_RECEIVE_MORE_ITEMS
21
            alert( __("You can't receive any more items") );
21
                || "You can't receive any more items.");
22
        }
22
        }
23
    } else {
23
    } else {
24
        if ( current_qty < max_qty )
24
        if ( current_qty < max_qty )
Lines 46-52 function addMulti( count, node, unique_item_fields){ Link Here
46
                        $("#procModal").modal('hide');
46
                        $("#procModal").modal('hide');
47
                    }
47
                    }
48
            });
48
            });
49
            $("#" + cloneIndex).find("input[name='buttonPlus']").val( (window.MSG_ADDITEM_JS_UPDATEITEM ) );
49
            $("#" + cloneIndex).find("input[name='buttonPlus']").val( ( __("Update item") ) );
50
            $("#" + cloneIndex).find("input[name='buttonPlusMulti']").remove();
50
            $("#" + cloneIndex).find("input[name='buttonPlusMulti']").remove();
51
            $("#" + cloneIndex).find("input[name='multiValue']").remove();
51
            $("#" + cloneIndex).find("input[name='multiValue']").remove();
52
            $("#" + cloneIndex).hide();
52
            $("#" + cloneIndex).hide();
Lines 88-97 function constructTrNode(index, unique_item_fields) { Link Here
88
88
89
    var result = "<tr idblock='" + index + "'>";
89
    var result = "<tr idblock='" + index + "'>";
90
    var edit_link = "<a href='#itemfieldset' style='text-decoration:none' onclick='showItem(\"" + index + "\");' class='btn btn-default btn-xs'><i class='fa fa-pencil'></i> "
90
    var edit_link = "<a href='#itemfieldset' style='text-decoration:none' onclick='showItem(\"" + index + "\");' class='btn btn-default btn-xs'><i class='fa fa-pencil'></i> "
91
        + (window.MSG_ADDITEM_JS_EDIT || "Edit") + "</a>";
91
        + ( __("Edit") ) + "</a>";
92
    var del_link = "<a style='cursor:pointer' "
92
    var del_link = "<a style='cursor:pointer' "
93
        + "onclick='deleteItemBlock(this, \"" + index + "\", \"" + unique_item_fields + "\");' class='btn btn-default btn-xs'><i class='fa fa-trash'></i> "
93
        + "onclick='deleteItemBlock(this, \"" + index + "\", \"" + unique_item_fields + "\");' class='btn btn-default btn-xs'><i class='fa fa-trash'></i> "
94
        + (window.MSG_ADDITEM_JS_DELETE || "Delete") + "</a>";
94
        + ( __("Delete") ) + "</a>";
95
    result += "<td class='actions'>" + edit_link + " " + del_link + "</td>";
95
    result += "<td class='actions'>" + edit_link + " " + del_link + "</td>";
96
    for(i in fields) {
96
    for(i in fields) {
97
        var field = fields[i];
97
        var field = fields[i];
Lines 178-190 function cloneItemBlock(index, unique_item_fields, callback) { Link Here
178
            });
178
            });
179
            /* Add buttons + and Clear */
179
            /* Add buttons + and Clear */
180
            var buttonPlus = "<fieldset class=\"action\">";
180
            var buttonPlus = "<fieldset class=\"action\">";
181
                buttonPlus += '<input type="button" class="addItemControl" name="buttonPlus" style="cursor:pointer; margin:0 1em;" onclick="addItem(this,\'' + unique_item_fields + '\')" value="' + (window.MSG_ADDITEM_JS_ADDITEM || 'Add item')+ '" />';
181
                buttonPlus += '<input type="button" class="addItemControl" name="buttonPlus" style="cursor:pointer; margin:0 1em;" onclick="addItem(this,\'' + unique_item_fields + '\')" value="' + ( __("Add item") )+ '" />';
182
                buttonPlus += '<input type="button" class="addItemControl cancel" name="buttonClear" style="cursor:pointer;" onclick="clearItemBlock(this)" value="' + (window.MSG_ADDITEM_JS_CLEAR || 'Clear')+ '" />';
182
                buttonPlus += '<input type="button" class="addItemControl cancel" name="buttonClear" style="cursor:pointer;" onclick="clearItemBlock(this)" value="' + __("Clear") + '" />';
183
                buttonPlus += '<input type="button" class="addItemControl" name="buttonPlusMulti" onclick="javascript:this.nextSibling.style.display=\'inline\'; return false;" style="cursor:pointer; margin:0 1em;" value="' + (window.MSG_ADDITEM_JS_ADDMULTI || 'Add multiple items')+ '" />';
183
                buttonPlus += '<input type="button" class="addItemControl" name="buttonPlusMulti" onclick="javascript:this.nextSibling.style.display=\'inline\'; return false;" style="cursor:pointer; margin:0 1em;" value="' + __("Add multiple items") + '" />';
184
                buttonPlus += '<span id="add_multiple_copies" style="display:none">'
184
                buttonPlus += '<span id="add_multiple_copies" style="display:none">'
185
                            +     '<input type="number" class="addItemControl" id="multiValue" name="multiValue" placeholder="'+window.MSG_ADDITEM_JS_MULTIVAL+'" />'
185
                            +     '<input type="number" class="addItemControl" id="multiValue" name="multiValue" placeholder="' + __("Number of items to add") + '" />'
186
                            +     '<input type="button" class="addItemControl" name=buttonAddMulti" style="cursor:pointer; margin:0 1em;" onclick="checkCount( this ,\'' + unique_item_fields + '\')" value="' + (window.MSG_ADDITEM_JS_SUBMITMULTI || 'Add') + '" />'
186
                            +     '<input type="button" class="addItemControl" name=buttonAddMulti" style="cursor:pointer; margin:0 1em;" onclick="checkCount( this ,\'' + unique_item_fields + '\')" value="' + __("Add") + '" />'
187
                            +     '<div class="dialog message">' + window.MSG_ADDITEM_JS_MULTI_UNIQUE_NOTE + '</div>'
187
                            +     '<div class="dialog message">' + __("NOTE: Fields listed in the 'UniqueItemsFields' system preference will not be copied") + '</div>'
188
                            + '</span>';
188
                            + '</span>';
189
                buttonPlus += "</fieldset>";
189
                buttonPlus += "</fieldset>";
190
            $(clone).append(buttonPlus);
190
            $(clone).append(buttonPlus);
Lines 271-277 function check_additem(unique_item_fields) { Link Here
271
            if (sorted_arr[i + 1] == sorted_arr[i]) {
271
            if (sorted_arr[i + 1] == sorted_arr[i]) {
272
                $(".order_error").append(
272
                $(".order_error").append(
273
                    fieldname + " '" + sorted_arr[i] + "' "
273
                    fieldname + " '" + sorted_arr[i] + "' "
274
                    + (window.MSG_ADDITEM_JS_IS_DUPLICATE || "is duplicated")
274
                    + __("is duplicated")
275
                    + "<br/>");
275
                    + "<br/>");
276
                success = false;
276
                success = false;
277
            }
277
            }
Lines 296-303 function check_additem(unique_item_fields) { Link Here
296
                    var value = data[field][i];
296
                    var value = data[field][i];
297
                    $(".order_error").append(
297
                    $(".order_error").append(
298
                        field + " '" + value + "' "
298
                        field + " '" + value + "' "
299
                        + (window.MSG_ADDITEM_JS_ALREADY_EXISTS_IN_DB
299
                        + __("already exists in database")
300
                            || "already exists in database")
301
                        + "<br />"
300
                        + "<br />"
302
                    );
301
                    );
303
                }
302
                }
304
- 

Return to bug 25317