function uc_cart_checkout_review_form_submit in Ubercart 6.2
Same name and namespace in other branches
- 5 uc_cart/uc_cart.module \uc_cart_checkout_review_form_submit()
- 7.3 uc_cart/uc_cart.pages.inc \uc_cart_checkout_review_form_submit()
Final checks to make sure the order can be completed.
See also
uc_cart_checkout_review_form()
File
- uc_cart/
uc_cart.pages.inc, line 503 - Cart menu items.
Code
function uc_cart_checkout_review_form_submit($form, &$form_state) {
// 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_list() as $module) {
$function = $module . '_order';
if (function_exists($function)) {
// $order must be passed by reference.
$result = $function('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;
$form_state['redirect'] = 'cart/checkout/review';
}
else {
$_SESSION['do_complete'] = TRUE;
$form_state['redirect'] = 'cart/checkout/complete';
}
}