function support_admin_settings_validate in Support Ticketing System 6
Same name and namespace in other branches
- 7 support.admin.inc \support_admin_settings_validate()
Be sure valid domains are entered.
File
- ./
support.admin.inc, line 573 - support.admin.inc
Code
function support_admin_settings_validate($form, &$form_state) {
if (!empty($form_state['values']['support_global_domains'])) {
_support_validate_domains('support_global_domains', explode(',', trim($form_state['values']['support_global_domains'])));
}
if (!empty($form_state['values']['support_global_mailfrom']) && !valid_email_address($form_state['values']['support_global_mailfrom'])) {
form_set_error('support_global_mailfrom', t('You must enter a valid email address or leave the default mail from address field blank.'));
}
if (!empty($form_state['values']['support_autoassign_ticket'])) {
$autoassign = $form_state['values']['support_autoassign_ticket'];
switch ($autoassign) {
case '':
case '<nobody>':
case '<creator>':
break;
default:
$account = user_load(array(
'name' => trim($form_state['values']['support_autoassign_ticket']),
));
if (empty($account) || !$account->uid) {
form_set_error('support_autoassign_ticket', t('Invalid %field user, %username is not a valid user.', array(
'%field' => t('auto-assign'),
'%username' => $form_state['values']['support_autoassign_ticket'],
)));
}
else {
if (!user_access('administer support', $account)) {
form_set_error('support_autoassign_ticket', t('Invalid %field user, %username does not have %admin permission.', array(
'%field' => t('auto-assign'),
'%username' => $account->name,
'%admin' => t('administer support'),
)));
}
}
}
}
}