From d79aee017bfae97775f34321390fdc2155e599d6 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 (cherry picked from commit 507edad61f16d99d4fba4ce343cbaa6eb3950957) Signed-off-by: Lucas Gass --- C4/Circulation.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 8ff7ec89db..c0be372db8 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2962,7 +2962,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.39.5