From a2d35bc3c1d0dbdd5e802bd51b134e1756eec9f5 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sun, 14 Apr 2019 18:46:48 +0000 Subject: [PATCH] Adjusted PDF reports to honor note on separate row option. --- WEB-INF/templates/footer.tpl | 2 +- topdf.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index d67cd7b4..62e02560 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- '; } if ($bean->getAttribute('chduration')) { $colspan++; $html .= "'; } if ($bean->getAttribute('chunits')) { $colspan++; $html .= "'; } + if ($show_note_column) { $colspan++; $html .= ''; } if ($bean->getAttribute('chcost')) { $colspan++; $html .= "'; } if ($bean->getAttribute('chapproved')) { $colspan++; $html .= "'; } if ($bean->getAttribute('chpaid')) { $colspan++; $html .= "'; } @@ -200,6 +206,7 @@ if ($totals_only) { if ($bean->getAttribute('chfinish')) $html .= ''; if ($bean->getAttribute('chduration')) $html .= "'; if ($bean->getAttribute('chunits')) $html .= "'; + if ($show_note_column) $html .= ''; if ($bean->getAttribute('chcost')) { $html .= "'; if ($bean->getAttribute('chduration')) $html .= "'; if ($bean->getAttribute('chunits')) $html .= "'; + if ($show_note_column) $html .= ''; if ($bean->getAttribute('chcost')) { $html .= "'; $html .= ''; - if ($bean->getAttribute('chnote') && $item['note']) { + if ($show_note_row && $item['note']) { $html .= ''; $html .= "'; $noteSpan = $colspan-1; @@ -312,6 +320,7 @@ if ($totals_only) { if ($bean->getAttribute('chfinish')) $html .= ''; if ($bean->getAttribute('chduration')) $html .= "'; if ($bean->getAttribute('chunits')) $html .= "'; + if ($show_note_column) $html .= ''; if ($bean->getAttribute('chcost')) { $html .= "'; if ($bean->getAttribute('chduration')) $html .= "'; if ($bean->getAttribute('chunits')) $html .= "'; + if ($show_note_column) $html .= ''; if ($bean->getAttribute('chcost')) { $html .= "
 Anuko Time Tracker 1.18.65.4938 | Copyright © Anuko | +  Anuko Time Tracker 1.18.65.4939 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/topdf.php b/topdf.php index 7d7a7f9d..e50a89f9 100644 --- a/topdf.php +++ b/topdf.php @@ -31,6 +31,7 @@ * If installed, it is expected to be in WEB-INF/lib/tcpdf/ folder. */ require_once('initialize.php'); +import('ttReportHelper'); import('form.Form'); import('form.ActionForm'); import('ttReportHelper'); @@ -58,6 +59,10 @@ if ($user->isPluginEnabled('cf')) { // Report settings are stored in session bean before we get here. $bean = new ActionForm('reportBean', new Form('reportForm'), $request); +$config = new ttConfigHelper($user->getConfig()); +$show_note_column = $bean->getAttribute('chnote') && !$config->getDefinedValue('report_note_on_separate_row'); +$show_note_row = $bean->getAttribute('chnote') && $config->getDefinedValue('report_note_on_separate_row'); + // There are 2 variations of report: totals only, or normal. Totals only means that the report // is grouped by either date, user, client, project, task or cf_1 and user only needs to see subtotals by group. $totals_only = ($bean->getAttribute('chtotalsonly') == '1'); @@ -154,6 +159,7 @@ if ($totals_only) { if ($bean->getAttribute('chfinish')) { $colspan++; $html .= "".$i18n->get('label.finish').'".$i18n->get('label.duration').'".$i18n->get('label.work_units_short').''.$i18n->get('label.note').'".$i18n->get('label.cost').'".$i18n->get('label.approved').'".$i18n->get('label.paid').'".$subtotals[$prev_grouped_by]['time'].'".$subtotals[$prev_grouped_by]['units'].'"; if ($user->can('manage_invoices') || $user->isClient()) @@ -240,6 +247,7 @@ if ($totals_only) { if ($bean->getAttribute('chfinish')) $html .= "".$item['finish'].'".$item['duration'].'".$item['units'].''.htmlspecialchars($item['note']).'"; if ($user->can('manage_invoices') || $user->isClient()) @@ -267,7 +275,7 @@ if ($totals_only) { if ($bean->getAttribute('chtimesheet')) $html .= ''.htmlspecialchars($item['timesheet_name']).'
".$i18n->get('label.note').'".$subtotals[$prev_grouped_by]['time'].'".$subtotals[$prev_grouped_by]['units'].'"; if ($user->can('manage_invoices') || $user->isClient()) @@ -341,6 +350,7 @@ if ($totals_only) { if ($bean->getAttribute('chfinish')) $html .= '".$totals['time'].'".$totals['units'].'".htmlspecialchars($user->currency).' '; if ($user->can('manage_invoices') || $user->isClient()) -- 2.20.1