From f32f30fa61a2937ea1bda8b28b748c854b997f15 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sat, 8 Dec 2018 15:12:26 +0000 Subject: [PATCH] Starting refactoring ttFavReportHelper class for subgroups. --- WEB-INF/lib/ttFavReportHelper.class.php | 10 ++++++++-- WEB-INF/templates/footer.tpl | 2 +- notification_add.php | 2 +- notification_edit.php | 2 +- reports.php | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/WEB-INF/lib/ttFavReportHelper.class.php b/WEB-INF/lib/ttFavReportHelper.class.php index 36600e21..3625c9de 100644 --- a/WEB-INF/lib/ttFavReportHelper.class.php +++ b/WEB-INF/lib/ttFavReportHelper.class.php @@ -32,11 +32,17 @@ import('ttTeamHelper'); class ttFavReportHelper { // getReports - returns an array of favorite reports for user. - static function getReports($user_id) { + static function getReports() { + global $user; $mdb2 = getConnection(); + $user_id = $user->getUser(); + $group_id = $user->getGroup(); + $org_id = $user->org_id; + $result = array(); - $sql = "select * from tt_fav_reports where user_id = $user_id and status = 1"; + $sql = "select * from tt_fav_reports". + " where user_id = $user_id and group_id = $group_id and org_id = $org_id and status = 1"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { while ($val = $res->fetchRow()) { diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 9c086022..8e93961a 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.29.4611 | Copyright © Anuko | +  Anuko Time Tracker 1.18.29.4612 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/notification_add.php b/notification_add.php index f1221117..e7f541bb 100644 --- a/notification_add.php +++ b/notification_add.php @@ -57,7 +57,7 @@ if ($request->isPost()) { } // End of access checks. -$fav_reports = ttFavReportHelper::getReports($user->getUser()); +$fav_reports = ttFavReportHelper::getReports(); if ($request->isPost()) { $cl_cron_spec = trim($request->getParameter('cron_spec')); diff --git a/notification_edit.php b/notification_edit.php index de09f75e..5755e95c 100644 --- a/notification_edit.php +++ b/notification_edit.php @@ -63,7 +63,7 @@ if ($request->isPost()) { } // End of access checks. -$fav_reports = ttFavReportHelper::getReports($user->getUser()); +$fav_reports = ttFavReportHelper::getReports(); if ($request->isPost()) { $cl_cron_spec = trim($request->getParameter('cron_spec')); diff --git a/reports.php b/reports.php index 8310f5dd..e617285c 100644 --- a/reports.php +++ b/reports.php @@ -53,7 +53,7 @@ if ($user->isPluginEnabled('cf')) { $form = new Form('reportForm'); // Get saved favorite reports for user. -$report_list = ttFavReportHelper::getReports($user->id); +$report_list = ttFavReportHelper::getReports(); $form->addInput(array('type'=>'combobox', 'name'=>'favorite_report', 'onchange'=>'document.reportForm.fav_report_changed.value=1;document.reportForm.submit();', -- 2.20.1