From: dbs Date: Wed, 18 Mar 2009 21:41:06 +0000 (+0000) Subject: Casting a null into a String results in a string with a value of "null"; change test... X-Git-Tag: sprint4-merge-nov22~10470 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=eca5373156b44f71426e4af8ffaaed4a75b12dfb;p=working%2FEvergreen.git Casting a null into a String results in a string with a value of "null"; change test accordingly git-svn-id: svn://svn.open-ils.org/ILS/trunk@12586 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index 304efc7bf0..217569eade 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -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; } diff --git a/Open-ILS/xul/staff_client/server/cat/util.js b/Open-ILS/xul/staff_client/server/cat/util.js index 70e4cedc73..6fbb48c384 100644 --- a/Open-ILS/xul/staff_client/server/cat/util.js +++ b/Open-ILS/xul/staff_client/server/cat/util.js @@ -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; }