From a05ff201e3b11c8ae5e825ab5c1aaa91b7dc0194 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 --- 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 3a1266c3db..0899eea10f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -2388,11 +2388,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); @@ -2401,7 +2403,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