Casting a null into a String results in a string with a value of "null"; change test...
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 18 Mar 2009 21:41:06 +0000 (21:41 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 18 Mar 2009 21:41:06 +0000 (21:41 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12586 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/main/menu.js
Open-ILS/xul/staff_client/server/cat/util.js

index 304efc7..217569e 100644 (file)
@@ -160,7 +160,8 @@ main.menu.prototype = {
        
                                                var new_bc = window.prompt(offlineStrings.getString('menu.cmd_replace_barcode.replacement.prompt'),'',offlineStrings.getString('menu.cmd_replace_barcode.replacement.label'));
                                                new_bc = String( new_bc ).replace(/\s/g,'');
-                                               if (!new_bc) {
+                                               /* Casting a possibly null input value to a String turns it into "null" */
+                                               if (!new_bc || new_bc == 'null') {
                                                        alert(offlineStrings.getString('menu.cmd_replace_barcode.blank.error'));
                                                        return;
                                                }
index 70e4ced..6fbb48c 100644 (file)
@@ -50,7 +50,8 @@ cat.util.replace_barcode = function(old_bc) {
                        '',
                        $("catStrings").getString('staff.cat.util.replace_barcode.new_bc_window_prompt.title'));
                new_bc = String( new_bc ).replace(/\s/g,'');
-               if (!new_bc) {
+               /* Casting a possibly null input value to a String turns it into "null" */
+               if (!new_bc || new_bc == 'null') {
                        alert($("catStrings").getString('staff.cat.util.replace_barcode.new_bc.failed'));
                        return old_bc;
                }