From 81763e3414521856124ea022ab9ef52947da89b2 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sun, 2 Dec 2018 13:13:05 +0000 Subject: [PATCH] A bit more refactoring. --- WEB-INF/lib/ttTeamHelper.class.php | 18 ------------------ WEB-INF/lib/ttUser.class.php | 2 +- WEB-INF/templates/footer.tpl | 2 +- mobile/task_edit.php | 4 ++-- mobile/user_add.php | 2 +- mobile/user_edit.php | 2 +- task_add.php | 4 ++-- task_edit.php | 4 ++-- user_add.php | 2 +- user_edit.php | 2 +- 10 files changed, 12 insertions(+), 30 deletions(-) diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index 67d97b85..e64bd672 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -176,24 +176,6 @@ class ttTeamHelper { return false; } - // getActiveProjects - returns an array of active projects for a group. - static function getActiveProjects($group_id) - { - $result = array(); - $mdb2 = getConnection(); - - $sql = "select id, name, description, tasks from tt_projects - where group_id = $group_id and status = 1 order by upper(name)"; - $res = $mdb2->query($sql); - $result = array(); - if (!is_a($res, 'PEAR_Error')) { - while ($val = $res->fetchRow()) { - $result[] = $val; - } - } - return $result; - } - // The getAllProjects obtains all projects in a group. static function getAllProjects($group_id, $all_fields = false) { $mdb2 = getConnection(); diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 73393c0a..587ca73c 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -746,7 +746,7 @@ class ttUser { $user_part .= ' '.$i18n->get('label.on_behalf').' '.htmlspecialchars($this->behalf_name).''; } if ($this->behalf_group_id) { - $user_part .= ', '.$i18n->get('label.on_behalf').' '.htmlspecialchars($this->behalf_group_name).''; + $user_part .= ', '.htmlspecialchars($this->behalf_group_name).''; } else { if ($this->group_name) // Note: we did not require group names in the past. $user_part .= ', '.$this->group_name; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 5c66c159..91ff8c9f 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.29.4565 | Copyright © Anuko | +  Anuko Time Tracker 1.18.29.4566 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/mobile/task_edit.php b/mobile/task_edit.php index ba36ea56..facf18c6 100644 --- a/mobile/task_edit.php +++ b/mobile/task_edit.php @@ -28,7 +28,7 @@ require_once('../initialize.php'); import('form.Form'); -import('ttTeamHelper'); +import('ttGroupHelper'); import('ttTaskHelper'); // Access checks. @@ -48,7 +48,7 @@ if (!$task) { } // End of access checks. -$projects = ttTeamHelper::getActiveProjects($user->group_id); +$projects = ttGroupHelper::getActiveProjects(); if ($request->isPost()) { $cl_name = trim($request->getParameter('name')); diff --git a/mobile/user_add.php b/mobile/user_add.php index 20c2b1ff..fbd82835 100644 --- a/mobile/user_add.php +++ b/mobile/user_add.php @@ -90,7 +90,7 @@ if ($user->isPluginEnabled('cl')) $form->addInput(array('type'=>'floatfield','maxlength'=>'10','name'=>'rate','format'=>'.2','value'=>$cl_rate)); -$projects = ttTeamHelper::getActiveProjects($user->group_id); +$projects = ttGroupHelper::getActiveProjects(); // Define classes for the projects table. class NameCellRenderer extends DefaultCellRenderer { diff --git a/mobile/user_edit.php b/mobile/user_edit.php index 81947dbd..df184fcf 100644 --- a/mobile/user_edit.php +++ b/mobile/user_edit.php @@ -51,7 +51,7 @@ if (!$user_details) { if ($user->isPluginEnabled('cl')) $clients = ttGroupHelper::getActiveClients(); -$projects = ttTeamHelper::getActiveProjects($user->group_id); +$projects = ttGroupHelper::getActiveProjects(); $assigned_projects = array(); if ($request->isPost()) { diff --git a/task_add.php b/task_add.php index 1fdc7b18..078bd5ca 100644 --- a/task_add.php +++ b/task_add.php @@ -29,7 +29,7 @@ require_once('initialize.php'); import('form.Form'); import('form.ActionForm'); -import('ttTeamHelper'); +import('ttGroupHelper'); import('ttTaskHelper'); // Access checks. @@ -43,7 +43,7 @@ if (MODE_PROJECTS_AND_TASKS != $user->getTrackingMode()) { } // End of access checks. -$projects = ttTeamHelper::getActiveProjects($user->getGroup()); +$projects = ttGroupHelper::getActiveProjects(); if ($request->isPost()) { $cl_name = trim($request->getParameter('name')); diff --git a/task_edit.php b/task_edit.php index efe8509d..10410c4b 100644 --- a/task_edit.php +++ b/task_edit.php @@ -28,7 +28,7 @@ require_once('initialize.php'); import('form.Form'); -import('ttTeamHelper'); +import('ttGroupHelper'); import('ttTaskHelper'); // Access checks. @@ -48,7 +48,7 @@ if (!$task) { } // End of access checks. -$projects = ttTeamHelper::getActiveProjects($user->getGroup()); +$projects = ttGroupHelper::getActiveProjects(); if ($request->isPost()) { $cl_name = trim($request->getParameter('name')); diff --git a/user_add.php b/user_add.php index e948aa71..8a507e9e 100644 --- a/user_add.php +++ b/user_add.php @@ -91,7 +91,7 @@ if ($user->isPluginEnabled('cl')) $form->addInput(array('type'=>'floatfield','maxlength'=>'10','name'=>'rate','format'=>'.2','value'=>$cl_rate)); -$projects = ttTeamHelper::getActiveProjects($user->getGroup()); +$projects = ttGroupHelper::getActiveProjects(); // Define classes for the projects table. class NameCellRenderer extends DefaultCellRenderer { diff --git a/user_edit.php b/user_edit.php index df3ada4f..531d2efe 100644 --- a/user_edit.php +++ b/user_edit.php @@ -52,7 +52,7 @@ if (!$user_details) { if ($user->isPluginEnabled('cl')) $clients = ttGroupHelper::getActiveClients(); -$projects = ttTeamHelper::getActiveProjects($user->getGroup()); +$projects = ttGroupHelper::getActiveProjects(); $assigned_projects = array(); if ($request->isPost()) { -- 2.20.1