From 19eedc943cec55f20f944b2ed7656bd7fe65e30f Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 9 Nov 2011 15:51:40 -0500 Subject: [PATCH] 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 --- Open-ILS/src/extras/ils_events.xml | 3 +++ .../perlmods/lib/OpenILS/Application/Circ/Holds.pm | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) 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 @@ A hold request at a higher level than copy has been attempted, but there are no copies that belonging to the higher-level unit. + + Attempt to suspend a hold after it has been captured. + 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'); + } } -- 2.43.2