Bug 31112: (follow-up) Don't return "on_reserve" when there are 0 possible holds

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ä <joonas.kylmala@iki.fi>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 507edad61f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Joonas Kylmälä 2022-08-22 19:02:14 +00:00 committed by Lucas Gass
parent 35c6fcec5f
commit d79aee017b
1 changed files with 1 additions and 1 deletions

View File

@ -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) {