function uc_order_create_form_create_validate in Ubercart 7.3
Form validation handler for customer search.
See also
1 string reference to 'uc_order_create_form_create_validate'
- uc_order_create_form in uc_order/
uc_order.admin.inc - Creates a new order and redirect to its edit screen.
File
- uc_order/
uc_order.admin.inc, line 532 - Order administration menu items.
Code
function uc_order_create_form_create_validate($form, &$form_state) {
switch ($form_state['values']['customer_type']) {
case 'search':
if (empty($form_state['values']['customer']['uid'])) {
form_set_error('customer][uid', t('Please select a customer.'));
}
break;
case 'create':
$email = trim($form_state['values']['customer']['email']);
if (!valid_email_address($email)) {
form_set_error('customer][mail', t('Invalid e-mail address.'));
}
$uid = db_query('SELECT uid FROM {users} WHERE mail LIKE :mail', array(
':mail' => $email,
))
->fetchField();
if ($uid) {
form_set_error('customer][mail', t('An account already exists for that e-mail.'));
}
break;
}
}