Suggest parts selection on failed parts-capable hold
authorBill Erickson <berick@esilibrary.com>
Tue, 28 Jun 2011 18:51:43 +0000 (14:51 -0400)
committerJason Etheridge <jason@esilibrary.com>
Thu, 7 Jul 2011 19:37:05 +0000 (15:37 -0400)
When a title has copy parts and the user does not select a specific part
for the hold, treat it as a regular title hold.  If the title hold
fails, suggest to the user that he/she should select a specific part,
since that opens the door to a new set of potentially capturable copies,
which allow the hold to be successfully placed.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Open-ILS/web/opac/locale/en-US/opac.dtd
Open-ILS/web/opac/skin/default/js/holds.js
Open-ILS/web/opac/skin/default/xml/common/holds.xml

index 8203ce4..bdaf91c 100644 (file)
@@ -450,6 +450,7 @@ Please see a librarian to renew your account.">
 <!ENTITY opac.holds.pickupLocation "Pickup location">
 <!ENTITY opac.holds.success "Hold was successfully placed">
 <!ENTITY opac.holds.failure "Hold was not successfully placed">
+<!ENTITY opac.hold.has_parts "The system was not able to place the requested hold.  The item requested has multiple parts to choose from.  Try selecting a specific part for the hold.">
 <!--   ================================================================= 
        Advanced
        ================================================================= -->
index 73514c1..9b09f68 100644 (file)
@@ -109,6 +109,9 @@ function holdsDrawEditor(args) {
        if(holdArgs.editHold) // flesh the args with the existing hold 
                holdArgsFromHold(holdArgs.editHold, holdArgs);
 
+    $('holds_parts_selector').style.border = 'auto';
+    holdArgs.partsSuggestionMade = false;
+
        holdsDrawWindow();
 }
 
@@ -998,7 +1001,17 @@ function holdHandleCreateResponse(r, recurse) {
                var res = r.getResultObject();
                if(checkILSEvent(res) || res.success != 1) {
                        if(res.success != 1) {
-                               alert($('hold_not_allowed').innerHTML);
+
+                if(!holdArgs.partsSuggestionMade && holdArgs.recordParts && 
+                        holdArgs.recordParts.length && holdArgs.type == 'T') {
+                    // T holds on records that have parts are OK, but if the record has no non-part
+                    // copies, the hold will ultimately fail.  Suggest selecting a part to the user.
+                    $('holds_parts_selector').style.border = '2px solid red';
+                    holdArgs.partsSuggestionMade = true;
+                    alert($('hold_has_parts').innerHTML);
+                } else {
+                                   alert($('hold_not_allowed').innerHTML);
+                }
                        } else {
                                if( res.textcode == 'PATRON_BARRED' ) {
                                        alertId('hold_failed_patron_barred');
index 7d8712d..4930ab7 100644 (file)
                <span class='hide_me' id='hold_not_allowed'>
                        &common.hold.failed;
                </span>
+        <span class='hide_me' id='hold_has_parts'>&opac.hold.has_parts;</span>
 
        </div>