diff --git a/modules/customer/commerce_customer.module b/modules/customer/commerce_customer.module index c4c08c4..5565d58 100644 --- a/modules/customer/commerce_customer.module +++ b/modules/customer/commerce_customer.module @@ -1346,9 +1346,11 @@ function commerce_customer_profile_copy_validate($element, &$form_state, $form) commerce_order_save($form_state['order']); // Unset any cached addressfield data for this customer profile. - foreach ($form_state['addressfield'] as $key => $value) { - if (strpos($key, 'commerce_customer_profile|' . $type) === 0) { - unset($form_state['addressfield'][$key]); + if (isset($form_state['addressfield'])) { + foreach ($form_state['addressfield'] as $key => $value) { + if (strpos($key, 'commerce_customer_profile|' . $type) === 0) { + unset($form_state['addressfield'][$key]); + } } } } @@ -1390,6 +1392,10 @@ function commerce_customer_profile_copy_fields($info, &$target, $source, &$form_ $form_state['order']->data['profile_copy'][$pane_id]['elements'][$field_name][$langcode][$delta] = TRUE; } } + else { + $target[$field_name][$langcode] = $items; + $form_state['order']->data['profile_copy'][$pane_id]['elements'][$field_name][$langcode] = TRUE; + } } } } diff --git a/modules/customer/includes/commerce_customer.checkout_pane.inc b/modules/customer/includes/commerce_customer.checkout_pane.inc index 2fa8fbc..f690591 100644 --- a/modules/customer/includes/commerce_customer.checkout_pane.inc +++ b/modules/customer/includes/commerce_customer.checkout_pane.inc @@ -152,8 +152,13 @@ function commerce_customer_profile_pane_checkout_form($form, &$form_state, $chec if (!empty($order->data['profile_copy'][$checkout_pane['pane_id']]['status']) && isset($order->data['profile_copy'][$checkout_pane['pane_id']]['elements'])) { foreach ($order->data['profile_copy'][$checkout_pane['pane_id']]['elements'] as $field_name => $field) { foreach ($field as $langcode => $items) { - foreach ($items as $delta => $item) { - $pane_form[$field_name][$langcode][$delta]['#access'] = FALSE; + if (is_array($items)) { + foreach ($items as $delta => $item) { + $pane_form[$field_name][$langcode][$delta]['#access'] = FALSE; + } + } + else { + $pane_form[$field_name][$langcode]['#access'] = FALSE; } } }