[open-ils-commits] [GIT] Evergreen ILS branch master updated. a663dfed41126ba4607e500ccda85dd9fa113789

Evergreen Git git at git.evergreen-ils.org
Thu Jan 12 09:07:51 EST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  a663dfed41126ba4607e500ccda85dd9fa113789 (commit)
      from  fd03cfede3aa8ae62b7f24f9550ca70040ac6004 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a663dfed41126ba4607e500ccda85dd9fa113789
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Tue Sep 20 10:27:51 2011 -0400

    Allow choice of placing hold despite age protect
    
    This alters the backend to watch when so much as one copy failed only due
    to age protection. If so, a flag is set and returned back up the calling
    tree for examination.
    
    In JSPac when the flag is set an alternate confirm message is shown.
    
    In TTPac when the flag is set the failure message is changed and override
    is always allowed for the hold in question.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
index d083747..fe1b930 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
@@ -2256,9 +2256,9 @@ sub check_title_hold {
         };
     } elsif ($status[2]) {
         my $n = scalar @{$status[2]};
-        return {"success" => 0, "last_event" => $status[2]->[$n - 1]};
+        return {"success" => 0, "last_event" => $status[2]->[$n - 1], "age_protected_copy" => $status[3]};
     } else {
-        return {"success" => 0};
+        return {"success" => 0, "age_protected_copy" => $status[3]};
     }
 }
 
@@ -2473,6 +2473,7 @@ sub _check_title_hold_is_possible {
     my $title;
     my %seen;
     my @status;
+    my $age_protect_only = 0;
     OUTER: for my $key (@keys) {
       my @cps = @{$buckets{$key}};
 
@@ -2494,10 +2495,12 @@ sub _check_title_hold_is_possible {
          @status = verify_copy_for_hold(
             $patron, $requestor, $title, $copy, $pickup_lib, $request_lib);
 
+         $age_protect_only ||= $status[3];
          last OUTER if $status[0];
       }
     }
 
+    $status[3] = $age_protect_only;
     return @status;
 }
 
@@ -2599,6 +2602,7 @@ sub _check_issuance_hold_is_possible {
     my $title;
     my %seen;
     my @status;
+    my $age_protect_only = 0;
     OUTER: for my $key (@keys) {
       my @cps = @{$buckets{$key}};
 
@@ -2620,6 +2624,7 @@ sub _check_issuance_hold_is_possible {
          @status = verify_copy_for_hold(
             $patron, $requestor, $title, $copy, $pickup_lib, $request_lib);
 
+         $age_protect_only ||= $status[3];
          last OUTER if $status[0];
       }
     }
@@ -2632,6 +2637,7 @@ sub _check_issuance_hold_is_possible {
 
         return (1,0) if ($empty_ok);
     }
+    $status[3] = $age_protect_only;
     return @status;
 }
 
@@ -2733,6 +2739,7 @@ sub _check_monopart_hold_is_possible {
     my $title;
     my %seen;
     my @status;
+    my $age_protect_only = 0;
     OUTER: for my $key (@keys) {
       my @cps = @{$buckets{$key}};
 
@@ -2754,6 +2761,7 @@ sub _check_monopart_hold_is_possible {
          @status = verify_copy_for_hold(
             $patron, $requestor, $title, $copy, $pickup_lib, $request_lib);
 
+         $age_protect_only ||= $status[3];
          last OUTER if $status[0];
       }
     }
@@ -2766,6 +2774,7 @@ sub _check_monopart_hold_is_possible {
 
         return (1,0) if ($empty_ok);
     }
+    $status[3] = $age_protect_only;
     return @status;
 }
 
@@ -2794,11 +2803,14 @@ sub _check_volume_hold_is_possible {
     ) unless @$copies;
 
     my @status;
+    my $age_protect_only = 0;
 	for my $copy ( @$copies ) {
         @status = verify_copy_for_hold(
 			$patron, $requestor, $title, $copy, $pickup_lib, $request_lib );
+        $age_protect_only ||= $status[3];
         last if $status[0];
 	}
