From: Bill Erickson <berick@esilibrary.com> Date: Wed, 9 Nov 2011 20:51:40 +0000 (-0500) Subject: Prevent hold suspencion for captured holds in API X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=19eedc943cec55f20f944b2ed7656bd7fe65e30f;p=evergreen%2Fmasslnc.git Prevent hold suspencion for captured holds in API 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> --- diff --git a/Open-ILS/src/extras/ils_events.xml b/Open-ILS/src/extras/ils_events.xml index 0297eff643..0a8b7a8cc9 100644 --- a/Open-ILS/src/extras/ils_events.xml +++ b/Open-ILS/src/extras/ils_events.xml @@ -743,6 +743,9 @@ <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'> 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 27dd1af8a4..3719afc3d7 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -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'); + } }