Hermes: convert timestamps coming from the database into Horde_Date objects
authorBen Klang <ben@alkaloid.net>
Thu, 10 Jun 2010 16:25:23 +0000 (12:25 -0400)
committerBen Klang <ben@alkaloid.net>
Thu, 10 Jun 2010 16:25:49 +0000 (12:25 -0400)
hermes/lib/Driver/sql.php

index caaac31..df8b16e 100644 (file)
@@ -285,9 +285,14 @@ class Hermes_Driver_sql extends Hermes_Driver {
             return $hours;
         }
 
-        // Add cost object names to the results.
-        if (empty($fields) || in_array('costobject', $fields)) {
-            foreach (array_keys($hours) as $hkey) {
+        // Do per-record processing
+        foreach (array_keys($hours) as $hkey) {
+            // Convert timestamps to Horde_Date objects
+            $hours[$hkey]['date'] = new Horde_Date($hours[$hkey]['date']);
+
+            // Add cost object names to the results.
+            if (empty($fields) || in_array('costobject', $fields)) {
+            
                 if (empty($hours[$hkey]['costobject'])) {
                     $hours[$hkey]['_costobject_name'] = '';
                 } else {