From 83823f891f788e4c88ae690d5b8bb809f47dc8ec Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 22 Mar 2024 13:54:03 +0000 Subject: [PATCH] Bug 36331: (follow-up) Ignore non_priority holds when checking renewability When changing the fetch of holds, the check for non-priority was lost - added a loop to pull those out so the totals and checks are correct Signed-off-by: Tomas Cohen Arazi Tidied (tcohen) Signed-off-by: Katrin Fischer (cherry picked from commit b7ad3364cbf8778507f7d0dbd2a0199cbe7c0cdd) Signed-off-by: Fridolin Somers (cherry picked from commit 4f4add4c039f30a69bedb75088d9eb5081db29f2) Signed-off-by: Lucas Gass --- C4/Circulation.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index a96921a6d6..281f29f35d 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -3040,8 +3040,12 @@ sub CanBookBeRenewed { if ( $item->current_holds->search( { non_priority => 0 } )->count ); - my ($status, $matched_reserve, $fillable_holds) = CheckReserves($item); - if ( $fillable_holds ) { + my ( $status, $matched_reserve, $possible_holds ) = CheckReserves($item); + my @fillable_holds = (); + foreach my $possible_hold ( @{$possible_holds} ) { + push @fillable_holds, $possible_hold unless $possible_hold->{non_priority}; + } + if ( @fillable_holds ) { if ( C4::Context->preference('AllowRenewalIfOtherItemsAvailable') ) { # Get all other items that could possibly fill reserves @@ -3052,10 +3056,10 @@ sub CanBookBeRenewed { notforloan => 0, -not => { itemnumber => $item->itemnumber } })->as_list; - return ( 0, "on_reserve" ) if @{$fillable_holds} && (scalar @other_items < scalar @{$fillable_holds} ); + return ( 0, "on_reserve" ) if @fillable_holds && (scalar @other_items < scalar @fillable_holds ); my %matched_items; - foreach my $possible_hold ( @{$fillable_holds} ) { + foreach my $possible_hold ( @fillable_holds ) { my $fillable = 0; my $patron_with_reserve = Koha::Patrons->find($possible_hold->{borrowernumber}); -- 2.39.5