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 <tomascohen@theke.io>
Tidied (tcohen)
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Nick Clemens 2024-03-22 13:54:03 +00:00 committed by Katrin Fischer
parent 158bcd03e6
commit b7ad3364cb
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 8 additions and 4 deletions

View File

@ -3054,8 +3054,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
@ -3066,10 +3070,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});