Prevent hold suspencion for captured holds in API
authorBill Erickson <berick@esilibrary.com>
Wed, 9 Nov 2011 20:51:40 +0000 (15:51 -0500)
committerBill Erickson <berick@esilibrary.com>
Wed, 9 Nov 2011 20:51:40 +0000 (15:51 -0500)
This codifies at the API layer the standard Evergreen practice of
disallowing suspension of holds that have already been captured.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/extras/ils_events.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm

index 0297eff..0a8b7a8 100644 (file)
        <event code='1714' textcode='HIGH_LEVEL_HOLD_HAS_NO_COPIES'>
                <desc xml:lang="en-US">A hold request at a higher level than copy has been attempted, but there are no copies that belonging to the higher-level unit.</desc>
        </event>
+       <event code='1715' textcode='HOLD_SUSPEND_AFTER_CAPTURE'>
+               <desc xml:lang="en-US">Attempt to suspend a hold after it has been captured.</desc>
+       </event>
 
 
        <event code='2000' textcode='BAD_PARAMS'>
index 27dd1af..3719afc 100644 (file)
@@ -916,14 +916,14 @@ sub update_hold_impl {
 
 
     # --------------------------------------------------------------
-    # See if the hold is getting frozen while in transit.  If so, 
-    # make sure that's allowed.
+    # Disallow hold suspencion if the hold is already captured.
     # --------------------------------------------------------------
-    if ($U->is_true($hold->frozen) and !$U->is_true($orig_hold->frozen)) {
+    if ($U->is_true($hold->frozen) and not $U->is_true($orig_hold->frozen)) {
         $hold_status = _hold_status($e, $hold);
-        if ($hold_status == 3) { # in transit
-        
-       }
+        if ($hold_status > 2) { # hold is captured
+            $logger->info("bypassing hold freeze on captured hold");
+            return OpenILS::Event->new('HOLD_SUSPEND_AFTER_CAPTURE');
+        }
     }