forward-porting r15694: preserve time component of original circ when backdating...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 4 Mar 2010 16:19:14 +0000 (16:19 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 4 Mar 2010 16:19:14 +0000 (16:19 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15695 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm

index a06404d..07fd165 100644 (file)
@@ -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;
     }
index 6f64625..7da13d6 100644 (file)
@@ -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(
         {