From b5f60ac57e20dcf4d51e2eb760e44d42e73eae40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?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=UTF-8 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 --- C4/Circulation.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 125c0c2744..1667ec7332 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.30.2