From 4f4add4c039f30a69bedb75088d9eb5081db29f2 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 --- C4/Circulation.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2ace2048fb..699e63d092 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -3070,8 +3070,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 @@ -3082,10 +3086,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