From 6c376fcbe582d3dd0c211aeb8eef20c43850434e Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Tue, 10 Apr 2018 13:52:38 +0000 Subject: [PATCH] Refactored pull request #62. --- WEB-INF/templates/footer.tpl | 2 +- group_edit.php | 131 +++++++++++++++++------------------ 2 files changed, 64 insertions(+), 69 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 27066082..9395bef8 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.87.4244 | Copyright © Anuko | +  Anuko Time Tracker 1.17.87.4245 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/group_edit.php b/group_edit.php index cc27afae..2b876493 100644 --- a/group_edit.php +++ b/group_edit.php @@ -220,78 +220,73 @@ if ($request->isPost()) { // Finished validating user input. if ($err->no()) { - $update_result = true; - if ($user->canManageTeam()) { + // Prepare plugins string. + if ($cl_charts) + $plugins .= ',ch'; + if ($cl_clients) + $plugins .= ',cl'; + if ($cl_client_required) + $plugins .= ',cm'; + if ($cl_invoices) + $plugins .= ',iv'; + if ($cl_paid_status) + $plugins .= ',ps'; + if ($cl_custom_fields) + $plugins .= ',cf'; + if ($cl_expenses) + $plugins .= ',ex'; + if ($cl_tax_expenses) + $plugins .= ',et'; + if ($cl_notifications) + $plugins .= ',no'; + if ($cl_locking) + $plugins .= ',lk'; + if ($cl_quotas) + $plugins .= ',mq'; + if ($cl_week_view) + $plugins .= ',wv'; - // Prepare plugins string. - if ($cl_charts) - $plugins .= ',ch'; - if ($cl_clients) - $plugins .= ',cl'; - if ($cl_client_required) - $plugins .= ',cm'; - if ($cl_invoices) - $plugins .= ',iv'; - if ($cl_paid_status) - $plugins .= ',ps'; - if ($cl_custom_fields) - $plugins .= ',cf'; - if ($cl_expenses) - $plugins .= ',ex'; - if ($cl_tax_expenses) - $plugins .= ',et'; - if ($cl_notifications) - $plugins .= ',no'; - if ($cl_locking) - $plugins .= ',lk'; - if ($cl_quotas) - $plugins .= ',mq'; - if ($cl_week_view) - $plugins .= ',wv'; + // Recycle week view plugin options as they are not configured on this page. + $existing_plugins = explode(',', $user->plugins); + if (in_array('wvn', $existing_plugins)) + $plugins .= ',wvn'; + if (in_array('wvl', $existing_plugins)) + $plugins .= ',wvl'; + if (in_array('wvns', $existing_plugins)) + $plugins .= ',wvns'; - // Recycle week view plugin options as they are not configured on this page. - $existing_plugins = explode(',', $user->plugins); - if (in_array('wvn', $existing_plugins)) - $plugins .= ',wvn'; - if (in_array('wvl', $existing_plugins)) - $plugins .= ',wvl'; - if (in_array('wvns', $existing_plugins)) - $plugins .= ',wvns'; + $plugins = trim($plugins, ','); - $plugins = trim($plugins, ','); + // Prepare config string. + if ($cl_show_holidays) + $config .= ',show_holidays'; + if ($cl_punch_mode) + $config .= ',punch_mode'; + if ($cl_allow_overlap) + $config .= ',allow_overlap'; + if ($cl_future_entries) + $config .= ',future_entries'; + if ($cl_uncompleted_indicators) + $config .= ',uncompleted_indicators'; + $config = trim($config, ','); - // Prepare config string. - if ($cl_show_holidays) - $config .= ',show_holidays'; - if ($cl_punch_mode) - $config .= ',punch_mode'; - if ($cl_allow_overlap) - $config .= ',allow_overlap'; - if ($cl_future_entries) - $config .= ',future_entries'; - if ($cl_uncompleted_indicators) - $config .= ',uncompleted_indicators'; - $config = trim($config, ','); - - $update_result = $user->updateGroup(array( - 'name' => $cl_group, - 'currency' => $cl_currency, - 'lang' => $cl_lang, - 'decimal_mark' => $cl_decimal_mark, - 'date_format' => $cl_date_format, - 'time_format' => $cl_time_format, - '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, - 'bcc_email' => $cl_bcc_email, - 'allow_ip' => $cl_allow_ip, - 'plugins' => $plugins, - 'config' => $config)); - } - if ($update_result) { + if ($user->updateGroup(array( + 'name' => $cl_group, + 'currency' => $cl_currency, + 'lang' => $cl_lang, + 'decimal_mark' => $cl_decimal_mark, + 'date_format' => $cl_date_format, + 'time_format' => $cl_time_format, + '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, + 'bcc_email' => $cl_bcc_email, + 'allow_ip' => $cl_allow_ip, + 'plugins' => $plugins, + 'config' => $config))) { header('Location: time.php'); exit(); } else -- 2.20.1