diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 5dda3e009..39d33f6b7 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -1224,14 +1224,6 @@ class AdminCustomersControllerCore extends AdminController $this->errors[] = Tools::displayError('Phone number is required.'); } } - $className = 'CustomerGuestDetail'; - $rules = call_user_func(array($className, 'getValidationRules'), $className); - if ($phone && !Validate::isPhoneNumber($phone)) { - $this->errors[] = Tools::displayError('Invaid phone number.'); - } elseif ($phone && Tools::strlen($phone) > $rules['size']['phone']) { - $this->errors[] = sprintf(Tools::displayError('Phone number is too long. (%s chars max).'), $rules['size']['phone']); - } - $customer = new Customer(); $this->errors = array_merge($this->errors, $customer->validateFieldsRequiredDatabase()); @@ -1478,6 +1470,18 @@ class AdminCustomersControllerCore extends AdminController if ($this->tabAccess['edit'] == 1) { if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail((int) Tools::getValue('id_customer_guest_detail')))) { $response['errors'] = $objCustomerGuestDetail->validateController(); + if (!Tools::getValue('lastname')) { + $response['errors']['lastname'] = Tools::displayError('lastname is required'); + } + if (!Tools::getValue('firstname')) { + $response['errors']['firstname'] = Tools::displayError('firstname is required'); + } + if (!Tools::getValue('email')) { + $response['errors']['email'] = Tools::displayError('email is required'); + } + if (!Tools::getValue('phone')) { + $response['errors']['phone'] = Tools::displayError('phone is required'); + } if (!$response['errors']) { $objCustomerGuestDetail->id_gender = Tools::getValue('id_gender'); $objCustomerGuestDetail->firstname = Tools::getValue('firstname'); diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 573ba8a0f..7f2dd8e4e 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -422,16 +422,8 @@ class AuthControllerCore extends FrontController $addresses_types[] = 'address_invoice'; } - $className = 'CustomerGuestDetail'; - $rules = call_user_func(array($className, 'getValidationRules'), $className); if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone')) { $this->errors[] = Tools::displayError('Phone number is required.'); - } else { - if (Tools::getValue('phone') && !Validate::isPhoneNumber(Tools::getValue('phone'))) { - $this->errors[] = Tools::displayError('Invald phone number.'); - } elseif (Tools::getValue('phone') && Tools::strlen(Tools::getValue('phone')) > $rules['size']['phone']) { - $this->errors[] = sprintf(Tools::displayError('Phone number is too long. (%s chars max).'), $rules['size']['phone']); - } } if (!Tools::getValue('is_new_customer', 1)) { diff --git a/controllers/front/IdentityController.php b/controllers/front/IdentityController.php index 04fb339de..917e301f4 100644 --- a/controllers/front/IdentityController.php +++ b/controllers/front/IdentityController.php @@ -89,17 +89,8 @@ class IdentityControllerCore extends FrontController } } - $className = 'CustomerGuestDetail'; - $rules = call_user_func(array($className, 'getValidationRules'), $className); - if ($phone && !Validate::isPhoneNumber($phone)) { - $this->errors[] = Tools::displayError('Invaid phone number.'); - } elseif ($phone && Tools::strlen($phone) > $rules['size']['phone']) { - $this->errors[] = sprintf(Tools::displayError('Phone number is too long. (%s chars max).'), $rules['size']['phone']);; - } else { - $this->customer->phone = $phone; - } - if (!count($this->errors)) { + $this->customer->phone = $phone; $this->customer->id_default_group = (int)$prev_id_default_group; $this->customer->firstname = Tools::ucwords($this->customer->firstname); diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index dcc3c7cd0..cc4400375 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -120,16 +120,7 @@ class OrderOpcControllerCore extends ParentOrderController $this->errors[] = Tools::displayError('Phone number is a required field.', false); } - $className = 'CustomerGuestDetail'; - $rules = call_user_func(array($className, 'getValidationRules'), $className); - if (!Validate::isPhoneNumber($phone)) { - $this->errors[] = Tools::displayError('Please enter a valid Mobile phone number.', false); - } elseif (Tools::strlen($phone) > $rules['size']['phone']) { - $this->errors[] = sprintf(Tools::displayError('Mobile phone number is too long. (%s chars max).'), $rules['size']['phone']); - } else { - $this->context->customer->phone = $phone; - } - + $this->context->customer->phone = $phone; $_POST['lastname'] = $_POST['customer_lastname']; $_POST['firstname'] = $_POST['customer_firstname']; $this->errors = array_merge($this->errors, $this->context->customer->validateController()); diff --git a/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl b/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl index 993330afe..4ff2f46f8 100644 --- a/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl +++ b/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl @@ -35,7 +35,7 @@
- {$search_data['htl_dtl']['hotel_name']|escape:'htmlall':'UTF-8'}, {$search_data['htl_dtl']['city']|escape:'htmlall':'UTF-8'} {if !$search_data['order_date_restrict']} {$search_data['date_from']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"} - {$search_data['date_to']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"} ({1+$search_data['num_days']|escape:'htmlall':'UTF-8'} {l s='Days' mod='wkroomsearchblock'} {$search_data['num_days']|escape:'htmlall':'UTF-8'} {if $search_data['num_days'] > 1}{l s='Nights' mod='wkroomsearchblock'}{else}{l s='Night' mod='wkroomsearchblock'}{/if}) {/if} + {$search_data['htl_dtl']['hotel_name']|escape:'htmlall':'UTF-8'}, {$search_data['htl_dtl']['city']|escape:'htmlall':'UTF-8'} {if !$search_data['order_date_restrict']} {if (isset($search_data['date_from']))}{$search_data['date_from']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"}{/if} - {if isset($search_data['date_to'])}{$search_data['date_to']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"}{/if} ({1+$search_data['num_days']|escape:'htmlall':'UTF-8'} {l s='Days' mod='wkroomsearchblock'} {$search_data['num_days']|escape:'htmlall':'UTF-8'} {if $search_data['num_days'] > 1}{l s='Nights' mod='wkroomsearchblock'}{else}{l s='Night' mod='wkroomsearchblock'}{/if}) {/if}