diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 3a9898d5a..390532573 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -1159,8 +1159,12 @@ class AdminCustomersControllerCore extends AdminController $this->errors[] = Tools::displayError('Phone number is required.'); } } + $className = 'CartCustomerGuestDetail'; + $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[] = Tools::displayError('Invaid phone number.'); } diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 2a1e27120..e75224510 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -427,14 +427,20 @@ class AuthControllerCore extends FrontController } } + $className = 'CartCustomerGuestDetail'; + $rules = call_user_func(array($className, 'getValidationRules'), $className); if ($error_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[] = Tools::displayError('Invald phone number.'); } if (Tools::getValue('phone_mobile') && !Validate::isPhoneNumber(Tools::getValue('phone_mobile'))) { $this->errors[] = Tools::displayError('Invald mobile phone number.'); + } elseif (Tools::getValue('phone_mobile') && Tools::strlen(Tools::getValue('phone_mobile')) > $rules['size']['phone']) { + $this->errors[] = Tools::displayError('Invald mobile phone number.'); } } diff --git a/controllers/front/IdentityController.php b/controllers/front/IdentityController.php index aeaf3bc70..9fe263c30 100644 --- a/controllers/front/IdentityController.php +++ b/controllers/front/IdentityController.php @@ -88,8 +88,12 @@ class IdentityControllerCore extends FrontController $this->errors[] = Tools::displayError('Phone number is required.'); } } + $className = 'CartCustomerGuestDetail'; + $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[] = Tools::displayError('Invaid phone number.'); } if (!count($this->errors)) { diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index a846d0a67..7d125a7d1 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -119,8 +119,12 @@ class OrderOpcControllerCore extends ParentOrderController if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !$phone) { $this->errors[] = Tools::displayError('Phone number is a required field.', false); } + $className = 'CartCustomerGuestDetail'; + $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[] = Tools::displayError('Please enter a valid Mobile phone number.', false); } $_POST['lastname'] = $_POST['customer_lastname']; 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 9b0dc442d..ec645221d 100644 --- a/themes/hotel-reservation-theme/order-opc-edit-guest-info.tpl +++ b/themes/hotel-reservation-theme/order-opc-edit-guest-info.tpl @@ -86,7 +86,7 @@