When coming from staff client patron interface,
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Mon, 11 Jul 2011 22:17:13 +0000 (18:17 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Mon, 11 Jul 2011 22:17:13 +0000 (18:17 -0400)
pre-populate the patron barcode text box by which staff places a hold
for a patron.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/web/js/ui/default/opac/staff.js
Open-ILS/web/templates/default/opac/parts/place_hold.tt2

index 533258c..b5ef7f5 100644 (file)
@@ -14,13 +14,28 @@ function runEvt(scope, name) {
         for(var i in evt) {evt[i].apply(evt[i], args);}
     } 
 }
-function staff_hold_nicety(thing) {
+function staff_hold_usr_input_disabler(input) {
     document.getElementById("hold_usr_input").disabled =
-        Boolean(Number(thing.value));
+        Boolean(Number(input.value));
+}
+function staff_hold_usr_prepop() {
+    if (xulG && xulG.patron_barcode) {
+        document.getElementById("hold_usr_input").value = xulG.patron_barcode;
+        document.getElementById("hold_usr_input").disabled = false;
+        document.getElementById("hold_usr_is_requestor_not").checked = true;
+
+        var kill_this =
+            document.getElementById("hold_usr_is_requestor").parentNode;
+        kill_this.parentNode.removeChild(kill_this);
+    }
 }
 window.onload = function() {
     // record details page events
     var rec = location.href.match(/\/opac\/record\/(\d+)/);
     if(rec && rec[1]) { runEvt('rdetail', 'recordRetrieved', rec[1]); }
+
+    if (document.getElementById("hold_usr_input"))
+        staff_hold_usr_prepop();
+
     // fire other events the staff client is expecting...
 }
index 3e37244..9e90c7a 100644 (file)
             [% IF ctx.is_staff %]
             <p class="staff-hold">
                 <input type="radio" id="hold_usr_is_requestor_not"
-                    onchange="staff_hold_nicety(this);"
+                    onchange="staff_hold_usr_input_disabler(this);"
                     name="hold_usr_is_requestor" value="0" />
                 <label for="hold_usr_is_requestor_not">
                     [% l("Place hold for patron by barcode:") %]
                 </label>
                 <input type="text" name="hold_usr" id="hold_usr_input" /><br />
-
-                <input type="radio" id="hold_usr_is_requestor"
-                    onchange="staff_hold_nicety(this);"
-                    name="hold_usr_is_requestor" value="1" />
-                <label for="hold_usr_is_requestor">
-                    [% l("Place this hold for me ([_1] [_2])",
-                    ctx.user.first_given_name, ctx.user.family_name) %]
-                </label>
+                <span>
+                    <input type="radio" id="hold_usr_is_requestor"
+                        onchange="staff_hold_usr_input_disabler(this);"
+                        name="hold_usr_is_requestor" value="1" />
+                    <label for="hold_usr_is_requestor">
+                        [% l("Place this hold for me ([_1] [_2])",
+                        ctx.user.first_given_name, ctx.user.family_name) %]
+                    </label>
+                </span>
             </p>
             [% END %]
             <p>