You are here

function uc_order_status_create_form_validate in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_order/uc_order.module \uc_order_status_create_form_validate()
  2. 6.2 uc_order/uc_order.admin.inc \uc_order_status_create_form_validate()

Ensures the new status id is unique and has no spaces.

See also

uc_order_status_create_form()

uc_order_status_create_form_submit()

File

uc_order/uc_order.admin.inc, line 299
Order administration menu items.

Code

function uc_order_status_create_form_validate($form, &$form_state) {
  $new_status = strtolower(trim($form_state['values']['status_id']));
  if (strpos($new_status, ' ') !== FALSE || $new_status == 'all') {
    form_set_error('status_id', t('You have entered an invalid status ID.'));
  }
  $statuses = uc_order_status_list();
  foreach ($statuses as $status) {
    if ($new_status == $status['id']) {
      form_set_error('status_id', t('This ID is already in use.  Please specify a unique ID.'));
    }
  }
}