checkdigit for copy creation
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Aug 2006 06:34:53 +0000 (06:34 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 4 Aug 2006 06:34:53 +0000 (06:34 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5283 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index d1e4b06..a3480e2 100644 (file)
@@ -258,6 +258,8 @@ g.render_barcode_entry = function(node,callnumber,count,ou_id) {
                        document.getElementById("Create").disabled = false;
                }
 
+               JSAN.use('util.barcode'); 
+
                for (var i = 0; i < count; i++) {
                        var tb = document.createElement('textbox'); node.appendChild(tb);
                        tb.setAttribute('ou_id',ou_id);
@@ -267,7 +269,14 @@ g.render_barcode_entry = function(node,callnumber,count,ou_id) {
                                tb, 
                                function() { ready_to_create({'target':tb}); setTimeout(function(){util.widgets.vertical_tab(tb);},0); }
                        );
-                       tb.addEventListener('change',ready_to_create,false);
+                       //tb.addEventListener('change',ready_to_create,false);
+                       tb.addEventListener('change', function(ev) {
+                               var barcode = ev.target.value;
+                               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);
+                               }
+                       }, false);
                        tb.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false );
                }
        } catch(E) {
index c820fda..bab5a48 100644 (file)
@@ -39,7 +39,8 @@
                <hbox style="border-bottom: solid black thin">
                        <hbox id="marc_cn"/>
                        <spacer flex="1" />
-                       <checkbox id="print_labels" label="Print Labels" persist="checked" accesskey="P"/>
+                       <checkbox id="check_barcodes" label="Check Barcodes?" persist="checked" accesskey="B"/>
+                       <checkbox id="print_labels" label="Print Labels?" persist="checked" accesskey="P"/>
                        <button id="Create" accesskey="C" label="Edit then Create" disabled="true" oncommand="g.stash_and_close();"/>
                </hbox>
                <grid flex="1">