From: psc Date: Wed, 3 Feb 2010 13:27:21 +0000 (+0000) Subject: Apply patch for #3768 X-Git-Url: https://git.tokkee.org/?p=gosa.git;a=commitdiff_plain;h=b39468bfe1f506501af829cea88aa23eda4b6d3e Apply patch for #3768 Allow human-readable timestamps when adding events via CSV files. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@15577 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/trunk/gosa-core/include/utils/class_tests.inc b/trunk/gosa-core/include/utils/class_tests.inc index 2f1d0b05c..a34eac4ca 100644 --- a/trunk/gosa-core/include/utils/class_tests.inc +++ b/trunk/gosa-core/include/utils/class_tests.inc @@ -273,6 +273,11 @@ class tests { return ($ad >= $from && $ad <= $to); } + + /* Check if given timestamp is in gosa-si time-format */ + public static function is_gosa_si_time($time){ + return preg_match ("/^20\d\d[0-1]\d[0-3]\d[0-2]\d[0-5]\d[0-5]\d$/i", $time); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/trunk/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc b/trunk/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc index b163d1b05..c06fa68cc 100644 --- a/trunk/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc +++ b/trunk/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc @@ -432,8 +432,10 @@ class DaemonEvent $ret[$attr] = $this->$attr; } - $ret['timestamp'] = $this->_timestamp_to_event($this->timestamp); - + # Check if timestamp is in gosa-si-time-format + if(!tests::is_gosa_si_time($ret['timestamp'])){ + $ret['timestamp'] = $this->_timestamp_to_event($this->timestamp); + } return($ret); }