// BugFix : Adding an error when you try to update a shop_url already existing in another shop
This commit is contained in:
@@ -159,4 +159,22 @@ class ShopUrlCore extends ObjectModel
|
||||
}
|
||||
return self::$main_domain_ssl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @static
|
||||
* @param string $virtual_uri
|
||||
* @param int $id_shop_tested
|
||||
* @return bool
|
||||
*/
|
||||
public static function virtualUriExists($virtual_uri, $id_shop_tested)
|
||||
{
|
||||
$virtual_uri = trim($virtual_uri);
|
||||
if (substr($virtual_uri, -1) != '/')
|
||||
$virtual_uri .= '/';
|
||||
return (bool) Db::getInstance()->getValue('
|
||||
SELECT `virtual_uri`
|
||||
FROM `'._DB_PREFIX_.'shop_url`
|
||||
WHERE `id_shop` != '.(int)$id_shop_tested.'
|
||||
AND `virtual_uri` = "'.pSQL($virtual_uri).'"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,6 +258,13 @@ class AdminShopUrlControllerCore extends AdminController
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||
}
|
||||
else if (Tools::isSubmit('submitAdd'.$this->table) && $this->tabAccess['add'] === '1')
|
||||
{
|
||||
if (ShopUrl::virtualUriExists(Tools::getValue('virtual_uri'), Tools::getValue('id_shop')))
|
||||
$this->_errors[] = Tools::displayError('Virtual URI already used.');
|
||||
else
|
||||
return parent::postProcess();
|
||||
}
|
||||
else
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user