// Refactor AdminController::_errors to errors
This commit is contained in:
@@ -309,17 +309,17 @@ class AdminStoresControllerCore extends AdminController
|
||||
$country = new Country((int)$id_country);
|
||||
|
||||
if ($id_country && $country && !(int)$country->contains_states && $id_state)
|
||||
$this->_errors[] = Tools::displayError('You have selected a state for a country that does not contain states.');
|
||||
$this->errors[] = Tools::displayError('You have selected a state for a country that does not contain states.');
|
||||
|
||||
/* If the selected country contains states, then a state have to be selected */
|
||||
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.');
|
||||
|
||||
$latitude = (float)Tools::getValue('latitude');
|
||||
$longitude = (float)Tools::getValue('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 */
|
||||
if ($country->need_zip_code)
|
||||
@@ -334,7 +334,7 @@ class AdminStoresControllerCore extends AdminController
|
||||
$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 zip/postal code is incorrect.').'<br />'.Tools::displayError('Must be typed as follows:').' '.
|
||||
$this->errors[] = Tools::displayError('Your zip/postal code is incorrect.').'<br />'.Tools::displayError('Must be typed as follows:').' '.
|
||||
str_replace(
|
||||
'C',
|
||||
$country->iso_code,
|
||||
@@ -350,9 +350,9 @@ class AdminStoresControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
else if ($zip_code_format)
|
||||
$this->_errors[] = Tools::displayError('Postcode required.');
|
||||
$this->errors[] = Tools::displayError('Postcode required.');
|
||||
else if ($postcode && !preg_match('/^[0-9a-zA-Z -]{4,9}$/ui', $postcode))
|
||||
$this->_errors[] = Tools::displayError('Your zip/postal code is incorrect.');
|
||||
$this->errors[] = Tools::displayError('Your zip/postal code is incorrect.');
|
||||
}
|
||||
|
||||
/* Store hours */
|
||||
@@ -362,7 +362,7 @@ class AdminStoresControllerCore extends AdminController
|
||||
$_POST['hours'] = serialize($_POST['hours']);
|
||||
}
|
||||
|
||||
if (!count($this->_errors))
|
||||
if (!count($this->errors))
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user