Commit c21be87f authored by andyg5000's avatar andyg5000 Committed by rszrama

Issue #1804592 by a.ross, andyg5000, mglaman, czigor, roderik, rooby,...

Issue #1804592 by a.ross, andyg5000, mglaman, czigor, roderik, rooby, torgosPizza, Anybody, GoZ: reload an up to date copy of the order being processed through a checkout form during Ajax related form rebuilds and related scenarios to avoid resaving old revisions.
parent ba8efafc
......@@ -82,6 +82,10 @@ function commerce_checkout_form($form, &$form_state, $order, $checkout_page) {
$form['#attached']['css'][] = drupal_get_path('module', 'commerce_checkout') .'/theme/commerce_checkout.theme.css';
$form['#attached']['js'][] = drupal_get_path('module', 'commerce_checkout') . '/commerce_checkout.js';
// Refresh the order object in case it has been altered outside the checkout
// process so cache_form has a stale version.
$order = commerce_order_load($order->order_id);
$form_state['order'] = $order;
$form_state['checkout_page'] = $checkout_page;
$form_state['account'] = clone($user);
......@@ -114,6 +118,11 @@ function commerce_checkout_form($form, &$form_state, $order, $checkout_page) {
// Generate the pane form.
$pane_form = $callback($form, $form_state, $checkout_pane, $order);
// Refresh the order object in case the checkout pane altered it outside
// of the passed reference.
$order = commerce_order_load($order->order_id);
$form_state['order'] = $order;
// Combine the messages that were created during this pane's validation or
// submit process with any that were created during the pane generation
// and merge them into the session's current messages array.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment