From a4ecfaf39d301762cb6332da5d72978b60846092 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Fri, 21 Dec 2018 16:27:20 +0000 Subject: [PATCH] Added quota percent on mobile user edit page. --- WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/mobile/user_edit.tpl | 8 +++++++- mobile/user_edit.php | 19 ++++++++++++++++--- user_edit.php | 4 ++-- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 17042163..d68b7cb6 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- -{if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)} +{if $show_quota} + + + + +{/if} +{if $show_projects} diff --git a/mobile/user_edit.php b/mobile/user_edit.php index df184fcf..d79a1f27 100644 --- a/mobile/user_edit.php +++ b/mobile/user_edit.php @@ -48,10 +48,15 @@ if (!$user_details) { } // End of access checks. +$show_quota = $user->isPluginEnabled('mq'); if ($user->isPluginEnabled('cl')) $clients = ttGroupHelper::getActiveClients(); -$projects = ttGroupHelper::getActiveProjects(); +$show_projects = MODE_PROJECTS == $user->getTrackingMode() || MODE_PROJECTS_AND_TASKS == $user->getTrackingMode(); +if ($show_projects) { + $projects = ttGroupHelper::getActiveProjects(); + if (count($projects) == 0) $show_projects = false; +} $assigned_projects = array(); if ($request->isPost()) { @@ -66,6 +71,7 @@ if ($request->isPost()) { $cl_client_id = $request->getParameter('client'); $cl_status = $request->getParameter('status'); $cl_rate = $request->getParameter('rate'); + $cl_quota_percent = $request->getParameter('quota_percent'); $cl_projects = $request->getParameter('projects'); if (is_array($cl_projects)) { foreach ($cl_projects as $p) { @@ -82,7 +88,8 @@ if ($request->isPost()) { $cl_name = $user_details['name']; $cl_login = $user_details['login']; $cl_email = $user_details['email']; - $cl_rate = str_replace('.', $user->decimal_mark, $user_details['rate']); + $cl_rate = str_replace('.', $user->getDecimalMark(), $user_details['rate']); + $cl_quota_percent = str_replace('.', $user->getDecimalMark(), $user_details['quota_percent']); $cl_role_id = $user_details['role_id']; $cl_client_id = $user_details['client_id']; $cl_status = $user_details['status']; @@ -110,6 +117,8 @@ if ($user->isPluginEnabled('cl')) $form->addInput(array('type'=>'combobox','name'=>'status','value'=>$cl_status, 'data'=>array(ACTIVE=>$i18n->get('dropdown.status_active'),INACTIVE=>$i18n->get('dropdown.status_inactive')))); $form->addInput(array('type'=>'floatfield','maxlength'=>'10','name'=>'rate','format'=>'.2','value'=>$cl_rate)); +if ($show_quota) + $form->addInput(array('type'=>'floatfield','maxlength'=>'10','name'=>'quota_percent','format'=>'.2','value'=>$cl_quota_percent)); // Define classes for the projects table. class NameCellRenderer extends DefaultCellRenderer { @@ -162,7 +171,8 @@ if ($request->isPost()) { } if (!ttValidEmail($cl_email, true)) $err->add($i18n->get('error.field'), $i18n->get('label.email')); if (!ttValidFloat($cl_rate, true)) $err->add($i18n->get('error.field'), $i18n->get('form.users.default_rate')); - + if (!ttValidFloat($cl_quota_percent, true)) $err->add($i18n->get('error.field'), $i18n->get('form.quota.quota')); + if ($err->no()) { $existing_user = ttUserHelper::getUserByLogin($cl_login); if (!$existing_user || ($user_id == $existing_user['id'])) { @@ -174,6 +184,7 @@ if ($request->isPost()) { 'email' => $cl_email, 'status' => $cl_status, 'rate' => $cl_rate, + 'quota_percent' => $cl_quota_percent, 'projects' => $assigned_projects); if (in_array('manage_users', $user->rights)) { $fields['role_id'] = $cl_role_id; @@ -226,6 +237,8 @@ $smarty->assign('auth_external', $auth->isPasswordExternal()); $smarty->assign('active_roles', $active_roles); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="document.userForm.name.focus();handleClientControl();"'); +$smarty->assign('show_quota', $show_quota); +$smarty->assign('show_projects', $show_projects); $smarty->assign('user_id', $user_id); $smarty->assign('title', $i18n->get('title.edit_user')); $smarty->assign('content_page_name', 'mobile/user_edit.tpl'); diff --git a/user_edit.php b/user_edit.php index c3910db3..af6180a3 100644 --- a/user_edit.php +++ b/user_edit.php @@ -239,10 +239,10 @@ $smarty->assign('rates', $rates); $smarty->assign('auth_external', $auth->isPasswordExternal()); $smarty->assign('active_roles', $active_roles); $smarty->assign('can_swap', $can_swap); -$smarty->assign('show_quota', $show_quota); -$smarty->assign('show_projects', $show_projects); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="document.userForm.name.focus();handleClientControl();"'); +$smarty->assign('show_quota', $show_quota); +$smarty->assign('show_projects', $show_projects); $smarty->assign('user_id', $user_id); $smarty->assign('title', $i18n->get('title.edit_user')); $smarty->assign('content_page_name', 'user_edit.tpl'); -- 2.20.1
 Anuko Time Tracker 1.18.34.4676 | Copyright © Anuko | +  Anuko Time Tracker 1.18.34.4677 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/mobile/user_edit.tpl b/WEB-INF/templates/mobile/user_edit.tpl index ecbff599..6c5e12e7 100644 --- a/WEB-INF/templates/mobile/user_edit.tpl +++ b/WEB-INF/templates/mobile/user_edit.tpl @@ -109,7 +109,13 @@ function handleClientControl() { {$i18n.form.users.default_rate} (0{$user->decimal_mark}00): {$forms.userForm.rate.control}
{$i18n.form.quota.quota} (%):{$forms.userForm.quota_percent.control}
{$i18n.label.projects}: {$forms.userForm.projects.control}