From 00a73846c054c6814250adfa4181e613192abfc4 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 24 Mar 2022 11:42: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 Signed-off-by: David Nind Signed-off-by: Marcel de Rooy Signed-off-by: Fridolin Somers --- C4/Circulation.pm | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index d0f292650d..abd0a5ca5d 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -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 { -- 2.39.5