Starting refactoring ttFavReportHelper class for subgroups.
authorNik Okuntseff <support@anuko.com>
Sat, 8 Dec 2018 15:12:26 +0000 (15:12 +0000)
committerNik Okuntseff <support@anuko.com>
Sat, 8 Dec 2018 15:12:26 +0000 (15:12 +0000)
WEB-INF/lib/ttFavReportHelper.class.php
WEB-INF/templates/footer.tpl
notification_add.php
notification_edit.php
reports.php

index 36600e2..3625c9d 100644 (file)
@@ -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()) {
index 9c08602..8e93961 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.18.29.4611 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.18.29.4612 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index f122111..e7f541b 100644 (file)
@@ -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'));
index de09f75..5755e95 100644 (file)
@@ -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'));
index 8310f5d..e617285 100644 (file)
@@ -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();',