function uc_cart_checkout_review_form_submit in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_cart/uc_cart.pages.inc \uc_cart_checkout_review_form_submit()
- 7.3 uc_cart/uc_cart.pages.inc \uc_cart_checkout_review_form_submit()
File
- uc_cart/
uc_cart.module, line 1673
Code
function uc_cart_checkout_review_form_submit($form_id, $form_values) {
switch ($form_values['op']) {
case t('Back'):
cache_clear_all();
unset($_SESSION['do_review']);
return 'cart/checkout';
case variable_get('uc_checkout_submit_button', t('Submit order')):
// Invoke hook_order($op = 'submit') to test to make sure the order can
// be completed... used for auto payment in uc_credit.module.
$order = uc_order_load($_SESSION['cart_order']);
$error = FALSE;
// Invoke it on a per-module basis instead of all at once.
foreach (module_implements('order') as $module) {
$result = module_invoke($module, 'order', 'submit', $order, NULL);
$msg_type = 'status';
if ($result[0]['pass'] === FALSE) {
$error = TRUE;
$msg_type = 'error';
}
if (!empty($result[0]['message'])) {
drupal_set_message($result[0]['message'], $msg_type);
}
// Stop invoking the hooks if there was an error.
if ($error) {
break;
}
}
if ($error) {
$_SESSION['do_review'] = TRUE;
return 'cart/checkout/review';
}
else {
$_SESSION['do_complete'] = TRUE;
return 'cart/checkout/complete';
}
}
}