From: Nik Okuntseff Date: Sat, 1 Dec 2018 20:20:08 +0000 (+0000) Subject: More refactoring for subgroups. X-Git-Tag: timetracker_1.19-1~505 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1bebedf4f6025a06d5c738a82ef057d2d0200eac;p=timetracker.git More refactoring for subgroups. --- diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index 44f3d7a0..f82fc263 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -379,27 +379,6 @@ class ttTeamHelper { return $result; } - // The getActiveClients returns an array of active clients for a group. - static function getActiveClients($group_id, $all_fields = false) - { - $result = array(); - $mdb2 = getConnection(); - - if ($all_fields) - $sql = "select * from tt_clients where group_id = $group_id and status = 1 order by upper(name)"; - else - $sql = "select id, name from tt_clients 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 getAllClients obtains all clients in a group. static function getAllClients($group_id, $all_fields = false) { $mdb2 = getConnection(); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 501e850d..7c66412a 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.29.4560 | Copyright © Anuko | +  Anuko Time Tracker 1.18.29.4561 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/mobile/expense_edit.php b/mobile/expense_edit.php index d139530c..fa00b586 100644 --- a/mobile/expense_edit.php +++ b/mobile/expense_edit.php @@ -29,6 +29,7 @@ require_once('../initialize.php'); import('form.Form'); import('ttTeamHelper'); +import('ttGroupHelper'); import('DateAndTime'); import('ttExpenseHelper'); @@ -74,7 +75,7 @@ $form = new Form('expenseItemForm'); // Dropdown for clients in MODE_TIME. Use all active clients. if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); $form->addInput(array('type'=>'combobox', 'onchange'=>'fillProjectDropdown(this.value);', 'name'=>'client', @@ -99,7 +100,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t // Dropdown for clients if the clients plugin is enabled. if ($user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); // We need an array of assigned project ids to do some trimming. foreach($project_list as $project) $projects_assigned_to_user[] = $project['id']; diff --git a/mobile/expenses.php b/mobile/expenses.php index de1e6778..a39bf4a9 100644 --- a/mobile/expenses.php +++ b/mobile/expenses.php @@ -30,6 +30,7 @@ require_once('../initialize.php'); import('form.Form'); import('ttUserHelper'); import('ttTeamHelper'); +import('ttGroupHelper'); import('DateAndTime'); import('ttExpenseHelper'); @@ -96,7 +97,7 @@ if ($user->can('track_expenses')) { // Dropdown for clients in MODE_TIME. Use all active clients. if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); $form->addInput(array('type'=>'combobox', 'onchange'=>'fillProjectDropdown(this.value);', 'name'=>'client', @@ -122,7 +123,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t // Dropdown for clients if the clients plugin is enabled. if ($user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); // We need an array of assigned project ids to do some trimming. foreach($project_list as $project) $projects_assigned_to_user[] = $project['id']; diff --git a/mobile/time.php b/mobile/time.php index 2b8e01f0..c8ec9797 100644 --- a/mobile/time.php +++ b/mobile/time.php @@ -30,6 +30,7 @@ require_once('../initialize.php'); import('form.Form'); import('ttUserHelper'); import('ttTeamHelper'); +import('ttGroupHelper'); import('ttClientHelper'); import('ttTimeHelper'); import('DateAndTime'); @@ -92,7 +93,7 @@ $form = new Form('timeRecordForm'); // Dropdown for clients in MODE_TIME. Use all active clients. if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); $form->addInput(array('type'=>'combobox', 'onchange'=>'fillProjectDropdown(this.value);', 'name'=>'client', @@ -118,7 +119,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t // Dropdown for clients if the clients plugin is enabled. if ($user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); // We need an array of assigned project ids to do some trimming. foreach($project_list as $project) $projects_assigned_to_user[] = $project['id']; diff --git a/mobile/time_edit.php b/mobile/time_edit.php index 92522043..cbe4c935 100644 --- a/mobile/time_edit.php +++ b/mobile/time_edit.php @@ -30,6 +30,7 @@ require_once('../initialize.php'); import('form.Form'); import('ttUserHelper'); import('ttTeamHelper'); +import('ttGroupHelper'); import('ttClientHelper'); import('ttTimeHelper'); import('DateAndTime'); @@ -109,7 +110,7 @@ $form = new Form('timeRecordForm'); // Dropdown for clients in MODE_TIME. Use all active clients. if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); $form->addInput(array('type'=>'combobox', 'onchange'=>'fillProjectDropdown(this.value);', 'name'=>'client', @@ -135,7 +136,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t // Dropdown for clients if the clients plugin is enabled. if ($user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); // We need an array of assigned project ids to do some trimming. foreach($project_list as $project) $projects_assigned_to_user[] = $project['id']; diff --git a/mobile/timer.php b/mobile/timer.php index ae5a96f5..bf92a89e 100644 --- a/mobile/timer.php +++ b/mobile/timer.php @@ -30,6 +30,7 @@ require_once('../initialize.php'); import('form.Form'); import('ttUserHelper'); import('ttTeamHelper'); +import('ttGroupHelper'); import('ttClientHelper'); import('ttTimeHelper'); import('DateAndTime'); @@ -88,7 +89,7 @@ $form = new Form('timeRecordForm'); // Dropdown for clients in MODE_TIME. Use all active clients. if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); $form->addInput(array('type'=>'combobox', 'onchange'=>'fillProjectDropdown(this.value);', 'name'=>'client', @@ -116,7 +117,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t // Dropdown for clients if the clients plugin is enabled. if ($user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); // We need an array of assigned project ids to do some trimming. foreach($project_list as $project) $projects_assigned_to_user[] = $project['id']; diff --git a/mobile/user_add.php b/mobile/user_add.php index 9d2b539e..20c2b1ff 100644 --- a/mobile/user_add.php +++ b/mobile/user_add.php @@ -29,6 +29,7 @@ require_once('../initialize.php'); import('form.Form'); import('ttTeamHelper'); +import('ttGroupHelper'); import('ttUserHelper'); import('form.Table'); import('form.TableColumn'); @@ -45,7 +46,7 @@ if (!ttAccessAllowed('manage_users')) { @include('../plugins/limit/user_add.php'); if ($user->isPluginEnabled('cl')) - $clients = ttTeamHelper::getActiveClients($user->group_id); + $clients = ttGroupHelper::getActiveClients(); $assigned_projects = array(); if ($request->isPost()) { diff --git a/mobile/user_edit.php b/mobile/user_edit.php index c9b4af81..81947dbd 100644 --- a/mobile/user_edit.php +++ b/mobile/user_edit.php @@ -30,6 +30,7 @@ require_once('../initialize.php'); import('form.Form'); import('ttProjectHelper'); import('ttTeamHelper'); +import('ttGroupHelper'); import('ttUserHelper'); import('form.Table'); import('form.TableColumn'); @@ -48,7 +49,7 @@ if (!$user_details) { // End of access checks. if ($user->isPluginEnabled('cl')) - $clients = ttTeamHelper::getActiveClients($user->group_id); + $clients = ttGroupHelper::getActiveClients(); $projects = ttTeamHelper::getActiveProjects($user->group_id); $assigned_projects = array(); diff --git a/time.php b/time.php index ce622b23..fb507fb5 100644 --- a/time.php +++ b/time.php @@ -170,7 +170,7 @@ if ($user->can('track_time')) { // Dropdown for clients in MODE_TIME. Use all active clients. if (MODE_TIME == $user->getTrackingMode() && $user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); $form->addInput(array('type'=>'combobox', 'onchange'=>'fillProjectDropdown(this.value);', 'name'=>'client', @@ -196,7 +196,7 @@ if (MODE_PROJECTS == $user->getTrackingMode() || MODE_PROJECTS_AND_TASKS == $use // Dropdown for clients if the clients plugin is enabled. if ($user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); // We need an array of assigned project ids to do some trimming. foreach($project_list as $project) $projects_assigned_to_user[] = $project['id']; diff --git a/time_edit.php b/time_edit.php index 08a5f392..e6a8adb8 100644 --- a/time_edit.php +++ b/time_edit.php @@ -30,6 +30,7 @@ require_once('initialize.php'); import('form.Form'); import('ttUserHelper'); import('ttTeamHelper'); +import('ttGroupHelper'); import('ttClientHelper'); import('ttTimeHelper'); import('DateAndTime'); @@ -112,7 +113,7 @@ $form = new Form('timeRecordForm'); // Dropdown for clients in MODE_TIME. Use all active clients. if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); $form->addInput(array('type'=>'combobox', 'onchange'=>'fillProjectDropdown(this.value);', 'name'=>'client', @@ -138,7 +139,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t // Dropdown for clients if the clients plugin is enabled. if ($user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); // We need an array of assigned project ids to do some trimming. foreach($project_list as $project) $projects_assigned_to_user[] = $project['id']; diff --git a/user_add.php b/user_add.php index 7fb6ea3c..e948aa71 100644 --- a/user_add.php +++ b/user_add.php @@ -29,6 +29,7 @@ require_once('initialize.php'); import('form.Form'); import('ttTeamHelper'); +import('ttGroupHelper'); import('ttUserHelper'); import('form.Table'); import('form.TableColumn'); @@ -46,7 +47,7 @@ if (!ttAccessAllowed('manage_users')) { @include('plugins/limit/user_add.php'); if ($user->isPluginEnabled('cl')) - $clients = ttTeamHelper::getActiveClients($user->getGroup()); + $clients = ttGroupHelper::getActiveClients(); $assigned_projects = array(); if ($request->isPost()) { diff --git a/user_edit.php b/user_edit.php index 8a4e421b..df3ada4f 100644 --- a/user_edit.php +++ b/user_edit.php @@ -30,6 +30,7 @@ require_once('initialize.php'); import('form.Form'); import('ttProjectHelper'); import('ttTeamHelper'); +import('ttGroupHelper'); import('ttUserHelper'); import('form.Table'); import('form.TableColumn'); @@ -49,7 +50,7 @@ if (!$user_details) { // End of access checks. if ($user->isPluginEnabled('cl')) - $clients = ttTeamHelper::getActiveClients($user->getGroup()); + $clients = ttGroupHelper::getActiveClients(); $projects = ttTeamHelper::getActiveProjects($user->getGroup()); $assigned_projects = array(); diff --git a/week.php b/week.php index 927e8a77..95dc31b1 100644 --- a/week.php +++ b/week.php @@ -33,6 +33,7 @@ import('form.Table'); import('form.TextField'); import('ttUserHelper'); import('ttTeamHelper'); +import('ttGroupHelper'); import('ttWeekViewHelper'); import('ttClientHelper'); import('ttTimeHelper'); @@ -244,7 +245,7 @@ $form->addInputElement($table); // Dropdown for clients in MODE_TIME. Use all active clients. if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); $form->addInput(array('type'=>'combobox', 'onchange'=>'fillProjectDropdown(this.value);', 'name'=>'client', @@ -270,7 +271,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t // Dropdown for clients if the clients plugin is enabled. if ($user->isPluginEnabled('cl')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); // We need an array of assigned project ids to do some trimming. foreach($project_list as $project) $projects_assigned_to_user[] = $project['id'];