X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttTimeHelper.class.php;h=b2bb2c076403e9cdb38fec3aaadd891b711cf0b2;hb=bb2dc72d5b08a2e04244a372ed58edc0384f1cdd;hp=bdec1a5f7e489c514cdc8d84b45d7fb729c5e359;hpb=66d86939b62dc5ae3d5f16088b61822e611cf58f;p=timetracker.git diff --git a/WEB-INF/lib/ttTimeHelper.class.php b/WEB-INF/lib/ttTimeHelper.class.php index bdec1a5f..b2bb2c07 100644 --- a/WEB-INF/lib/ttTimeHelper.class.php +++ b/WEB-INF/lib/ttTimeHelper.class.php @@ -659,8 +659,13 @@ class ttTimeHelper { } // getRecord - retrieves a time record identified by its id. - static function getRecord($id, $user_id) { + static function getRecord($id) { global $user; + + $user_id = $user->getUser(); + $group_id = $user->getGroup(); + $org_id = $user->org_id; + $sql_time_format = "'%k:%i'"; // 24 hour format. if ('%I:%M %p' == $user->time_format) $sql_time_format = "'%h:%i %p'"; // 12 hour format for MySQL TIME_FORMAT function. @@ -671,10 +676,10 @@ class ttTimeHelper { " TIME_FORMAT(sec_to_time(time_to_sec(l.start) + time_to_sec(l.duration)), $sql_time_format) as finish,". " TIME_FORMAT(l.duration, '%k:%i') as duration,". " p.name as project_name, t.name as task_name, l.comment, l.client_id, l.project_id, l.task_id,". - " l.timesheet_id, l.invoice_id, l.billable, l.paid, l.date from tt_log l". + " l.timesheet_id, l.invoice_id, l.billable, l.approved, l.paid, l.date from tt_log l". " left join tt_projects p on (p.id = l.project_id)". " left join tt_tasks t on (t.id = l.task_id)". - " where l.id = $id and l.user_id = $user_id and l.status = 1"; + " where l.id = $id and l.user_id = $user_id and l.group_id = $group_id and l.org_id = $org_id and l.status = 1"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { if (!$res->numRows()) { @@ -733,7 +738,7 @@ class ttTimeHelper { $sql = "select l.id as id, TIME_FORMAT(l.start, $sql_time_format) as start,". " TIME_FORMAT(sec_to_time(time_to_sec(l.start) + time_to_sec(l.duration)), $sql_time_format) as finish,". " TIME_FORMAT(l.duration, '%k:%i') as duration, p.name as project, t.name as task, l.comment,". - " l.billable, l.timesheet_id, l.invoice_id $client_field from tt_log l $left_joins". + " l.billable, l.approved, l.timesheet_id, l.invoice_id $client_field from tt_log l $left_joins". " where l.date = '$date' and l.user_id = $user_id and l.group_id = $group_id and l.org_id = $org_id and l.status = 1". " order by l.start, l.id"; $res = $mdb2->query($sql);