-
- $sql = "select l.id as id, l.date as date, 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.id as project_id, p.name as project,
- t.id as task_id, t.name as task, l.comment, l.billable, l.invoice_id $client_field $custom_field_1
- from tt_log l
- $left_joins
- where l.date >= '$start_date' and l.date <= '$end_date' and l.user_id = $user_id and l.status = 1
- order by l.date, p.name, t.name, l.start, l.id";
+ $left_joins .= $fileJoin;
+
+ $sql = "select l.id as id, l.date as date, 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.id as project_id, p.name as project,".
+ " t.id as task_id, t.name as task, l.comment, l.billable, l.invoice_id $client_field $custom_field_1 $filePart".
+ " from tt_log l $left_joins".
+ " where l.date >= '$start_date' and l.date <= '$end_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.date, p.name, t.name, l.start, l.id";