From 85d475278111ea1ed81fcd0dd5eef7140d1cd493 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sat, 4 Aug 2018 16:57:45 +0000 Subject: [PATCH] Some more refactoring. --- WEB-INF/lib/ttReportHelper.class.php | 13 +++++-------- WEB-INF/templates/footer.tpl | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index 811312ae..64128275 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -124,7 +124,7 @@ class ttReportHelper { $mdb2 = getConnection(); // Determine these once as they are used in multiple places in this function. - $canViewReports = $user->can('view_reports'); + $canViewReports = $user->can('view_reports') || $user->can('view_all_reports'); $isClient = $user->isClient(); $group_by_option = $options['group_by']; @@ -305,12 +305,9 @@ class ttReportHelper { $sort_part .= 'date'; else $sort_part .= $group_by_option.', date'; - -// TODO: refactoring in progress down from here... The above is identical to getFavItems and is ready to merge. -// Note: this sort part below is different in getFavItems. Need to figure out why and fix properly. - if (($canViewReports || $isClient) && is_array($bean->getAttribute('users')) && 'user' != $group_by_option) + if (($canViewReports || $isClient) && $options['users'] && 'user' != $group_by_option) $sort_part .= ', user, type'; - if ($bean->getAttribute('chstart')) + if ($options['show_start']) $sort_part .= ', unformatted_start'; $sort_part .= ', id'; @@ -399,7 +396,7 @@ class ttReportHelper { $mdb2 = getConnection(); // Determine these once as they are used in multiple places in this function. - $canViewReports = $user->can('view_reports'); + $canViewReports = $user->can('view_reports') || $user->can('view_all_reports'); $isClient = $user->isClient(); $group_by_option = $options['group_by']; @@ -580,7 +577,7 @@ class ttReportHelper { $sort_part .= 'date'; else $sort_part .= $group_by_option.', date'; - if (($canViewReports || $isClient) /*&& is_array($bean->getAttribute('users'))*/ && 'user' != $group_by_option) + if (($canViewReports || $isClient) && $options['users'] && 'user' != $group_by_option) $sort_part .= ', user, type'; if ($options['show_start']) $sort_part .= ', unformatted_start'; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 4d4cdf90..edaf0900 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.97.4311 | Copyright © Anuko | +  Anuko Time Tracker 1.17.97.4312 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1