From: erickson Date: Fri, 25 Jul 2008 18:59:50 +0000 (+0000) Subject: backporting just in case: turning raw time durations into h/m/s notation so interval... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fd855ca42929bac80bdc91f7beaaca8494eb8cc8;p=Evergreen.git backporting just in case: turning raw time durations into h/m/s notation so interval_to_seconds can parse it git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2_2@10133 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm index 915105e708..fd7b41c5c8 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm @@ -380,7 +380,13 @@ sub void_overdues { # one fine interval to the backdate to ensure that we are not # voiding fines that were applicable before the backdate. # ------------------------------------------------------------------ - my $interval = OpenSRF::Utils->interval_to_seconds($circ->fine_interval); + + # 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($backdate); $backdate = $U->epoch2ISO8601($date->epoch + $interval); $logger->info("applying backdate $backdate in overdue voiding"); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm index b0121d142e..cac7262f6f 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm @@ -263,7 +263,6 @@ sub translate_legacy_args { $$args{is_precat} = $$args{precat}; delete $$args{precat}; } - } @@ -1167,6 +1166,9 @@ sub apply_modified_due_date { sub create_due_date { my( $self, $duration ) = @_; + # if there is a raw time component (e.g. from postgres), + # turn it into an interval that interval_to_seconds can parse + $duration =~ s/(\d{2}):(\d{2}):(\d{2})/$1 h $2 m $3 s/o; my ($sec,$min,$hour,$mday,$mon,$year) = gmtime(OpenSRF::Utils->interval_to_seconds($duration) + int(time())); $year += 1900; $mon += 1;