]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/ttTimeHelper.class.php
Introduced ALLOW_OVERLAP setting
[timetracker.git] / WEB-INF / lib / ttTimeHelper.class.php
index 1333894ba91bd162c0853ce579dc906e386a1844..f743e61d211232eb947ea207e26adc664d49e7bb 100644 (file)
@@ -365,7 +365,10 @@ class ttTimeHelper {
     $duration = ttTimeHelper::normalizeDuration($duration);
 
     if (!$timestamp) {
     $duration = ttTimeHelper::normalizeDuration($duration);
 
     if (!$timestamp) {
-      $timestamp = date('YmdHis');//yyyymmddhhmmss
+      $timestamp = date('YmdHis'); //yyyymmddhhmmss
+      // TODO: this timestamp could be illegal if we hit inside DST switch deadzone, such as '2016-03-13 02:30:00'
+      // Anything between 2am and 3am on DST introduction date will not work if we run on a system with DST on.
+      // We need to address this properly to avoid potential complications.
     }
         
     if (!$billable) $billable = 0;
     }
         
     if (!$billable) $billable = 0;
@@ -512,6 +515,10 @@ class ttTimeHelper {
   //   $finish - new record finish time, may be null
   //   $record_id - optional record id we may be editing, excluded from overlap set
   static function overlaps($user_id, $date, $start, $finish, $record_id = null) {
   //   $finish - new record finish time, may be null
   //   $record_id - optional record id we may be editing, excluded from overlap set
   static function overlaps($user_id, $date, $start, $finish, $record_id = null) {
+    // Do not bother checking if we allow overlaps.
+    if (defined('ALLOW_OVERLAP') && ALLOW_OVERLAP == true)
+      return false;
+      
     $mdb2 = getConnection();
     
     $start = ttTimeHelper::to24HourFormat($start);
     $mdb2 = getConnection();
     
     $start = ttTimeHelper::to24HourFormat($start);