[open-ils-commits] r15779 - in branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application: . Circ (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Mar 10 15:26:00 EST 2010
Author: miker
Date: 2010-03-10 15:25:55 -0500 (Wed, 10 Mar 2010)
New Revision: 15779
Modified:
branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Log:
preserve time component, when appropriate, on edited due dates and backdated circ checkins
Modified: branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2010-03-10 19:41:50 UTC (rev 15778)
+++ branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2010-03-10 20:25:55 UTC (rev 15779)
@@ -2244,9 +2244,12 @@
# 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(clense_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(
{
billing_ts => { '>=' => $bd },
Modified: branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm 2010-03-10 19:41:50 UTC (rev 15778)
+++ branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm 2010-03-10 20:25:55 UTC (rev 15779)
@@ -305,8 +305,14 @@
$circ->stop_fines_time('now') unless $circ->stop_fines_time;
if( $backdate ) {
+ $backdate = clense_ISO8601($backdate);
+
+ my $original_date = DateTime::Format::ISO8601->new->parse_datetime(clense_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(clense_ISO8601($backdate));
+ $circ->stop_fines_time($backdate);
my $evt = OpenILS::Application::Circ::CircCommon->void_overdues($e, $circ, $backdate);
return $evt if $evt;
}
@@ -341,6 +347,13 @@
return $e->die_event unless $e->allowed('CIRC_OVERRIDE_DUE_DATE', $circ->circ_lib);
$date = clense_ISO8601($date);
+
+ if (!(interval_to_seconds($circ->duration) % 86400)) { # duration is divisible by days
+ my $original_date = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($circ->due_date));
+ my $new_date = DateTime::Format::ISO8601->new->parse_datetime($date);
+ $date = $new_date->ymd . 'T' . $original_date->strftime('%T%z');
+ }
+
$circ->due_date($date);
$e->update_action_circulation($circ) or return $e->die_event;
$e->commit;
More information about the open-ils-commits
mailing list