From 33f09fb92fd25f2e0b68a03e5c2240079eb3f5d0 Mon Sep 17 00:00:00 2001 From: Gregory Roussac Date: Thu, 27 Dec 2012 18:05:26 +0100 Subject: [PATCH] [-] FO : Fix #PSCFV-6209 required phone with Guest Checkout --- controllers/front/AuthController.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 5776a4f01..4b2cf0993 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -377,8 +377,18 @@ class AuthControllerCore extends FrontController $_POST['lastname'] = Tools::getValue('customer_lastname'); $_POST['firstname'] = Tools::getValue('customer_firstname'); - if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone') && !Tools::getValue('phone_mobile') && - (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || Configuration::get('PS_GUEST_CHECKOUT_ENABLED'))) + $error_phone = false; + if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) + { + if (Tools::isSubmit('submitGuestAccount') || !Tools::getValue('is_new_customer')) + { + if (!Tools::getValue('phone')) + $error_phone = true; + } + elseif (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || Configuration::get('PS_ORDER_PROCESS_TYPE') && (!Tools::getValue('phone') || !Tools::getValue('phone_mobile'))) + $error_phone = true; + } + if ($error_phone) $this->errors[] = Tools::displayError('You must register at least one phone number'); $this->errors = array_unique(array_merge($this->errors, $customer->validateController()));