From ad707342d0ab5a7f6fc6ceda9ba3deb408f5ac08 Mon Sep 17 00:00:00 2001 From: anuko Date: Sun, 9 Jul 2017 22:36:17 +0000 Subject: [PATCH] Work in progress on project_required option (incomplete). Also started to integrate some useful stuff from PR #33. --- WEB-INF/lib/ttClientHelper.class.php | 2 +- WEB-INF/lib/ttUser.class.php | 5 ++++- WEB-INF/templates/footer.tpl | 2 +- profile_edit.php | 4 ++++ reports.php | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/WEB-INF/lib/ttClientHelper.class.php b/WEB-INF/lib/ttClientHelper.class.php index 3b7a9cd6..c77dae00 100644 --- a/WEB-INF/lib/ttClientHelper.class.php +++ b/WEB-INF/lib/ttClientHelper.class.php @@ -60,7 +60,7 @@ class ttClientHelper { $mdb2 = getConnection(); $sql = "select id, name from tt_clients - where team_id = $user->team_id and (status = 0 or status = 1) order by name"; + where team_id = $user->team_id and (status = 0 or status = 1) order by upper(name)"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { while ($val = $res->fetchRow()) { diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 3f160ff9..50f27eba 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -42,6 +42,7 @@ class ttUser { var $time_format = null; // Time format. var $week_start = 0; // Week start day. var $tracking_mode = 0; // Tracking mode. + var $project_required = 0; // Whether project selection is required on time entires. var $task_required = 0; // Whether task selection is required on time entires. var $record_type = 0; // Record type (duration vs start and finish, or both). var $uncompleted_indicators = 0; // Uncompleted time entry indicators (show nowhere or on users page). @@ -65,7 +66,8 @@ class ttUser { $sql = "SELECT u.id, u.login, u.name, u.team_id, u.role, u.client_id, u.email, t.name as team_name, t.address, t.currency, t.lang, t.decimal_mark, t.date_format, t.time_format, t.week_start, - t.tracking_mode, t.task_required, t.record_type, t.uncompleted_indicators, t.plugins, t.lock_spec, t.workday_hours, t.custom_logo + t.tracking_mode, t.project_required, t.task_required, t.record_type, t.uncompleted_indicators, + t.plugins, t.lock_spec, t.workday_hours, t.custom_logo FROM tt_users u LEFT JOIN tt_teams t ON (u.team_id = t.id) WHERE "; if ($id) $sql .= "u.id = $id"; @@ -93,6 +95,7 @@ class ttUser { $this->time_format = $val['time_format']; $this->week_start = $val['week_start']; $this->tracking_mode = $val['tracking_mode']; + $this->project_required = $val['project_required']; $this->task_required = $val['task_required']; $this->record_type = $val['record_type']; $this->uncompleted_indicators = $val['uncompleted_indicators']; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index aaf7f18e..24c305eb 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.11.44.3638 | Copyright © Anuko | +  Anuko Time Tracker 1.11.44.3639 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/profile_edit.php b/profile_edit.php index 7c3146a8..11ca2954 100644 --- a/profile_edit.php +++ b/profile_edit.php @@ -59,6 +59,7 @@ if ($request->isPost()) { $cl_custom_format_time = $request->getParameter('format_time'); $cl_start_week = $request->getParameter('start_week'); $cl_tracking_mode = $request->getParameter('tracking_mode'); + $cl_project_required = $request->getParameter('project_required'); $cl_task_required = $request->getParameter('task_required'); $cl_record_type = $request->getParameter('record_type'); $cl_uncompleted_indicators = $request->getParameter('uncompleted_indicators'); @@ -87,6 +88,7 @@ if ($request->isPost()) { $cl_custom_format_time = $user->time_format; $cl_start_week = $user->week_start; $cl_tracking_mode = $user->tracking_mode; + $cl_project_required = $user->project_required; $cl_task_required = $user->task_required; $cl_record_type = $user->record_type; $cl_uncompleted_indicators = $user->uncompleted_indicators; @@ -164,6 +166,7 @@ if ($user->canManageTeam()) { $tracking_mode_options[MODE_PROJECTS] = $i18n->getKey('form.profile.mode_projects'); $tracking_mode_options[MODE_PROJECTS_AND_TASKS] = $i18n->getKey('form.profile.mode_projects_and_tasks'); $form->addInput(array('type'=>'combobox','name'=>'tracking_mode','style'=>'width: 150px;','data'=>$tracking_mode_options,'value'=>$cl_tracking_mode,'onchange'=>'handleTaskRequiredCheckbox()')); + $form->addInput(array('type'=>'checkbox','name'=>'project_required','value'=>$cl_project_required)); $form->addInput(array('type'=>'checkbox','name'=>'task_required','value'=>$cl_task_required)); // Prepare record type choices. @@ -254,6 +257,7 @@ if ($request->isPost()) { 'time_format' => $cl_custom_format_time, 'week_start' => $cl_start_week, 'tracking_mode' => $cl_tracking_mode, + 'project_required' => $cl_project_required, 'task_required' => $cl_task_required, 'record_type' => $cl_record_type, 'uncompleted_indicators' => $cl_uncompleted_indicators, diff --git a/reports.php b/reports.php index 2e9bc26f..08ac64fe 100644 --- a/reports.php +++ b/reports.php @@ -68,7 +68,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getK // Dropdown for clients if the clients plugin is enabled. if ($user->isPluginEnabled('cl') && !($user->isClient() && $user->client_id)) { if ($user->canManageTeam() || ($user->isClient() && !$user->client_id)) - $client_list = ttClientHelper::getClients($user->team_id); + $client_list = ttClientHelper::getClients(); else $client_list = ttClientHelper::getClientsForUser(); $form->addInput(array('type'=>'combobox', -- 2.20.1