+    $status[3] = $age_protect_only;
 	return @status;
 }
 
@@ -2819,6 +2831,10 @@ sub verify_copy_for_hold {
             show_event_list     => 1
 		} 
 	);
+    my $age_protect_only = 0;
+    if (@$permitted == 1 && @$permitted[0]->{textcode} eq 'ITEM_AGE_PROTECTED') {
+        $age_protect_only = 1;
+    }
 
     return (
         (not scalar @$permitted), # true if permitted is an empty arrayref
@@ -2827,7 +2843,8 @@ sub verify_copy_for_hold {
 	        ($copy->circ_lib == $pickup_lib) and 
             ($copy->status == OILS_COPY_STATUS_AVAILABLE)
         ),
-        $permitted
+        $permitted,
+        $age_protect_only
     );
 }
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
index 5c95809..7f00cb6 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
@@ -892,7 +892,12 @@ sub attempt_hold_placement {
                         $hdata->{hold_failed_event} = pop @$result;
                     }
 
-                    $hdata->{could_override} = $self->test_could_override($hdata->{hold_failed_event});
+                    if($result->{age_protected_copy}) {
+                        $hdata->{could_override} = 1;
+                        $hdata->{age_protect} = 1;
+                    } else {
+                        $hdata->{could_override} = $self->test_could_override($hdata->{hold_failed_event});
+                    }
                 }
             }
         }
diff --git a/Open-ILS/src/templates/opac/parts/place_hold_result.tt2 b/Open-ILS/src/templates/opac/parts/place_hold_result.tt2
index 87e2d40..6504906 100644
--- a/Open-ILS/src/templates/opac/parts/place_hold_result.tt2
+++ b/Open-ILS/src/templates/opac/parts/place_hold_result.tt2
@@ -68,14 +68,16 @@
                                                 event_key = hdata.hold_failed_event.textcode;
 
                                                 # display:
-                                                FAIL_PART_MSG_MAP.$fail_part_key ||
-                                                EVENT_MSG_MAP.$event_key ||
-                                                l(hdata.hold_failed_event.desc) ||
-                                                hdata.hold_failed_event.payload.fail_part ||
-                                                hdata.hold_failed_event.textcode ||
-                                                (hdata.hold_local_alert ?
-                                                    l("There is already a copy available at your local library.") :
-                                                    l("Unknown problem")) | html
+                                                (hdata.age_protect ?
+                                                    l("All available copies are temporarily unavailable at your pickup library. Placing this hold could result in longer wait times.") :
+                                                    FAIL_PART_MSG_MAP.$fail_part_key ||
+                                                    EVENT_MSG_MAP.$event_key ||
+                                                    l(hdata.hold_failed_event.desc) ||
+                                                    hdata.hold_failed_event.payload.fail_part ||
+                                                    hdata.hold_failed_event.textcode ||
+                                                    (hdata.hold_local_alert ?
+                                                        l("There is already a copy available at your local library.") :
+                                                        l("Unknown problem"))) | html
                                             %]</em>
                                             [% IF event_key == 'PERM_FAILURE' %]
                                             <div>[% l('Permission: "[_1]"', hdata.hold_failed_event.ilsperm) | html %]</div>
diff --git a/Open-ILS/web/opac/locale/en-US/opac.dtd b/Open-ILS/web/opac/locale/en-US/opac.dtd
index 545085a..7bcf044 100644
--- a/Open-ILS/web/opac/locale/en-US/opac.dtd
+++ b/Open-ILS/web/opac/locale/en-US/opac.dtd
@@ -619,6 +619,7 @@ We recommend that you remove this title from any bookbags it may have been added
 <!ENTITY common.hold.checked_out.override "This item is already checked out.  Would you like to place the hold anyway?">
 <!ENTITY common.hold.exists "A hold already exists on the requested item.">
 <!ENTITY common.hold.exists.override "A hold already exists on the requested item. Would you like to create the hold anyway?">
