LP#1284864 propagate patron barcode to advanced hold options (repair) user/berick/lp1284864-tpac-mr-formats-repairs-and-usability
authorBill Erickson <berick@esilibrary.com>
Tue, 4 Mar 2014 20:17:21 +0000 (15:17 -0500)
committerBill Erickson <berick@esilibrary.com>
Tue, 4 Mar 2014 20:19:23 +0000 (15:19 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/opac/parts/place_hold.tt2
Open-ILS/web/js/ui/default/opac/staff.js

index effc45b..1a497f7 100644 (file)
@@ -27,7 +27,7 @@
                 [% l("Place hold for patron by barcode:") %]
             </label>
             <input type="text" name="hold_usr" id="hold_usr_input" 
-              value="[% CGI.param('staff_barcode') | html %]"
+              value="[% CGI.param('usr_barcode') | html %]"
               onchange="staff_hold_usr_barcode_changed();" 
               onpaste="setTimeout(staff_hold_usr_barcode_changed,1);" 
               onkeypress="return no_hold_submit(event)" autofocus /> 
@@ -36,7 +36,7 @@
               [% l('Patron barcode was not found') %]
             </span><br />
             <input type="hidden" id="staff_barcode" 
-              value="[% CGI.param('staff_barcode') || ctx.staff_recipient.card.barcode | html %]"/>
+              value="[% ctx.staff_recipient.card.barcode | html %]"/>
             <span>
                 <input type="radio" id="hold_usr_is_requestor"
                     onchange="staff_hold_usr_input_disabler(this);"
index 8dd97fb..8bae62f 100644 (file)
@@ -39,8 +39,11 @@ function staff_hold_usr_barcode_changed(isload) {
         var barcode = isload;
         if(!barcode || barcode === true) barcode = document.getElementById('staff_barcode').value;
         var only_settings = true;
+        var bc_from_cgi = false; // user_barcode passed via cgi
         if(!document.getElementById('hold_usr_is_requestor').checked) {
-            if(!isload) {
+            if (isload && document.getElementById('hold_usr_input').value)
+                bc_from_cgi = true;
+            if(!isload || bc_from_cgi) {
                 barcode = document.getElementById('hold_usr_input').value;
                 only_settings = false;
             }
@@ -108,13 +111,13 @@ function staff_hold_usr_barcode_changed(isload) {
         var adv_link = document.getElementById('advanced_hold_link');
         if (adv_link) { // not present on MR hold pages
             var href = adv_link.getAttribute('href').replace(
-                /;staff_barcode=[^;\&]+|$/, 
-                ';staff_barcode=' + encodeURIComponent(cur_hold_barcode));
+                /;usr_barcode=[^;\&]+|$/, 
+                ';usr_barcode=' + encodeURIComponent(cur_hold_barcode));
             adv_link.setAttribute('href', href);
         }
 
-        // Ok, now we can allow submitting again, unless this is a "true" load, in which case we likely have a blank barcode box active
-        if (isload !== true)
+        // if we're here, we have a valid barcode.  activate the sumbmit option
+        if(!isload || bc_from_cgi) 
             document.getElementById('place_hold_submit').disabled = false;
     }
 }