From c5fde26b0db86330f6fac89463732ec97b65d0d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Sat, 20 Nov 2021 11:48:55 +0000 Subject: [PATCH] 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 --- C4/Circulation.pm | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index c6b9e7683b..d4cca7b1b1 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -4316,23 +4316,11 @@ sub _CanBookBeAutoRenewed { } } - if ( defined $issuing_rule->{norenewalbefore} - and $issuing_rule->{norenewalbefore} ne "" ) { - if ( $soonest_renew_date > dt_from_string()) { - return "auto_too_soon"; - } else { - return "ok"; - } + if ( $soonest_renew_date > dt_from_string()) { + return "auto_too_soon"; } - # 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 { - return "auto_too_soon"; - } + return "ok"; } sub _item_denied_renewal { -- 2.20.1