turning raw time durations into h/m/s notation so interval_to_seconds can parse it
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 25 Jul 2008 19:00:18 +0000 (19:00 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 25 Jul 2008 19:00:18 +0000 (19:00 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10134 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 2076337..ce9ff84 100644 (file)
@@ -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");
@@ -1103,7 +1109,7 @@ sub fleshed_circ_retrieve {
        };
 }
 
-
+# {"select":{"acp":["id"],"circ":[{"aggregate":true,"transform":"count","alias":"count","column":"id"}]},"from":{"acp":{"circ":{"field":"target_copy","fkey":"id","type":"left"},"acn"{"field":"id","fkey":"call_number"}}},"where":{"+acn":{"record":200057}}
 
 
 1;
index a28d94f..25ce248 100644 (file)
@@ -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;