- $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';
-
- // 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, ',');
-
- // 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 = ttTeamHelper::update($user->group_id, array(
- 'name' => $cl_team,
- '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,
- 'plugins' => $plugins,
- 'config' => $config));
- }
- if ($update_result) {
- header('Location: time.php');
+ // Update config.
+ $config->setDefinedValue('show_holidays', $cl_show_holidays);
+ $config->setDefinedValue('punch_mode', $cl_punch_mode);
+ $config->setDefinedValue('allow_overlap', $cl_allow_overlap);
+ $config->setDefinedValue('future_entries', $cl_future_entries);
+ $config->setDefinedValue('uncompleted_indicators', $cl_uncompleted_indicators);
+
+ if ($user->updateGroup(array(
+ 'group_id' => $group_id,
+ 'name' => $cl_group,
+ 'description' => $cl_description,
+ '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,
+ 'config' => $config->getConfig()))) {
+ header('Location: success.php');