From 6b65ed469a258f8ece8bafa26379fdf546c23bc7 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sun, 4 Nov 2018 12:13:01 +0000 Subject: [PATCH] Fixed ttReportHelper::groupingBy function. --- WEB-INF/lib/ttReportHelper.class.php | 20 +++++++++----------- WEB-INF/templates/footer.tpl | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index 3a6a0960..d1de3af8 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -128,14 +128,14 @@ class ttReportHelper { $isClient = $user->isClient(); $grouping = ttReportHelper::grouping($options); - $grouping_by_date = ($options['group_by1'] == 'date'|| $options['group_by2'] == 'date' || $options['group_by3'] == 'date'); - $grouping_by_client = ($options['group_by1'] == 'client'|| $options['group_by2'] == 'client' || $options['group_by3'] == 'client'); - $grouping_by_project = ($options['group_by1'] == 'project'|| $options['group_by2'] == 'project' || $options['group_by3'] == 'project'); - $grouping_by_task = ($options['group_by1'] == 'task'|| $options['group_by2'] == 'task' || $options['group_by3'] == 'task'); - $grouping_by_user = ($options['group_by1'] == 'user'|| $options['group_by2'] == 'user' || $options['group_by3'] == 'user'); - $grouping_by_cf_1 = ($options['group_by1'] == 'cf_1'|| $options['group_by2'] == 'cf_1' || $options['group_by3'] == 'cf_1'); - - $group_by_option = $options['group_by1']; + if ($grouping) { + $grouping_by_date = ttReportHelper::groupingBy('date', $options); + $grouping_by_client = ttReportHelper::groupingBy('client', $options); + $grouping_by_project = ttReportHelper::groupingBy('project', $options); + $grouping_by_task = ttReportHelper::groupingBy('task', $options); + $grouping_by_user = ttReportHelper::groupingBy('user', $options); + $grouping_by_cf_1 = ttReportHelper::groupingBy('cf_1', $options); + } $convertTo12Hour = ('%I:%M %p' == $user->time_format) && ($options['show_start'] || $options['show_end']); // Prepare a query for time items in tt_log table. @@ -1540,9 +1540,7 @@ class ttReportHelper { // ('user', 'project', etc.) by checking group_by1, group_by2, and group_by3 // values passed in $options. static function groupingBy($what, $options) { - $grouping = ($options['group_by1'] != null && $options['group_by1'] != $what) || - ($options['group_by2'] != null && $options['group_by2'] != $what) || - ($options['group_by3'] != null && $options['group_by3'] != $what); + $grouping = ($options['group_by1'] == $what) || ($options['group_by2'] == $what) || ($options['group_by3'] == $what); return $grouping; } diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 438d7d5c..e2210033 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.06.4355 | Copyright © Anuko | +  Anuko Time Tracker 1.18.07.4356 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1