From f9c1bc1f3485f8395d28f082eba3a1aeffc1e16e Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 20 Jul 2023 02:39:27 +0000 Subject: [PATCH] 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 Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit f8c474019d74c9fd608206daf3074a79c5737f12) Signed-off-by: Fridolin Somers (cherry picked from commit 8fc3531e079d076a3212b2aa76525b5ca6e874bd) Signed-off-by: Matt Blenkinsop --- C4/Circulation.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 891731d0ae..85e0620a7d 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -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 ); -- 2.39.5