Bug 18936: (follow-up) Make possible to have unlimited value for holds_per_day

Without this it is not possible to make for a specific patron category
or itemtype a more specific unlimited holds_per_day rule if you have a
catch all rule (categorycode = *, itemtype = *) with limited
holds_per_day value.

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Joonas Kylmälä 2020-01-28 15:05:15 +00:00 committed by Martin Renvoize
parent 61628c97c2
commit 0401d13d2c
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 8 additions and 7 deletions

View File

@ -393,7 +393,8 @@ sub CanItemBeReserved {
biblionumber => $item->biblionumber,
}
);
if ( $holds->count() >= $holds_per_record ) {
if ( defined $holds_per_record && $holds_per_record ne ''
&& $holds->count() >= $holds_per_record ) {
return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record };
}
@ -402,10 +403,9 @@ sub CanItemBeReserved {
reservedate => dt_from_string->date
});
if ( defined $holds_per_day &&
( ( $holds_per_day > 0 && $today_holds->count() >= $holds_per_day )
or ( $holds_per_day == 0 ) )
) {
if ( defined $holds_per_day && $holds_per_day ne ''
&& $today_holds->count() >= $holds_per_day )
{
return { status => 'tooManyReservesToday', limit => $holds_per_day };
}
@ -436,7 +436,8 @@ sub CanItemBeReserved {
}
# we check if it's ok or not
if ( $reservecount >= $allowedreserves ) {
if ( defined $allowedreserves && $allowedreserves ne ''
&& $reservecount >= $allowedreserves ) {
return { status => 'tooManyReserves', limit => $allowedreserves };
}

View File

@ -277,7 +277,7 @@ elsif ($op eq 'add') {
my $holds_per_record = $input->param('holds_per_record');
my $holds_per_day = $input->param('holds_per_day');
$holds_per_day =~ s/\s//g;
$holds_per_day = undef if $holds_per_day !~ /^\d+/;
$holds_per_day = '' if $holds_per_day !~ /^\d+/;
my $onshelfholds = $input->param('onshelfholds') || 0;
$maxissueqty =~ s/\s//g;
$maxissueqty = '' if $maxissueqty !~ /^\d+/;