diff --git a/classes/Hook.php b/classes/Hook.php index 356d7b5b5..6604c73dd 100644 --- a/classes/Hook.php +++ b/classes/Hook.php @@ -326,9 +326,9 @@ class HookCore extends ObjectModel } // For payment modules, we check that they are available in the contextual country elseif ($frontend) { - if (Validate::isLoadedObject($context->country)) { - $sql->where('((h.`name` = "displayPayment" OR h.`name` = "displayPaymentEU") AND (SELECT `id_country` FROM `'._DB_PREFIX_.'module_country` mc WHERE mc.`id_module` = m.`id_module` AND `id_country` = '.(int)$context->country->id.' AND `id_shop` = '.(int)$context->shop->id.' LIMIT 1) = '.(int)$context->country->id.')'); - } + // if (Validate::isLoadedObject($context->country)) { + // $sql->where('((h.`name` = "displayPayment" OR h.`name` = "displayPaymentEU") AND (SELECT `id_country` FROM `'._DB_PREFIX_.'module_country` mc WHERE mc.`id_module` = m.`id_module` AND `id_country` = '.(int)$context->country->id.' AND `id_shop` = '.(int)$context->shop->id.' LIMIT 1) = '.(int)$context->country->id.')'); + // } if (Validate::isLoadedObject($context->currency)) { $sql->where('((h.`name` = "displayPayment" OR h.`name` = "displayPaymentEU") AND (SELECT `id_currency` FROM `'._DB_PREFIX_.'module_currency` mcr WHERE mcr.`id_module` = m.`id_module` AND `id_currency` IN ('.(int)$context->currency->id.', -1, -2) LIMIT 1) IN ('.(int)$context->currency->id.', -1, -2))'); } diff --git a/classes/module/Module.php b/classes/module/Module.php index 3ed023503..431b5a053 100644 --- a/classes/module/Module.php +++ b/classes/module/Module.php @@ -2065,9 +2065,6 @@ abstract class ModuleCore public static function getPaymentModules() { $context = Context::getContext(); - if (Validate::isLoadedObject($context->country)) { - $id_country = (int)$context->country->id; - } $use_groups = Group::isFeatureActive(); @@ -2097,7 +2094,6 @@ abstract class ModuleCore LEFT JOIN `'._DB_PREFIX_.'hook_module` hm ON hm.`id_module` = m.`id_module` LEFT JOIN `'._DB_PREFIX_.'hook` h ON hm.`id_hook` = h.`id_hook` WHERE h.`name` = \''.pSQL($hook_payment).'\' - '.(isset($id_country) && $frontend ? 'AND mc.id_country = '.(int)$id_country : '').' AND (SELECT COUNT(*) FROM '._DB_PREFIX_.'module_shop ms WHERE ms.id_module = m.id_module AND ms.id_shop IN('.implode(', ', $list).')) = '.count($list).' AND hm.id_shop IN('.implode(', ', $list).') '.((count($groups) && $frontend && $use_groups) ? 'AND (mg.`id_group` IN ('.implode(', ', $groups).'))' : '').' diff --git a/controllers/admin/AdminCustomerPreferencesController.php b/controllers/admin/AdminCustomerPreferencesController.php index 00c2a9e68..b6be2b209 100644 --- a/controllers/admin/AdminCustomerPreferencesController.php +++ b/controllers/admin/AdminCustomerPreferencesController.php @@ -113,13 +113,6 @@ class AdminCustomerPreferencesControllerCore extends AdminController 'cast' => 'intval', 'type' => 'bool' ), - 'PS_CUSTOMER_ADDRESS_CREATION' => array( - 'title' => $this->l('Address creation during checkout'), - 'hint' => $this->l('If disabled, Address form will not appear to user during checkout process. So by default hotel address, which rooms guest has in his cart will be considered as user address. Else user has to fill adress details.'), - 'validation' => 'isBool', - 'cast' => 'intval', - 'type' => 'bool' - ), ), 'submit' => array('title' => $this->l('Save')), ), diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 320da13dd..d531720f0 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -398,7 +398,10 @@ class AuthControllerCore extends FrontController $firstnameAddress = Tools::getValue('firstname'); $_POST['lastname'] = Tools::getValue('customer_lastname', $lastnameAddress); $_POST['firstname'] = Tools::getValue('customer_firstname', $firstnameAddress); - $addresses_types = array('address'); + $addresses_types = []; + if (Configuration::get('PS_REGISTRATION_PROCESS_TYPE')) { + $addresses_types[] = 'address'; + } if (!Configuration::get('PS_ORDER_PROCESS_TYPE') && Configuration::get('PS_GUEST_CHECKOUT_ENABLED') && Tools::getValue('invoice_address')) { $addresses_types[] = 'address_invoice'; @@ -422,36 +425,6 @@ class AuthControllerCore extends FrontController $this->errors[] = Tools::displayError('You must register at least one phone number.'); } - // if PS_CUSTOMER_ADDRESS_CREATION is disabled And customer has no addresses then create customer address - // with the details of first hotel which rooms he has in cart - if (!Configuration::get('PS_CUSTOMER_ADDRESS_CREATION') - && isset($this->context->cart->id) - && $this->context->cart->id - ) { - if (Module::isInstalled('hotelreservationsystem')) { - include_once _PS_MODULE_DIR_.'hotelreservationsystem/define.php'; - $objHtlCart = new HotelCartBookingData(); - if ($htlCartInfo = $objHtlCart->getCartCurrentDataByCartId($this->context->cart->id)) { - if (isset($htlCartInfo[0]['id_hotel']) && ($idHotel = $htlCartInfo[0]['id_hotel'])) { - if ($address_info = HotelBranchInformation::getAddress($idHotel)) { - $_POST['lastname'] = Tools::getValue('customer_lastname'); - $_POST['firstname'] = Tools::getValue('customer_firstname'); - $_POST['address1'] = $address_info['address1']; - $_POST['city'] = $address_info['city']; - $_POST['postcode'] = $address_info['postcode']; - $_POST['alias'] = 'My address'; - $_POST['id_country'] = $address_info['id_country']; - $_POST['id_state'] = $address_info['id_state']; - $_POST['auto_generated'] = true; - // if form is shorter then address name will be customer name - $lastnameAddress = $_POST['lastname']; - $firstnameAddress = $_POST['firstname']; - } - } - } - } - } - // End $this->errors = array_unique(array_merge($this->errors, $customer->validateController())); // Check the requires fields which are settings in the BO @@ -561,7 +534,7 @@ class AuthControllerCore extends FrontController } if ($country->need_identification_number) { - if (!Configuration::get('PS_CUSTOMER_ADDRESS_CREATION')) { + if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE')) { $$addresses_type->dni = null; } elseif (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))) { $this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.'); diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index e74ed1ed7..473307bf6 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -465,7 +465,7 @@ class OrderOpcControllerCore extends ParentOrderController // 'allDemands' => $allDemands, // 'defaultcurrencySign' => $objCurrency->sign, 'THEME_DIR' => _THEME_DIR_, - 'PS_CUSTOMER_ADDRESS_CREATION' => Configuration::get('PS_CUSTOMER_ADDRESS_CREATION'), + 'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'), 'PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN' => Configuration::get('PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN'), 'free_shipping' => $free_shipping, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, diff --git a/themes/hotel-reservation-theme/js/order-opc.js b/themes/hotel-reservation-theme/js/order-opc.js index 0649a68dd..3a3f5ef47 100644 --- a/themes/hotel-reservation-theme/js/order-opc.js +++ b/themes/hotel-reservation-theme/js/order-opc.js @@ -346,7 +346,7 @@ $(document).ready(function() static_token = jsonData.token; // It's not a new customer - if (PS_CUSTOMER_ADDRESS_CREATION && $('#opc_id_customer').val() !== '0') { + if (PS_REGISTRATION_PROCESS_TYPE && $('#opc_id_customer').val() !== '0') { saveAddress('delivery', function() { location.reload(); }); diff --git a/themes/hotel-reservation-theme/order-opc-edit-guest-info.tpl b/themes/hotel-reservation-theme/order-opc-edit-guest-info.tpl index 314f2e3ad..78e57e11c 100644 --- a/themes/hotel-reservation-theme/order-opc-edit-guest-info.tpl +++ b/themes/hotel-reservation-theme/order-opc-edit-guest-info.tpl @@ -106,7 +106,7 @@ - {if $PS_CUSTOMER_ADDRESS_CREATION} + {if isset($PS_REGISTRATION_PROCESS_TYPE) && $PS_REGISTRATION_PROCESS_TYPE}
@@ -316,5 +316,5 @@ {if isset($countries)} {addJsDef countries=$countries} {/if} - {addJsDef PS_CUSTOMER_ADDRESS_CREATION=$PS_CUSTOMER_ADDRESS_CREATION|intval} + {addJsDef PS_REGISTRATION_PROCESS_TYPE=$PS_REGISTRATION_PROCESS_TYPE|intval} {/strip} diff --git a/themes/hotel-reservation-theme/order-opc-new-account.tpl b/themes/hotel-reservation-theme/order-opc-new-account.tpl index 92c1149fd..b0b0b3b3b 100644 --- a/themes/hotel-reservation-theme/order-opc-new-account.tpl +++ b/themes/hotel-reservation-theme/order-opc-new-account.tpl @@ -103,7 +103,7 @@
- {if $PS_CUSTOMER_ADDRESS_CREATION} + {if isset($PS_REGISTRATION_PROCESS_TYPE) && $PS_REGISTRATION_PROCESS_TYPE}