From dda1ac41fbe6a49235cd1e635fcbd7772c113057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Mon, 22 Aug 2022 19:02:03 +0000 Subject: [PATCH] Bug 31112: (follow-up) Bring back the check for non-priority holds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before the changes from bug 31112 when CheckReserves returned a non-priority hold we didn't return "on_reserve" status but checked in addition to that whether there are any priority holds and if there were, only then we returned the "on_reserve" error. Signed-off-by: Joonas Kylmälä Signed-off-by: Kyle M Hall --- C4/Circulation.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 606d83940b..125c0c2744 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2945,7 +2945,8 @@ sub CanBookBeRenewed { } } - if ( C4::Context->preference('AllowRenewalIfOtherItemsAvailable') && !Koha::Holds->search( { itemnumber => $itemnumber, found => undef } )->count() + my $biblio_has_holds = Koha::Holds->search({ biblionumber => $item->biblionumber, non_priority => 0 } )->count > 0; + if ( $biblio_has_holds && C4::Context->preference('AllowRenewalIfOtherItemsAvailable') && !Koha::Holds->search( { itemnumber => $itemnumber, found => undef } )->count() ) { my $biblio = Koha::Biblios->find($item->biblionumber); @@ -2987,9 +2988,9 @@ sub CanBookBeRenewed { return ( 0, "on_reserve" ) unless $fillable; } - } else { + } elsif ($biblio_has_holds) { my ($status, $matched_reserve, $possible_reserves) = CheckReserves($itemnumber); - return ( 0, "on_reserve" ) if $matched_reserve; + return ( 0, "on_reserve" ) if $status; } return ( 0, $auto_renew, { soonest_renew_date => $soonest } ) if $auto_renew =~ 'too_soon';#$auto_renew ne "no" && $auto_renew ne "ok"; -- 2.30.2