From c855a20ebae6d4db1b6ba0c4a7c68aa503138ea6 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 16 May 2013 08:50:23 -0400 Subject: [PATCH] Bug 10166 [3.10.x] Can't place holds on multiple titles if one or more are un-holdable opac-reserve.pl tries to check whether all selected titles in a multiple-hold batch are unavailable to be placed on hold. However, the logic is flawed in such a way that if the last item in the batch cannot be placed on hold the script assumes none can be placed on hold. This patch modifies the way the script tracks the "no titles available for holds" variable in order to correct the error. To test, place multiple holds by selecting titles from a list of search results. Test three conditions: - All titles are available to be placed on hold You should see no onscreen warnings, and all titles should be selectable on the place hold screen. A "Place hold" button should appear at the bottom. - Some titles can be placed on hold, some cannot The titles which can be placed on hold should be selectable. Titles which cannot be placed on hold should show a warning message. A "Place hold" button should appear at the bottom. - No titles can be placed on hold "Sorry, none of these items can be placed on hold." should appear at the top of the page. All titles should appear with warning messages. There should be no "Place hold" button. Signed-off-by: Chris Cormack --- opac/opac-reserve.pl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index fbc9dd7..8a06967 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -350,7 +350,7 @@ my $notforloan_label_of = get_notforloan_label_of(); my $biblioLoop = []; my $numBibsAvailable = 0; my $itemdata_enumchron = 0; -my $anyholdable; +my $anyholdable = 0; my $itemLevelTypes = C4::Context->preference('item-level_itypes'); $template->param('item_level_itypes' => $itemLevelTypes); @@ -527,21 +527,20 @@ foreach my $biblioNum (@biblionumbers) { $numBibsAvailable++; $biblioLoopIter{bib_available} = 1; $biblioLoopIter{holdable} = 1; - $anyholdable = 1; } if ($biblioLoopIter{already_reserved}) { $biblioLoopIter{holdable} = undef; - $anyholdable = undef; } if(not CanBookBeReserved($borrowernumber,$biblioNum)){ $biblioLoopIter{holdable} = undef; - $anyholdable = undef; } + if( $biblioLoopIter{holdable} ){ $anyholdable = 1; } + push @$biblioLoop, \%biblioLoopIter; } -if ( $numBibsAvailable == 0 || !$anyholdable) { +if ( $numBibsAvailable == 0 || $anyholdable == 0) { $template->param( none_available => 1 ); } -- 1.7.10.4