+<!ENTITY common.hold.age_protect.override "This hold may take extra time to fill due to library policies. Would you like to create the hold anyway?">
 <!ENTITY common.hold.barred 'PATRON BARRED. Please see any notes in the
 "Staff Notes" section of your "My Account" page or contact your local library.'>
 <!ENTITY common.hold.item.invalid "This hold is no longer valid. It's likely that the
diff --git a/Open-ILS/web/opac/skin/default/js/holds.js b/Open-ILS/web/opac/skin/default/js/holds.js
index 4c85368..df7bef4 100644
--- a/Open-ILS/web/opac/skin/default/js/holds.js
+++ b/Open-ILS/web/opac/skin/default/js/holds.js
@@ -1022,28 +1022,40 @@ function holdHandleCreateResponse(r, recurse) {
 
 	if(!recurse) {
 		var res = r.getResultObject();
+        var age_protect_override = false;;
 		if(checkILSEvent(res) || res.success != 1) {
-			if(res.success != 1) {
-
-                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.
-                    addCSSClass($('holds_parts_selector'), 'parts-warning');
-                    holdArgs.partsSuggestionMade = true;
-                    alert($('hold_has_parts').innerHTML);
+            if(res.success != 1 && res.age_protected_copy == 1) {
+                // There is at least one copy that *could* fill the hold, if it were not age-protected.
+                if( confirm($('hold_age_protected_override').innerHTML) ) {
+                    age_protect_override = true;
                 } else {
-				    alert($('hold_not_allowed').innerHTML);
+    		    	swapCanvas($('holds_box'));
+	    		    return;
                 }
-			} else {
-				if( res.textcode == 'PATRON_BARRED' ) {
-					alertId('hold_failed_patron_barred');
-			} else {
-					alert($('hold_not_allowed').innerHTML);
-				}
-			}
-			swapCanvas($('holds_box'));
-			return;
+            }
+            if(!age_protect_override) {
+    			if(res.success != 1) {
+
+                    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.
+                        addCSSClass($('holds_parts_selector'), 'parts-warning');
+                        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');
+			    } else {
+				    	alert($('hold_not_allowed').innerHTML);
+    				}
+	    		}
+		    	swapCanvas($('holds_box'));
+			    return;
+            }
 		}
         r._hold.selection_depth(res.depth);
 	}	
diff --git a/Open-ILS/web/opac/skin/default/xml/common/holds.xml b/Open-ILS/web/opac/skin/default/xml/common/holds.xml
index 4930ab7..3b091b6 100644
--- a/Open-ILS/web/opac/skin/default/xml/common/holds.xml
+++ b/Open-ILS/web/opac/skin/default/xml/common/holds.xml
@@ -241,6 +241,7 @@
 
 	<span class='hide_me' id='hold_dup_exists_override'>&common.hold.exists.override;</span>
 	<span class='hide_me' id='hold_checked_out_override'>&common.hold.checked_out.override;</span>
+	<span class='hide_me' id='hold_age_protected_override'>&common.hold.age_protect.override;</span>
 
 	<span id='hold_failed_patron_barred' class='hide_me'>&common.hold.barred;</span>
 

-----------------------------------------------------------------------

Summary of changes:
 .../perlmods/lib/OpenILS/Application/Circ/Holds.pm |   23 ++++++++-
 .../lib/OpenILS/WWW/EGCatLoader/Account.pm         |    7 ++-
 .../src/templates/opac/parts/place_hold_result.tt2 |   18 ++++---
 Open-ILS/web/opac/locale/en-US/opac.dtd            |    1 +
 Open-ILS/web/opac/skin/default/js/holds.js         |   50 ++++++++++++-------
 .../web/opac/skin/default/xml/common/holds.xml     |    1 +
 6 files changed, 69 insertions(+), 31 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list