:100644 100644 cda9fe4... 0000000... M uc_addresses.admin.inc :100644 100644 2e7e043... 0000000... M uc_addresses.module diff --git uc_addresses.admin.inc uc_addresses.admin.inc index cda9fe4..ee94301 100644 --- uc_addresses.admin.inc +++ uc_addresses.admin.inc @@ -42,6 +42,25 @@ function uc_addresses_settings_form() { t('We will automatically fill in the billing address with the user\'s default address.'), t('The customer must enter or choose a billing address.')), ); + $form['user']['uc_addresses_create_from_delivery'] = array( + '#type' => 'checkbox', + '#title' => t('Automatically create new addresses from entered delivery addresses in the checkout.'), + '#default_value' => variable_get('uc_addresses_create_from_delivery', TRUE), + '#summary callback' => 'summarize_checkbox', + '#summary arguments' => array( + t('We will automatically create addresses based on the delivery address entered at checkout.'), + t('Addresses will not be created from entered delivery addresses.')), + ); + $form['user']['uc_addresses_create_from_billing'] = array( + '#type' => 'checkbox', + '#title' => t('Automatically create new addresses from entered billing addresses in the checkout.'), + '#default_value' => variable_get('uc_addresses_create_from_billing', TRUE), + '#summary callback' => 'summarize_checkbox', + '#summary arguments' => array( + t('We will automatically create addresses based on the billing address entered at checkout.'), + t('Addresses will not be created from entered billing addresses.')), + ); + $form['user']['uc_addresses_require_address'] = array( '#type' => 'checkbox', '#title' => t('Require that an address be entered during registration'), diff --git uc_addresses.module uc_addresses.module index 2e7e043..9a3f0fe 100644 --- uc_addresses.module +++ uc_addresses.module @@ -553,7 +553,7 @@ function uc_addresses_uc_checkout_complete($order, $user) { // Add the billing address first. If the user has no addresses, // this is the one that will become the default address - if (variable_get('uc_pane_billing_enabled', TRUE)) { + if (variable_get('uc_pane_billing_enabled', TRUE) && variable_get('uc_addresses_create_from_billing', TRUE)) { $address->address_name = ''; $address->uid = $order->uid; $address->first_name = $order->billing_first_name; @@ -570,7 +570,7 @@ function uc_addresses_uc_checkout_complete($order, $user) { _uc_addresses_db_add_address($address, TRUE); } - if (uc_order_is_shippable($order)) { + if (uc_order_is_shippable($order) && variable_get('uc_addresses_create_from_delivery', TRUE)) { $address->address_name = ''; $address->uid = $order->uid; $address->first_name = $order->delivery_first_name;