From: Nik Okuntseff Date: Sat, 1 Dec 2018 18:58:57 +0000 (+0000) Subject: More refactoring for subgroups. X-Git-Tag: timetracker_1.19-1~506 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=38b85fc251ea53e5d5842e25c8fc9b066a474a54;p=timetracker.git More refactoring for subgroups. --- diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index 08c52f45..44f3d7a0 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -400,27 +400,6 @@ class ttTeamHelper { return $result; } - // The getInactiveClients returns an array of inactive clients for a group. - static function getInactiveClients($group_id, $all_fields = false) - { - $result = array(); - $mdb2 = getConnection(); - - if ($all_fields) - $sql = "select * from tt_clients where group_id = $group_id and status = 0 order by upper(name)"; - else - $sql = "select id, name from tt_clients where group_id = $group_id and status = 0 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 b11d78eb..501e850d 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.29.4559 | Copyright © Anuko | +  Anuko Time Tracker 1.18.29.4560 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/expense_edit.php b/expense_edit.php index 9768fa23..80f861c8 100644 --- a/expense_edit.php +++ b/expense_edit.php @@ -29,6 +29,7 @@ require_once('initialize.php'); import('form.Form'); import('ttTeamHelper'); +import('ttGroupHelper'); import('DateAndTime'); import('ttExpenseHelper'); @@ -77,7 +78,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', @@ -102,7 +103,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/expenses.php b/expenses.php index aa0d9776..1ff638fb 100644 --- a/expenses.php +++ b/expenses.php @@ -30,6 +30,7 @@ require_once('initialize.php'); import('form.Form'); import('ttUserHelper'); import('ttTeamHelper'); +import('ttGroupHelper'); import('DateAndTime'); import('ttExpenseHelper'); @@ -92,7 +93,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', @@ -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/invoice_add.php b/invoice_add.php index 61568e2a..0cda1a38 100644 --- a/invoice_add.php +++ b/invoice_add.php @@ -29,6 +29,7 @@ require_once('initialize.php'); import('form.Form'); import('ttTeamHelper'); +import('ttGroupHelper'); import('ttInvoiceHelper'); // Access checks. @@ -56,7 +57,7 @@ $form->addInput(array('type'=>'datefield','name'=>'date','size'=>'20','value'=>$ // Dropdown for clients if the clients plugin is enabled. if ($user->isPluginEnabled('cl')) { - $clients = ttTeamHelper::getActiveClients($user->group_id); + $clients = ttGroupHelper::getActiveClients(); $form->addInput(array('type'=>'combobox','name'=>'client','style'=>'width: 250px;','data'=>$clients,'datakeys'=>array('id','name'),'value'=>$cl_client,'empty'=>array(''=>$i18n->get('dropdown.select')))); } // Dropdown for projects. diff --git a/mobile/clients.php b/mobile/clients.php index 61cc304e..d1e6b38f 100644 --- a/mobile/clients.php +++ b/mobile/clients.php @@ -28,7 +28,7 @@ require_once('../initialize.php'); import('form.Form'); -import('ttTeamHelper'); +import('ttGroupHelper'); // Access checks. if (!(ttAccessAllowed('view_own_clients') || ttAccessAllowed('manage_clients'))) { @@ -42,8 +42,8 @@ if (!$user->isPluginEnabled('cl')) { // End of access checks. if($user->can('manage_clients')) { - $active_clients = ttTeamHelper::getActiveClients($user->group_id, true); - $inactive_clients = ttTeamHelper::getInactiveClients($user->group_id, true); + $active_clients = ttGroupHelper::getActiveClients(true); + $inactive_clients = ttGroupHelper::getInactiveClients(true); } else $active_clients = $user->getAssignedClients();