From eeed8ea8d953152c88d47c0c69f35fbe4bb7f3e9 Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Mon, 7 May 2012 11:59:10 -0400 Subject: [PATCH] Hold Capture: Run permit tests on "old" holds Because we shouldn't be trusting that the copies are still valid. Signed-off-by: Thomas Berezansky Signed-off-by: Mike Rylander --- .../lib/OpenILS/Application/Circ/Holds.pm | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) 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 097dc6970e..b11065822b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -2906,13 +2906,15 @@ sub find_nearest_permitted_hold { "open-ils.storage.action.hold_request.nearest_hold.atomic", $user->ws_ou, $copy->id, 10, $hold_stall_interval, $fifo ); - unless(@$best_holds) { - - if( my $hold = $$old_holds[0] ) { - $logger->info("circulator: using existing pre-targeted hold ".$hold->id." in hold search"); - return ($hold); + # Add any pre-targeted holds to the list too? Unless they are already there, anyway. + if ($old_holds) { + for my $holdid (@$old_holds) { + next unless $holdid; + push(@$best_holds, $holdid) unless ( grep { ''.$holdid eq ''.$_ } @$best_holds ); } + } + unless(@$best_holds) { $logger->info("circulator: no suitable holds found for copy $bc"); return (undef, $evt); } @@ -2954,11 +2956,6 @@ sub find_nearest_permitted_hold { unless( $best_hold ) { # no "good" permitted holds were found - if( my $hold = $$old_holds[0] ) { # can we return a pre-targeted hold? - $logger->info("circulator: using existing pre-targeted hold ".$hold->id." in hold search"); - return ($hold); - } - # we got nuthin $logger->info("circulator: no suitable holds found for copy $bc"); return (undef, $evt); -- 2.43.2