From fc1cd513276edc6b6f9fe01ffd596a802e8b17a2 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 Signed-off-by: Kyle M Hall --- C4/Circulation.pm | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 543524feb4..1ebc53a50e 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -4350,23 +4350,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