From: Nik Okuntseff Date: Mon, 8 Apr 2019 14:02:01 +0000 (+0000) Subject: Fixed union sql for reports with attachments. X-Git-Tag: timetracker_1.19-1~107 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3b73ad719677dcb639befd1788f8f9d1ee6485cf;p=timetracker.git Fixed union sql for reports with attachments. --- diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index 74f2537f..40b6a047 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -360,6 +360,9 @@ class ttReportHelper { array_push($fields, 'i.name as invoice'); if ($options['show_timesheet']) array_push($fields, 'null as timesheet_name'); + // Add has_files. + if ($options['show_files']) + array_push($fields, 'if(Sub1.entity_id is null, 0, 1) as has_files'); // Prepare sql query part for left joins. $left_joins = null; @@ -371,6 +374,11 @@ class ttReportHelper { $left_joins .= " left join tt_projects p on (p.id = ei.project_id)"; if (($canViewReports || $isClient) && $options['show_invoice']) $left_joins .= " left join tt_invoices i on (i.id = ei.invoice_id and i.status = 1)"; + if ($options['show_files']) { + $left_joins .= " left join (select distinct entity_id from tt_files". + " where entity_type = 'expense' and group_id = $group_id and org_id = $org_id and status = 1) Sub1". + " on (ei.id = Sub1.entity_id)"; + } $where = ttReportHelper::getExpenseWhere($options); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 65f8389e..9e50a852 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.64.4927 | Copyright © Anuko | +  Anuko Time Tracker 1.18.64.4928 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve}