From b27d86180ad0c516dc4640ef1e0213ae6d235365 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Mon, 16 Feb 2015 11:09:45 -0500 Subject: [PATCH] LP#1422379 Fix backdate voiding for new billing timestamps With the new timestamp style, the extra step of jumping ahead one fine interval when selecting fines to void is unnecessary. Signed-off-by: Dan Wells --- .../lib/OpenILS/Application/Circ/CircCommon.pm | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm index f2d5aa5dbf..bb2ab19023 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm @@ -31,28 +31,15 @@ sub void_overdues { }; if( $backdate ) { - # ------------------------------------------------------------------ - # Fines for overdue materials are assessed up to, but not including, - # one fine interval after the fines are applicable. Here, we add - # one fine interval to the backdate to ensure that we are not - # voiding fines that were applicable before the backdate. - # ------------------------------------------------------------------ - - # if there is a raw time component (e.g. from postgres), - # turn it into an interval that interval_to_seconds can parse - my $duration = $circ->fine_interval; - $duration =~ s/(\d{2}):(\d{2}):(\d{2})/$1 h $2 m $3 s/o; - my $interval = OpenSRF::Utils->interval_to_seconds($duration); - - my $date = DateTime::Format::ISO8601->parse_datetime(cleanse_ISO8601($backdate)); + my $backdate_clean = cleanse_ISO8601($backdate); + my $backdate_dt = DateTime::Format::ISO8601->parse_datetime($backdate_clean); my $due_date = DateTime::Format::ISO8601->parse_datetime(cleanse_ISO8601($circ->due_date))->epoch; my $grace_period = extend_grace_period( $class, $circ->circ_lib, $circ->due_date, OpenSRF::Utils->interval_to_seconds($circ->grace_period), $e); - if($date->epoch <= $due_date + $grace_period) { + if($backdate_dt->epoch <= $due_date + $grace_period) { $logger->info("backdate $backdate is within grace period, voiding all"); } else { - $backdate = $U->epoch2ISO8601($date->epoch + $interval); $logger->info("applying backdate $backdate in overdue voiding"); - $$bill_search{billing_ts} = {'>=' => $backdate}; + $$bill_search{billing_ts} = {'>=' => $backdate_clean}; } } -- 2.11.0