Refactoring - cleaning up whitespace
[timetracker.git] / WEB-INF / lib / ttTimeHelper.class.php
index 6b76f9f..e1b2470 100644 (file)
@@ -365,7 +365,10 @@ class ttTimeHelper {
     $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;
@@ -489,7 +492,7 @@ class ttTimeHelper {
   static function getUncompleted($user_id) {
     $mdb2 = getConnection();
 
-    $sql = "select id from tt_log  
+    $sql = "select id, start from tt_log  
       where user_id = $user_id and start is not null and time_to_sec(duration) = 0 and status = 1";
     $res = $mdb2->query($sql);
     if (!is_a($res, 'PEAR_Error')) {
@@ -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) {
+    // Do not bother checking if we allow overlaps.
+    if (defined('ALLOW_OVERLAP') && ALLOW_OVERLAP == true)
+      return false;
+      
     $mdb2 = getConnection();
     
     $start = ttTimeHelper::to24HourFormat($start);
@@ -636,4 +643,3 @@ class ttTimeHelper {
   }
 
 }
-?>
\ No newline at end of file