From 7d822def68be45e9dba9e93778d98aaa90d74aed Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 25 Jun 2021 15:45:39 -0400 Subject: [PATCH] LP1891369 Renewal exentions ignores overdues Exit renewal extension logic early when the renewed circulation was overdue. I.e., there's no time to offer on the subsequent circulation. Signed-off-by: Bill Erickson Signed-off-by: Michele Morgan Signed-off-by: Galen Charlton --- Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm index 88d2d73cf5..ca293dcfa2 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -2387,11 +2387,13 @@ sub extend_renewal_due_date { my $start_time = DateTime::Format::ISO8601->new ->parse_datetime(clean_ISO8601($prev_circ->xact_start))->epoch; - my $end_time = DateTime::Format::ISO8601->new + my $due_time = DateTime::Format::ISO8601->new ->parse_datetime(clean_ISO8601($prev_circ->due_date))->epoch; my $now_time = DateTime->now->epoch; + return if $due_time < $now_time; # Renewed circ was overdue. + if (my $interval = $matchpoint->renew_extend_min_interval) { my $min_duration = OpenILS::Utils::DateTime->interval_to_seconds($interval); @@ -2400,7 +2402,7 @@ sub extend_renewal_due_date { return if $checkout_duration < $min_duration; } - my $remaining_duration = $end_time - $now_time; + my $remaining_duration = $due_time - $now_time; my $due_date = DateTime::Format::ISO8601->new ->parse_datetime(clean_ISO8601($circ->due_date)); -- 2.11.0