From 6885b3bca6e84b5bc09c5593bad5e4aab4efc65f Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 4 Mar 2010 16:19:14 +0000 Subject: [PATCH] forward-porting r15694: preserve time component of original circ when backdating -- mainly to avoid over-voiding billings git-svn-id: svn://svn.open-ils.org/ILS/trunk@15695 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Application/Circ.pm | 8 +++++++- Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm | 7 +++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm index a06404db7..07fd165a5 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm @@ -367,8 +367,14 @@ sub set_circ_claims_returned { $circ->stop_fines_time('now') unless $circ->stop_fines_time; if( $backdate ) { + $backdate = cleanse_ISO8601($backdate); + + my $original_date = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($circ->due_date)); + my $new_date = DateTime::Format::ISO8601->new->parse_datetime($backdate); + $backdate = $new_date->ymd . 'T' . $original_date->strftime('%T%z'); + # make it look like the circ stopped at the cliams returned time - $circ->stop_fines_time(cleanse_ISO8601($backdate)); + $circ->stop_fines_time($backdate); my $evt = OpenILS::Application::Circ::CircCommon->void_overdues($e, $circ, $backdate); return $evt if $evt; } diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm index 6f646253a..7da13d6ee 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm @@ -2781,8 +2781,11 @@ sub checkin_handle_backdate { # clean up the backdate for date comparison # we want any bills created on or after the backdate # ------------------------------------------------------------------ - $bd =~ s/^(\d{4}-\d{2}-\d{2}).*/$1/og; - #$bd = "${bd}T23:59:59"; + my $original_date = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($self->circ->due_date)); + my $new_date = DateTime::Format::ISO8601->new->parse_datetime($bd); + $bd = $new_date->ymd . 'T' . $original_date->strftime('%T%z'); + + $self->backdate($bd); my $bills = $self->editor->search_money_billing( { -- 2.11.0