function uc_order_workflow_form_submit in Ubercart 7.3
Same name and namespace in other branches
- 5 uc_order/uc_order.module \uc_order_workflow_form_submit()
- 6.2 uc_order/uc_order.admin.inc \uc_order_workflow_form_submit()
Form submission handler for uc_order_workflow_form().
See also
File
- uc_order/
uc_order.admin.inc, line 154 - Order administration menu items.
Code
function uc_order_workflow_form_submit($form, &$form_state) {
foreach ($form_state['values']['order_states'] as $key => $value) {
variable_set('uc_state_' . $key . '_default', $value['default']);
}
foreach ($form_state['values']['order_statuses'] as $key => $value) {
if ($value['locked'] != TRUE && $value['remove'] == TRUE) {
db_delete('uc_order_statuses')
->condition('order_status_id', $key)
->execute();
drupal_set_message(t('Order status %status removed.', array(
'%status' => $key,
)));
}
else {
$fields = array(
'title' => $value['title'],
'weight' => $value['weight'],
);
// The state cannot be changed if the status is locked.
if ($value['locked'] == FALSE) {
$fields['state'] = $value['state'];
}
$query = db_update('uc_order_statuses')
->fields($fields)
->condition('order_status_id', $key)
->execute();
}
}
drupal_set_message(t('Order workflow information saved.'));
}