From e489a39d1dd1ad0293c45d887433d47b7734979f Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Wed, 19 Dec 2018 18:53:27 +0000 Subject: [PATCH] A fix for work units in totals only report. --- WEB-INF/lib/ttReportHelper.class.php | 7 +++++-- WEB-INF/templates/footer.tpl | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index d46319db..237e39e9 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -471,7 +471,10 @@ class ttReportHelper { // Prepare parts. $time_part = "sum(time_to_sec(l.duration)) as time"; if ($options['show_work_units']) { - $units_part = $user->unit_totals_only ? ", null as units" : ", sum(if(l.billable = 0 or time_to_sec(l.duration)/60 < $user->first_unit_threshold, 0, ceil(time_to_sec(l.duration)/60/$user->minutes_in_unit))) as units"; + $unitTotalsOnly = $user->getConfigOption('unit_totals_only'); + $firstUnitThreshold = $user->getConfigInt('1st_unit_threshold', 0); + $minutesInUnit = $user->getConfigInt('minutes_in_unit', 15); + $units_part = $unitTotalsOnly ? ", null as units" : ", sum(if(l.billable = 0 or time_to_sec(l.duration)/60 < $firstUnitThreshold, 0, ceil(time_to_sec(l.duration)/60/$minutesInUnit))) as units"; } if ($options['show_cost']) { if (MODE_TIME == $user->tracking_mode) @@ -1468,7 +1471,7 @@ class ttReportHelper { $workUnits = $options['show_work_units']; if ($workUnits) { $unitTotalsOnly = $user->getConfigOption('unit_totals_only'); - $firstUnitThreshold = $user->getConfigInt('1st_unit_threshold'); + $firstUnitThreshold = $user->getConfigInt('1st_unit_threshold', 0); $minutesInUnit = $user->getConfigInt('minutes_in_unit', 15); if ($unitTotalsOnly) $work_unit_part = ", if (sum(l.billable * time_to_sec(l.duration)/60) < $firstUnitThreshold, 0, ceil(sum(l.billable * time_to_sec(l.duration)/60/$minutesInUnit))) as units"; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index ee01f47f..295fc064 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.32.4665 | Copyright © Anuko | +  Anuko Time Tracker 1.18.33.4666 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1