From 507edad61f16d99d4fba4ce343cbaa6eb3950957 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Mon, 22 Aug 2022 19:02:14 +0000 Subject: [PATCH] Bug 31112: (follow-up) Don't return "on_reserve" when there are 0 possible holds MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It's possible that there could be 0 possible reserves, for example when the hold has already been filled, thus the check would fail as the item count can never be less than 0. Signed-off-by: Joonas Kylmälä Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- C4/Circulation.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index f269d481d7..4608d45b51 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2963,7 +2963,7 @@ sub CanBookBeRenewed { notforloan => 0, -not => { itemnumber => $itemnumber } })->as_list; - return ( 0, "on_reserve" ) if scalar @other_items < scalar @possible_holds; + return ( 0, "on_reserve" ) if @possible_holds && (scalar @other_items < scalar @possible_holds); my %matched_items; foreach my $possible_hold (@possible_holds) { -- 2.20.1