Bug 29537: Remove unnecessary if-else checks for soonest renew date

GetSoonestRenewDate() calculates the renewal due date now also
correctly for auto-renewals after the fixes from bug 29476 so we don't
have to add any if-else checks because of it being buggy anymore.

To test:
 1) prove t/db_dependent/Circulation.t

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Nick Clemens 2022-03-24 11:42:55 +00:00 committed by Fridolin Somers
parent a64e20b39c
commit 00a73846c0
1 changed files with 4 additions and 15 deletions

View File

@ -4457,23 +4457,12 @@ sub _CanBookBeAutoRenewed {
}
}
if ( defined $issuing_rule->{norenewalbefore}
and $issuing_rule->{norenewalbefore} ne "" ) {
if ( GetSoonestRenewDate($patron->id, $item->id) > dt_from_string()) {
return "auto_too_soon";
} else {
return "ok";
}
}
# Fallback for automatic renewals:
# If norenewalbefore is undef, don't renew before due date.
my $now = dt_from_string;
if ( $now >= dt_from_string( $issue->date_due, 'sql' ) ){
return "ok";
} else {
if ( GetSoonestRenewDate( $patron->id, $item->id ) > dt_from_string() )
{
return "auto_too_soon";
}
return "ok";
}
sub _item_denied_renewal {