Code

Apply patch for #3768
authorpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 3 Feb 2010 13:27:21 +0000 (13:27 +0000)
committerpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 3 Feb 2010 13:27:21 +0000 (13:27 +0000)
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

trunk/gosa-core/include/utils/class_tests.inc
trunk/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc

index 2f1d0b05cada8039c64bc22a1d0ae05e6484c2a1..a34eac4ca8eb0a04547031e4dd4ce2d4cdaa078d 100644 (file)
@@ -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:
index b163d1b0552aff03fe479d7fa38caf4b1677b736..c06fa68ccb7208f9ce16913a1d56741db6d0b11d 100644 (file)
@@ -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);
   }