[-] BO : Fix bug #PSCFV-7468 required phone in address creation

This commit is contained in:
gRoussac
2013-03-11 17:39:13 +01:00
parent 54ee8a21d8
commit d73fcdf412
2 changed files with 6 additions and 3 deletions
@@ -50,7 +50,7 @@
<input type="hidden" name="{$input.name}" id="{$input.name}" value="{$fields_value[$input.name]|escape:'htmlall':'UTF-8'}" />
{else}
{if $input.name == 'id_state'}
<div id="contains_states" {if $contains_states}style="display:none;"{/if}>
<div id="contains_states" {if !$contains_states}style="display:none;"{/if}>
{/if}
{block name="label"}
{if isset($input.label)}<label>{$input.label} </label>{/if}
@@ -318,7 +318,7 @@
{if isset($input.required) && $input.required && $input.type != 'radio'} <sup>*</sup>{/if}
{/block}{* end block input *}
{block name="description"}
{if isset($input.desc)}
{if isset($input.desc) && !empty($input.desc)}
<p class="preference_description">
{if is_array($input.desc)}
{foreach $input.desc as $p}
@@ -126,7 +126,7 @@ class AdminAddressesControllerCore extends AdminController
'name' => 'phone_mobile',
'size' => 33,
'required' => false,
'desc' => sprintf($this->l('You must register at least one phone number %s'), '<sup>*</sup>')
'desc' => Configuration::get('PS_ONE_PHONE_AT_LEAST')? sprintf($this->l('You must register at least one phone number %s'), '<sup>*</sup>') : ''
),
array(
'type' => 'textarea',
@@ -367,6 +367,9 @@ class AdminAddressesControllerCore extends AdminController
$this->errors[] = Tools::displayError('Your Postal Code/Zip Code is incorrect.');
}
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 this address come from order's edition and is the same as the other one (invoice or delivery one)
** we delete its id_address to force the creation of a new one */
if ((int)Tools::getValue('id_order'))