From 9b5a1834db24f25803fc0d461394e4a2bfcc44b7 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sun, 21 Apr 2019 14:10:51 +0000 Subject: [PATCH] Removed unneeded subtotal row on reports, fixed printing of 0 subtotals. --- WEB-INF/lib/ttReportHelper.class.php | 4 ++-- WEB-INF/templates/footer.tpl | 2 +- report.php | 15 +++++++-------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index 5fd22531..966865fb 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -513,7 +513,7 @@ class ttReportHelper { $res = $mdb2->query($sql); if (is_a($res, 'PEAR_Error')) die($res->getMessage()); while ($val = $res->fetchRow()) { - $time = $val['time'] ? ttTimeHelper::minutesToDuration($val['time'] / 60) : null; + $time = ttTimeHelper::minutesToDuration($val['time'] / 60); $rowLabel = ttReportHelper::makeGroupByLabel($val['group_field'], $options); if ($options['show_cost']) { $decimalMark = $user->getDecimalMark(); @@ -595,7 +595,7 @@ class ttReportHelper { if (is_a($res, 'PEAR_Error')) die($res->getMessage()); $val = $res->fetchRow(); - $total_time = $val['time'] ? ttTimeHelper::minutesToDuration($val['time'] / 60) : null; + $total_time = ttTimeHelper::minutesToDuration($val['time'] / 60); if ($options['show_cost']) { $total_cost = $val['cost']; if (!$total_cost) $total_cost = '0.00'; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index e0684a67..4216000f 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.19.1.4964 | Copyright © Anuko | +  Anuko Time Tracker 1.19.1.4965 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/report.php b/report.php index b82380d7..31cee67a 100644 --- a/report.php +++ b/report.php @@ -275,17 +275,16 @@ if ($request->isGet() && $use_checkboxes) if (ttReportHelper::grouping($options)) { $subtotals = ttReportHelper::getSubtotals($options); $smarty->assign('group_by_header', ttReportHelper::makeGroupByHeader($options)); + if ($report_items) { + // Assign variables that are used to print subtotals. + $smarty->assign('print_subtotals', true); + $smarty->assign('first_pass', true); + $smarty->assign('prev_grouped_by', ''); + $smarty->assign('cur_grouped_by', ''); + } } $totals = ttReportHelper::getTotals($options); -// Assign variables that are used to print subtotals. -if ($report_items) { - $smarty->assign('print_subtotals', true); - $smarty->assign('first_pass', true); - $smarty->assign('prev_grouped_by', ''); - $smarty->assign('cur_grouped_by', ''); -} - // Determine column span for note field. $colspan = 1; if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) $colspan++; -- 2.20.1