strip spaces from barcodes for new items and re-barcoded items
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 13 Feb 2007 04:44:42 +0000 (04:44 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 13 Feb 2007 04:44:42 +0000 (04:44 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6937 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/cat/util.js
Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js

index 933b14f..bceb1ed 100644 (file)
@@ -27,6 +27,7 @@ cat.util.replace_barcode = function(old_bc) {
                if (!copy) throw(copy);
 
                var new_bc = window.prompt('Enter the replacement barcode for the copy with barcode ' + old_bc + ':','','Replace Barcode');
+               new_bc = String( new_bc ).replace(/\s/g,'');
                if (!new_bc) {
                        alert('Rename aborted.  Blank for barcode not allowed.');
                        return old_bc;
index 64c1707..3118216 100644 (file)
@@ -289,7 +289,8 @@ g.render_barcode_entry = function(node,callnumber,count,ou_id) {
                        );
                        //tb.addEventListener('change',ready_to_create,false);
                        tb.addEventListener('change', function(ev) {
-                               var barcode = ev.target.value;
+                               var barcode = String( ev.target.value ).replace(/\s/g,'');
+                               if (barcode != ev.target.value) ev.target.value = barcode;
                                if ($('check_barcodes').checked && ! util.barcode.check(barcode) ) {
                                        g.error.yns_alert( '"' + barcode + '" is an invalid barcode.','Invalid Barcode','OK',null,null,'Check here to confirm this message.');
                                        setTimeout( function() { ev.target.select(); ev.target.focus(); }, 0);