From bcf6514cc79c9b388facf75d5fa65a16073b0251 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 19 Feb 2021 10:17:26 +0000 Subject: [PATCH] Bug 27729: Fix use of grep and split in CheckReserves A few lines of code were added to CheckReserves containing the wrong use of two perl functions: grep and split on bug 25232. A test was added even making these things pass. Test plan: Run t/db../Holds.t Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart (cherry picked from commit c4c3d1e93c337d93679e50f2354c8b060e50bcd9) Signed-off-by: Fridolin Somers (cherry picked from commit a29962440451cc7b3cd79370008eea94c83e9c8e) Signed-off-by: Andrew Fuerste-Henry --- C4/Reserves.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 0328d3bf16..0c24a55cfa 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -813,8 +813,8 @@ sub CheckReserves { # if item is not for loan it cannot be reserved either..... # except where items.notforloan < 0 : This indicates the item is holdable. - my @SkipHoldTrapOnNotForLoanValue = split( '|', C4::Context->preference('SkipHoldTrapOnNotForLoanValue') ); - return if @SkipHoldTrapOnNotForLoanValue && grep( $notforloan_per_item, @SkipHoldTrapOnNotForLoanValue ); + my @SkipHoldTrapOnNotForLoanValue = split( '\|', C4::Context->preference('SkipHoldTrapOnNotForLoanValue') ); + return if grep { $_ eq $notforloan_per_item } @SkipHoldTrapOnNotForLoanValue; my $dont_trap = C4::Context->preference('TrapHoldsOnOrder') ? ($notforloan_per_item > 0) : ($notforloan_per_item && 1 ); return if $dont_trap or $notforloan_per_itemtype; -- 2.39.5