From 91af482f4952482729d3ecb1de4768f3e5e09ac7 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 31 Aug 2023 12:36:25 +0100 Subject: [PATCH] Revert "Bug 30362: Fix GetSoonestRenewDate to really return soonest renew date" This reverts commit c31d9761740a51a7485b7592ae2c7110b32aed1f. --- C4/Circulation.pm | 4 ++-- t/db_dependent/Circulation.t | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2e2f716272..891731d0ae 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -3405,8 +3405,8 @@ sub GetSoonestRenewDate { { $soonestrenewal->truncate( to => 'day' ); } - return $soonestrenewal; - } elsif ( $issue->auto_renew && $patron->autorenew_checkouts ) { + return $soonestrenewal if $now < $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 ); if ( C4::Context->preference('NoRenewalBeforePrecision') eq 'date' diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 33b14c85f2..15aafac7ca 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -5775,13 +5775,12 @@ subtest "GetSoonestRenewDate tests" => sub { rule_value => 1, } ); - $issue->date_due(dt_from_string)->store; + $issue->date_due( dt_from_string )->store; is( GetSoonestRenewDate( $patron, $issue ), dt_from_string->subtract( days => 1 )->truncate( to => 'day' ), 'Checkouts with auto-renewal can be renewed 1 day before due date if no renewalbefore = 1 and precision = "date"' ); - }; subtest "CanBookBeIssued + needsconfirmation message" => sub { -- 2.39.5