function uc_order_select_customer_form in Ubercart 7.3
Same name and namespace in other branches
- 5 uc_order/uc_order.module \uc_order_select_customer_form()
- 6.2 uc_order/uc_order.admin.inc \uc_order_select_customer_form()
Form to choose a customer from a list.
See also
1 string reference to 'uc_order_select_customer_form'
- uc_order_select_customer in uc_order/
uc_order.admin.inc - Presents the customer search results and let one of them be chosen.
File
- uc_order/
uc_order.admin.inc, line 773 - Order administration menu items.
Code
function uc_order_select_customer_form($form, &$form_state, $options = NULL) {
if (is_null(arg(4))) {
$form['desc'] = array(
'#markup' => '<div>' . t('Search for a customer based on these fields.') . '<br />' . t('Use * as a wildcard to match any character.') . '<br />' . '(<em>' . t('Leave a field empty to ignore it in the search.') . '</em>)</div>',
);
$form['first_name'] = array(
'#type' => 'textfield',
'#title' => t('First name'),
'#size' => 24,
'#maxlength' => 32,
);
$form['last_name'] = array(
'#type' => 'textfield',
'#title' => t('Last name'),
'#size' => 24,
'#maxlength' => 32,
);
$form['email'] = array(
'#type' => 'textfield',
'#title' => t('E-mail'),
'#size' => 24,
'#maxlength' => 96,
);
}
elseif (arg(4) == 'search' && !is_null($options)) {
$form['cust_select'] = array(
'#type' => 'select',
'#title' => t('Select a customer'),
'#size' => 7,
'#options' => $options,
'#default_value' => key($options),
'#attributes' => array(
'ondblclick' => 'return select_customer_search();',
),
);
}
elseif (arg(4) == 'new') {
$form['desc'] = array(
'#markup' => '<div>' . t('Enter an e-mail address for the new customer.') . '</div>',
);
$form['email'] = array(
'#type' => 'textfield',
'#title' => t('E-mail'),
'#size' => 24,
'#maxlength' => 96,
);
}
$form['actions'] = array(
'#type' => 'actions',
);
if (is_null(arg(4))) {
$form['actions']['search'] = array(
'#type' => 'submit',
'#value' => t('Search'),
'#attributes' => array(
'onclick' => 'return load_customer_search_results();',
),
);
}
elseif (arg(4) == 'search') {
if (!is_null($options)) {
$form['actions']['select'] = array(
'#type' => 'submit',
'#value' => t('Select'),
'#attributes' => array(
'onclick' => 'return select_customer_search();',
),
);
}
$form['actions']['back'] = array(
'#type' => 'submit',
'#value' => t('Back'),
'#attributes' => array(
'onclick' => 'return load_customer_search();',
),
);
}
elseif (arg(4) == 'new') {
$form['sendmail'] = array(
'#type' => 'checkbox',
'#title' => t('E-mail customer account details.'),
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#attributes' => array(
'onclick' => 'return check_new_customer_address();',
),
);
}
$form['actions']['close'] = array(
'#type' => 'submit',
'#value' => t('Close'),
'#attributes' => array(
'onclick' => 'return close_customer_select();',
),
);
return $form;
}