diff --git a/controllers/admin/AdminCustomerPreferencesController.php b/controllers/admin/AdminCustomerPreferencesController.php index dc78843d3..86963f02a 100644 --- a/controllers/admin/AdminCustomerPreferencesController.php +++ b/controllers/admin/AdminCustomerPreferencesController.php @@ -59,6 +59,13 @@ class AdminCustomerPreferencesControllerCore extends AdminController 'list' => $registration_process_type, 'identifier' => 'value' ), + 'PS_ONE_PHONE_AT_LEAST' => array( + 'title' => $this->l('Phone number'), + 'desc' => $this->l('If you choose this option your customer will must register at least one phone number.'), + 'validation' => 'isBool', + 'cast' => 'intval', + 'type' => 'bool' + ), 'PS_CART_FOLLOWING' => array( 'title' => $this->l('Cart re-display at login'), 'desc' => $this->l('After customer logs in, recall and display contents of his/her last shopping cart'), diff --git a/controllers/front/AddressController.php b/controllers/front/AddressController.php index a90eb1ea1..4ca6c002c 100644 --- a/controllers/front/AddressController.php +++ b/controllers/front/AddressController.php @@ -124,7 +124,7 @@ class AddressControllerCore extends FrontController $this->errors[] = Tools::displayError('Invalid token'); // Check phone - if (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')) + if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone') && !Tools::getValue('phone_mobile')) $this->errors[] = Tools::displayError('You must register at least one phone number'); if ($address->id_country) { diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 93734140c..3c539e18a 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -391,7 +391,7 @@ class AuthControllerCore extends FrontController $customer = new Customer(); $_POST['lastname'] = Tools::getValue('customer_lastname'); $_POST['firstname'] = Tools::getValue('customer_firstname'); - if (!Tools::getValue('phone') && !Tools::getValue('phone_mobile') && Configuration::get('PS_REGISTRATION_PROCESS_TYPE')) + if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone') && !Tools::getValue('phone_mobile') && Configuration::get('PS_REGISTRATION_PROCESS_TYPE')) $this->errors[] = Tools::displayError('You must register at least one phone number'); $this->errors = array_unique(array_merge($this->errors, $customer->validateController())); diff --git a/install-dev/data/xml/configuration.xml b/install-dev/data/xml/configuration.xml index 84b7d1343..49efa0cf0 100644 --- a/install-dev/data/xml/configuration.xml +++ b/install-dev/data/xml/configuration.xml @@ -8,6 +8,9 @@ 1 + + 1 + 1 diff --git a/install-dev/upgrade/sql/1.5.0.18.sql b/install-dev/upgrade/sql/1.5.0.18.sql index 283ad5827..14e146c0e 100644 --- a/install-dev/upgrade/sql/1.5.0.18.sql +++ b/install-dev/upgrade/sql/1.5.0.18.sql @@ -4,3 +4,6 @@ ALTER TABLE `PREFIX_image_shop` ADD `cover` TINYINT(1) UNSIGNED NOT NULL AFTER ` ALTER TABLE `PREFIX_image_shop` DROP PRIMARY KEY; ALTER TABLE `PREFIX_image_shop` ADD INDEX (`id_image`, `id_shop`, `cover`); UPDATE `PREFIX_image_shop` image_shop SET image_shop.`cover`=1 WHERE `id_image` IN (SELECT `id_image` FROM `PREFIX_image` i WHERE i.`cover`=1); + +INSERT INTO `PREFIX_configuration`(`name`, `value`, `date_add`, `date_upd`) VALUES ('PS_ONE_PHONE_AT_LEAST', '1', NOW(), NOW()); +