Bug 30362: Fix GetSoonestRenewDate to really return soonest renew date

This change fixes GetSoonestRenewDate so that it returns the soonest
renew date as calculated using "No Renewal Before" and "NoRenewalBeforePrecision".
In the past, it would only return the soonest renew date if "$now" was
lesser than it, which would typically only happen when using an "exact"
precision rather than a "date" precision.

Test plan:
0. Apply the patch
1. prove t/db_dependent/Circulation.t

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f8c474019d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 8fc3531e07)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
David Cook 2023-07-20 02:39:27 +00:00 committed by Matt Blenkinsop
parent 0723661c87
commit f9c1bc1f34

View file

@ -3405,7 +3405,7 @@ sub GetSoonestRenewDate {
{
$soonestrenewal->truncate( to => 'day' );
}
return $soonestrenewal if $now < $soonestrenewal;
return $soonestrenewal;
} elsif ( $checkout->auto_renew && $patron->autorenew_checkouts ) {
# Checkouts with auto-renewing fall back to due date
my $soonestrenewal = dt_from_string( $checkout->date_due );