From 99b6a4173311a50144edb7518510ec8128f7dbf2 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 29 Jan 2016 19:25:16 +0000 Subject: [PATCH] Bug 14752 - increment barcodes when adding multiples if present and uniqueness enforced To test: 1 - Enter a barcode value that ends in a number 2 - Attempt to add multiple items 3 - Items should eb added with increasing barcodes 4 - Enter a barcode not ending in a number 5 - Attempt to add multiple items 6 - You should get an error modal --- koha-tmpl/intranet-tmpl/prog/en/js/additem.js | 44 +++++++++++++++++++--- .../prog/en/modules/acqui/neworderempty.tt | 10 ++++- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js index c77a089..490f1fc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js @@ -35,9 +35,23 @@ function addMulti( count, node, unique_item_fields){ var current_qty = parseInt( $('#quantity').val(), 10 ); $("#procModal").modal('show'); $("#" + index).hide(); + var cur_barc = $("#"+index + " #subfieldp input[name='field_value']").val() + if ( cur_barc != '' && unique_item_fields.indexOf('barcode')>-1 ){ + tmp_uif = unique_item_fields.replace("barcode",''); + unique_item_fields=tmp_uif; + } + else { cur_barc=''} + for(var i=0;i-1 ){ + if ( incrementBarcode(barcode) != undefined ) { + addMulti( count, node, unique_item_fields); + } + else { $("#incrementBarcodeModal").modal('show');} + } + else { addMulti( count, node, unique_item_fields); } } } @@ -72,7 +106,7 @@ function showItem(index) { $(this).show(); } else { if ( $("#items_list table").find('tr[idblock="' + $(this).attr('id') + '"]').length == 0 ) { - $(this).remove(); + $(this).remove(); } else { $(this).hide(); } @@ -180,7 +214,7 @@ function cloneItemBlock(index, unique_item_fields, callback) { buttonPlus += ''; buttonPlus += ''; buttonPlus += ''; - buttonPlus +=''; + buttonPlus +=''; buttonPlus += ""; $(clone).append(buttonPlus); /* Copy values from the original block (input) */ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index c993e1c..0b63827 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -651,7 +651,8 @@ $(document).ready(function() [% IF UniqueItemFields %]