[open-ils-commits] r10133 - in branches/rel_1_2_2/Open-ILS/src/perlmods/OpenILS/Application: . Circ

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Jul 25 14:59:58 EDT 2008


Author: erickson
Date: 2008-07-25 14:59:50 -0400 (Fri, 25 Jul 2008)
New Revision: 10133

Modified:
   branches/rel_1_2_2/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
   branches/rel_1_2_2/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Log:
backporting just in case:  turning raw time durations into h/m/s notation so interval_to_seconds can parse it

Modified: branches/rel_1_2_2/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- branches/rel_1_2_2/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2008-07-25 18:58:50 UTC (rev 10132)
+++ branches/rel_1_2_2/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2008-07-25 18:59:50 UTC (rev 10133)
@@ -263,7 +263,6 @@
         $$args{is_precat} = $$args{precat};
         delete $$args{precat};
     }
-
 }
 
 
@@ -1167,6 +1166,9 @@
 
 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;

Modified: branches/rel_1_2_2/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
===================================================================
--- branches/rel_1_2_2/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm	2008-07-25 18:58:50 UTC (rev 10132)
+++ branches/rel_1_2_2/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm	2008-07-25 18:59:50 UTC (rev 10133)
@@ -380,7 +380,13 @@
         # 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");



More information about the open-ils-commits mailing list