[-] BO : fixed #PSTEST-939 - now you can't add tow country with the same isocode

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13874 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
vAugagneur
2012-03-06 10:32:25 +00:00
parent 790f6bfcd5
commit df0025da7d
+16 -1
View File
@@ -353,7 +353,22 @@ class AdminCountriesControllerCore extends AdminController
public function postProcess()
{
$res = parent::postProcess();
if (!Tools::getValue('id_'.$this->table))
{
if (Validate::isLanguageIsoCode(Tools::getValue('iso_code')) && Country::getByIso(Tools::getValue('iso_code')))
$this->errors[] = Tools::displayError('This iso code already exist, you can\'t create two country with the same iso code');
}
else if (Validate::isLanguageIsoCode(Tools::getValue('iso_code')))
{
$id_country = Country::getByIso(Tools::getValue('iso_code'));
if (!is_null($id_country) && $id_country != Tools::getValue('id_'.$this->table))
$this->errors[] = Tools::displayError('This iso code already exist, you can\'t create two country with the same iso code');
}
if (!count($this->errors))
$res = parent::postProcess();
else
return false;
if (Tools::getValue('submitAdd'.$this->table) && $res)
{