Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release
This commit is contained in:
@@ -344,28 +344,14 @@ class AdminAddressesControllerCore extends AdminController
|
|||||||
if ((int)$country->contains_states && !$id_state)
|
if ((int)$country->contains_states && !$id_state)
|
||||||
$this->errors[] = Tools::displayError('An address located in a country containing states must have a state selected.');
|
$this->errors[] = Tools::displayError('An address located in a country containing states must have a state selected.');
|
||||||
|
|
||||||
/* Check zip code */
|
$postcode = Tools::getValue('postcode');
|
||||||
if ($country->need_zip_code)
|
/* Check zip code format */
|
||||||
{
|
if ($country->zip_code_format && !$country->checkZipCode($postcode))
|
||||||
$zip_code_format = $country->zip_code_format;
|
$this->errors[] = Tools::displayError('Your Postal / Zip Code is incorrect.').'<br />'.Tools::displayError('It must be entered as follows:').' '.str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)));
|
||||||
if (($postcode = Tools::getValue('postcode')) && $zip_code_format)
|
elseif(empty($postcode) && $country->need_zip_code)
|
||||||
{
|
$this->errors[] = Tools::displayError('A Zip / Postal code is required.');
|
||||||
$zip_regexp = '/^'.$zip_code_format.'$/ui';
|
elseif ($postcode && !Validate::isPostCode($postcode))
|
||||||
$zip_regexp = str_replace(' ', '( |)', $zip_regexp);
|
$this->errors[] = Tools::displayError('The Zip / Postal code is invalid.');
|
||||||
$zip_regexp = str_replace('-', '(-|)', $zip_regexp);
|
|
||||||
$zip_regexp = str_replace('N', '[0-9]', $zip_regexp);
|
|
||||||
$zip_regexp = str_replace('L', '[a-zA-Z]', $zip_regexp);
|
|
||||||
$zip_regexp = str_replace('C', $country->iso_code, $zip_regexp);
|
|
||||||
if (!preg_match($zip_regexp, $postcode))
|
|
||||||
$this->errors[] = Tools::displayError('Your Postal / Zip Code is incorrect.').'<br />'.
|
|
||||||
Tools::displayError('It must be entered as follows:').' '.
|
|
||||||
str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $zip_code_format)));
|
|
||||||
}
|
|
||||||
else if ($zip_code_format)
|
|
||||||
$this->errors[] = Tools::displayError('A Postal / Zip Code required.');
|
|
||||||
else if ($postcode && !preg_match('/^[0-9a-zA-Z -]{4,9}$/ui', $postcode))
|
|
||||||
$this->errors[] = Tools::displayError('Your Postal / Zip Code is incorrect.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !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.');
|
$this->errors[] = Tools::displayError('You must register at least one phone number.');
|
||||||
|
|||||||
@@ -354,40 +354,15 @@ class AdminStoresControllerCore extends AdminController
|
|||||||
|
|
||||||
if (empty($latitude) || empty($longitude))
|
if (empty($latitude) || empty($longitude))
|
||||||
$this->errors[] = Tools::displayError('Latitude and longitude are required.');
|
$this->errors[] = Tools::displayError('Latitude and longitude are required.');
|
||||||
|
|
||||||
/* Check zip code */
|
$postcode = Tools::getValue('postcode');
|
||||||
if ($country->need_zip_code)
|
/* Check zip code format */
|
||||||
{
|
if ($country->zip_code_format && !$country->checkZipCode($postcode))
|
||||||
$zip_code_format = $country->zip_code_format;
|
$this->errors[] = Tools::displayError('Your Postal / Zip Code is incorrect.').'<br />'.Tools::displayError('It must be entered as follows:').' '.str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)));
|
||||||
if (($postcode = Tools::getValue('postcode')) && $zip_code_format)
|
elseif(empty($postcode) && $country->need_zip_code)
|
||||||
{
|
$this->errors[] = Tools::displayError('A Zip / Postal code is required.');
|
||||||
$zip_regexp = '/^'.$zip_code_format.'$/ui';
|
elseif ($postcode && !Validate::isPostCode($postcode))
|
||||||
$zip_regexp = str_replace(' ', '( |)', $zip_regexp);
|
$this->errors[] = Tools::displayError('The Zip / Postal code is invalid.');
|
||||||
$zip_regexp = str_replace('-', '(-|)', $zip_regexp);
|
|
||||||
$zip_regexp = str_replace('N', '[0-9]', $zip_regexp);
|
|
||||||
$zip_regexp = str_replace('L', '[a-zA-Z]', $zip_regexp);
|
|
||||||
$zip_regexp = str_replace('C', $country->iso_code, $zip_regexp);
|
|
||||||
if (!preg_match($zip_regexp, $postcode))
|
|
||||||
$this->errors[] = Tools::displayError('Your Postal / Zip Code is incorrect.').'<br />'.Tools::displayError('It must be entered as follows:').' '.
|
|
||||||
str_replace(
|
|
||||||
'C',
|
|
||||||
$country->iso_code,
|
|
||||||
str_replace(
|
|
||||||
'N',
|
|
||||||
'0',
|
|
||||||
str_replace(
|
|
||||||
'L',
|
|
||||||
'A',
|
|
||||||
$zip_code_format
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if ($zip_code_format)
|
|
||||||
$this->errors[] = Tools::displayError('A Postal / Zip Code required.');
|
|
||||||
else if ($postcode && !preg_match('/^[0-9a-zA-Z -]{4,9}$/ui', $postcode))
|
|
||||||
$this->errors[] = Tools::displayError('Your Postal / Zip Code is incorrect.');
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Store hours */
|
/* Store hours */
|
||||||
$_POST['hours'] = array();
|
$_POST['hours'] = array();
|
||||||
|
|||||||
@@ -726,7 +726,7 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
@stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5)))))
|
@stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5)))))
|
||||||
{
|
{
|
||||||
$file = _PS_TRANSLATIONS_DIR_.$arr_import_lang[0].'.gzip';
|
$file = _PS_TRANSLATIONS_DIR_.$arr_import_lang[0].'.gzip';
|
||||||
if ((bool)file_put_contents($file, $content))
|
if ((bool)@file_put_contents($file, $content))
|
||||||
{
|
{
|
||||||
$gz = new Archive_Tar($file, true);
|
$gz = new Archive_Tar($file, true);
|
||||||
$files_list = $gz->listContent();
|
$files_list = $gz->listContent();
|
||||||
|
|||||||
@@ -145,27 +145,15 @@ class AddressControllerCore extends FrontController
|
|||||||
$address->address1 = $normalize->AddressLineStandardization($address->address1);
|
$address->address1 = $normalize->AddressLineStandardization($address->address1);
|
||||||
$address->address2 = $normalize->AddressLineStandardization($address->address2);
|
$address->address2 = $normalize->AddressLineStandardization($address->address2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check country zip code
|
$postcode = Tools::getValue('postcode');
|
||||||
$zip_code_format = $country->zip_code_format;
|
/* Check zip code format */
|
||||||
if ($country->need_zip_code)
|
if ($country->zip_code_format && !$country->checkZipCode($postcode))
|
||||||
{
|
$this->errors[] = sprintf(Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'), str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format))));
|
||||||
if (($postcode = Tools::getValue('postcode')) && $zip_code_format)
|
elseif(empty($postcode) && $country->need_zip_code)
|
||||||
{
|
$this->errors[] = Tools::displayError('A Zip / Postal code is required.');
|
||||||
if (!$country->checkZipCode($postcode))
|
elseif ($postcode && !Validate::isPostCode($postcode))
|
||||||
$this->errors[] = sprintf(
|
$this->errors[] = Tools::displayError('The Zip / Postal code is invalid.');
|
||||||
Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'),
|
|
||||||
str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if ($zip_code_format)
|
|
||||||
$this->errors[] = Tools::displayError('A Zip / Postal code is required.');
|
|
||||||
else if ($postcode && !preg_match('/^[0-9a-zA-Z -]{4,9}$/ui', $postcode))
|
|
||||||
$this->errors[] = sprintf(
|
|
||||||
Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'),
|
|
||||||
str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check country DNI
|
// Check country DNI
|
||||||
if ($country->isNeedDni() && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))))
|
if ($country->isNeedDni() && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))))
|
||||||
|
|||||||
@@ -486,22 +486,16 @@ class AuthControllerCore extends FrontController
|
|||||||
$address->address2 = $normalize->AddressLineStandardization($address->address2);
|
$address->address2 = $normalize->AddressLineStandardization($address->address2);
|
||||||
}
|
}
|
||||||
|
|
||||||
$country = new Country((int)Tools::getValue('id_country'));
|
if (!($country = new Country($address->id_country)) || !Validate::isLoadedObject($country))
|
||||||
if ($country->need_zip_code)
|
$this->errors[] = Tools::displayError('Country cannot be loaded with address->id_country');
|
||||||
{
|
$postcode = Tools::getValue('postcode');
|
||||||
if (($postcode = Tools::getValue('postcode')) && $country->zip_code_format)
|
/* Check zip code format */
|
||||||
{
|
if ($country->zip_code_format && !$country->checkZipCode($postcode))
|
||||||
if (!$country->checkZipCode($postcode))
|
$this->errors[] = sprintf(Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'), str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format))));
|
||||||
$this->errors[] = sprintf(
|
elseif(empty($postcode) && $country->need_zip_code)
|
||||||
Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'),
|
$this->errors[] = Tools::displayError('A Zip / Postal code is required.');
|
||||||
str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)))
|
elseif ($postcode && !Validate::isPostCode($postcode))
|
||||||
);
|
$this->errors[] = Tools::displayError('The Zip / Postal code is invalid.');
|
||||||
}
|
|
||||||
elseif ($country->zip_code_format)
|
|
||||||
$this->errors[] = Tools::displayError('A Zip / Postal code is required.');
|
|
||||||
elseif ($postcode && !preg_match('/^[0-9a-zA-Z -]{4,9}$/ui', $postcode))
|
|
||||||
$this->errors[] = Tools::displayError('The Zip / Postal code is invalid.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($country->need_identification_number && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))))
|
if ($country->need_identification_number && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))))
|
||||||
$this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.');
|
$this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.');
|
||||||
|
|||||||
Reference in New Issue
Block a user