From 35c6fcec5fa477389b723a866c77ff11588a2909 Mon Sep 17 00:00:00 2001 From: =?utf8?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=utf8 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 Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 8ad992630181413d3be9935309b61d50d2e3a951) Signed-off-by: Lucas Gass --- C4/Circulation.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index b8ff965c3c..8ff7ec89db 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2944,7 +2944,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); @@ -2986,9 +2987,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.39.5