From 91a5163263bf4d6c0be4f84d6ce1649221e267c7 Mon Sep 17 00:00:00 2001 From: Ben Klang Date: Thu, 10 Jun 2010 12:25:23 -0400 Subject: [PATCH] Hermes: convert timestamps coming from the database into Horde_Date objects --- hermes/lib/Driver/sql.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hermes/lib/Driver/sql.php b/hermes/lib/Driver/sql.php index caaac3131..df8b16e69 100644 --- a/hermes/lib/Driver/sql.php +++ b/hermes/lib/Driver/sql.php @@ -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 { -- 2.11.0