Preset correct default pickup lib for staff placing holds for patrons
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 13 Jul 2011 16:24:38 +0000 (12:24 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 13 Jul 2011 16:24:38 +0000 (12:24 -0400)
Also, for hold placement, only enable org unit selection where
can_have_vols is true.

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/org_selector.tt2
Open-ILS/web/templates/default/opac/parts/place_hold.tt2
Open-ILS/xul/staff_client/server/patron/holds.js

index b5ef7f5..16234b5 100644 (file)
@@ -20,6 +20,13 @@ function staff_hold_usr_input_disabler(input) {
 }
 function staff_hold_usr_prepop() {
     if (xulG && xulG.patron_barcode) {
+        var sel = document.getElementById("pickup_lib");
+        for (var i = 0; i < sel.options.length; i++) {
+            if (sel.options[i].value == xulG.patron_home_ou) {
+                sel.selectedIndex = i;
+                break;
+            }
+        }
         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;
index 2daf63a..d8d3fc7 100644 (file)
@@ -1,6 +1,13 @@
 [%
-    BLOCK build_org_selector_options; %]
-        <option value='[% walker.id %]' [% IF walker.id == value %] selected='selected' [% END %]>
+    BLOCK build_org_selector_options;
+        disabled = '';
+        IF can_have_vols_only;
+            UNLESS walker.ou_type.can_have_vols == 't';
+                disabled = 'disabled="disabled"';
+            END;
+        END;
+%]
+        <option value='[% walker.id %]' [% IF walker.id == value %] selected='selected' [% END %][% disabled %]>
             [%
                 pad = walker.ou_type.depth * 2;
                 FOR idx IN [0..pad]; '&nbsp;'; END;
index 9e90c7a..69c469a 100644 (file)
             [% END %]
             <p>
                 [% | l(attrs.title, ctx.get_aou(ctx.default_pickup_lib).name) %]
-                You would like to place a hold on <strong><q>[_1]</q></strong> to be picked up at [_2].
-                If this is correct, press <strong>SUBMIT</strong>.
+                You would like to place a hold on <strong><q>[_1]</q></strong>.<br />
+                If this is correct, confirm your pickup location and click <strong>SUBMIT</strong>.
                 [% END %]
             </p>
             <p>
-                [% l('If you would like to change the library pick up location, select from the location dropdown menu.') %]
-                <br class="clear-both" />
+                [% l('Pickup location:') %]
                 [% PROCESS "default/opac/parts/org_selector.tt2";
-                    PROCESS build_org_selector name='pickup_lib' value=ctx.default_pickup_lib %]
+                    PROCESS build_org_selector name='pickup_lib' value=ctx.default_pickup_lib id='pickup_lib' can_have_vols_only=1 %]
             </p>
             <p>
                 [% |l %]If you use the Traveling Library Center (TLC) and ABC Express
index 234b2b6..5dd912a 100644 (file)
@@ -1341,7 +1341,8 @@ patron.holds.prototype = {
                                                 obj.error.standard_unexpected_error_alert('holds.js, opac_hold_placed(): ',E);
                                             }
                                         },
-                                        'patron_barcode' : obj.patron_barcode
+                                        'patron_barcode' : obj.patron_barcode,
+                                        'patron_home_ou': patron.util.retrieve_au_via_id(ses(),obj.patron_id).home_ou()
                                     },
                                     'url_prefix' : xulG.url_prefix,
                                     'url' : xulG.url_prefix( urls.browser )