function support_admin_client_submit in Support Ticketing System 6
Add/update client information.
File
- ./
support.admin.inc, line 266 - support.admin.inc
Code
function support_admin_client_submit($form, &$form_state) {
$client = new stdClass();
$client->clid = isset($form_state['values']['clid']) ? $form_state['values']['clid'] : 0;
if ($form_state['clicked_button']['#value'] == t('Delete client')) {
if (!empty($client->clid)) {
drupal_goto("admin/support/clients/{$client->clid}/delete");
}
}
else {
$client->name = $form_state['values']['name'];
$client->path = $form_state['values']['path'];
$client->status = $form_state['values']['status'];
$client->parent = $form_state['values']['parent'];
$client->integrate_email = $form_state['values']['integrate_email'];
$client->server_name = $form_state['values']['server_name'];
$client->server_username = $form_state['values']['server_username'];
$client->server_password = $form_state['values']['server_password'];
$client->mailbox = $form_state['values']['mailbox'];
$client->mailfrom = $form_state['values']['mailfrom'];
$client->protocol = $form_state['values']['protocol'];
$client->extra = $form_state['values']['extra'];
$client->port = $form_state['values']['port'];
$client->autoassign = $form_state['values']['autoassign'];
$client->autosubscribe = $form_state['values']['autosubscribe'];
$client->thread_subject = $form_state['values']['thread_subject'];
$client->domains = $form_state['values']['domains'];
$client->user_creation = $form_state['values']['user_creation'];
$client->notes = $form_state['values']['notes'];
if (!empty($client->clid) && db_result(db_query("SELECT 1 FROM {support_client} WHERE clid = %d", $client->clid))) {
support_client_update($client);
}
else {
support_client_create($client);
}
}
// clean page cache and block cache
cache_clear_all();
// rebuild the menu
menu_rebuild();
drupal_goto('admin/support/clients');
}