X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttTimeHelper.class.php;h=29b74145f04361e7382c9490993f9c7b90e85a4c;hb=1b3f5f78060419160ba8e1ec6fa8f1e6399af711;hp=1333894ba91bd162c0853ce579dc906e386a1844;hpb=993450e17195b87dc406c3135ee22dafe9b825fb;p=timetracker.git diff --git a/WEB-INF/lib/ttTimeHelper.class.php b/WEB-INF/lib/ttTimeHelper.class.php index 1333894b..29b74145 100644 --- a/WEB-INF/lib/ttTimeHelper.class.php +++ b/WEB-INF/lib/ttTimeHelper.class.php @@ -167,9 +167,9 @@ class ttTimeHelper { $time_a = explode(':', $value); if ($time_a[0] > 12) $res = (string)((int)$time_a[0] - 12).':'.$time_a[1].' PM'; - else if ($time_a[0] == 12) + elseif ($time_a[0] == 12) $res = $value.' PM'; - else if ($time_a[0] == 0) + elseif ($time_a[0] == 0) $res = '12:'.$time_a[1].' AM'; else $res = $value.' AM'; @@ -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); @@ -608,12 +615,12 @@ class ttTimeHelper { $mdb2 = getConnection(); $client_field = null; - if (in_array('cl', explode(',', $user->plugins))) + if ($user->isPluginEnabled('cl')) $client_field = ", c.name as client"; $left_joins = " left join tt_projects p on (l.project_id = p.id)". " left join tt_tasks t on (l.task_id = t.id)"; - if (in_array('cl', explode(',', $user->plugins))) + if ($user->isPluginEnabled('cl')) $left_joins .= " left join tt_clients c on (l.client_id = c.id)"; $sql = "select l.id as id, TIME_FORMAT(l.start, $sql_time_format) as start,