From: Dan Wells Date: Mon, 16 Feb 2015 16:09:45 +0000 (-0500) Subject: LP#1422379 Fix backdate voiding for new billing timestamps X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4d3a08f45b0ffc36c429238f0180e3d3274acac9;p=working%2FEvergreen.git 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 --- 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 a42af68e46..c39c548a7f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm @@ -39,28 +39,15 @@ sub void_or_zero_overdues { if( $opts->{backdate} ) { my $backdate = $opts->{backdate}; $opts->{note} = 'System: OVERDUE REVERSED FOR BACKDATE' if !$opts->{note}; - # ------------------------------------------------------------------ - # 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}; } }