// optmization adminshopurlcontroller
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11446 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -238,26 +238,8 @@ class AdminShopUrlControllerCore extends AdminController
|
||||
public function postProcess()
|
||||
{
|
||||
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
|
||||
if (Tools::isSubmit('submitAdd'.$this->table))
|
||||
{
|
||||
$object = $this->loadObject(true);
|
||||
if ($object->id && Tools::getValue('main'))
|
||||
$object->setMain();
|
||||
|
||||
if ($object->main && !Tools::getValue('main'))
|
||||
$this->_errors[] = Tools::displayError('You can\'t change a main url to a non main url, you have to set an other url as main url for selected shop');
|
||||
|
||||
if (($object->main || Tools::getValue('main')) && !Tools::getValue('active'))
|
||||
$this->_errors[] = Tools::displayError('You can\'t disable a main url');
|
||||
|
||||
if ($object->canAddThisUrl(Tools::getValue('domain'), Tools::getValue('domain_ssl'), Tools::getValue('physical_uri'), Tools::getValue('virtual_uri')))
|
||||
$this->_errors[] = Tools::displayError('A shop url that use this domain and uri already exists');
|
||||
|
||||
parent::postProcess();
|
||||
if (!$this->_errors)
|
||||
Tools::generateHtaccess(dirname(__FILE__).'/../../.htaccess', Configuration::get('PS_REWRITING_SETTINGS'), Configuration::get('PS_HTACCESS_CACHE_CONTROL'), '');
|
||||
}
|
||||
elseif ((isset($_GET['status'.$this->table]) || isset($_GET['status'])) && Tools::getValue($this->identifier))
|
||||
if ((isset($_GET['status'.$this->table]) || isset($_GET['status'])) && Tools::getValue($this->identifier))
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
@@ -280,6 +262,26 @@ class AdminShopUrlControllerCore extends AdminController
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
public function processAdd($token)
|
||||
{
|
||||
$object = $this->loadObject(true);
|
||||
if ($object->id && Tools::getValue('main'))
|
||||
$object->setMain();
|
||||
|
||||
if ($object->main && !Tools::getValue('main'))
|
||||
$this->_errors[] = Tools::displayError('You can\'t change a main url to a non main url, you have to set an other url as main url for selected shop');
|
||||
|
||||
if (($object->main || Tools::getValue('main')) && !Tools::getValue('active'))
|
||||
$this->_errors[] = Tools::displayError('You can\'t disable a main url');
|
||||
|
||||
if ($object->canAddThisUrl(Tools::getValue('domain'), Tools::getValue('domain_ssl'), Tools::getValue('physical_uri'), Tools::getValue('virtual_uri')))
|
||||
$this->_errors[] = Tools::displayError('A shop url that use this domain and uri already exists');
|
||||
|
||||
parent::processAdd($token);
|
||||
if (!$this->_errors)
|
||||
Tools::generateHtaccess(dirname(__FILE__).'/../../.htaccess', Configuration::get('PS_REWRITING_SETTINGS'), Configuration::get('PS_HTACCESS_CACHE_CONTROL'), '');
|
||||
}
|
||||
|
||||
protected function afterUpdate($object)
|
||||
{
|
||||
if (Tools::getValue('main'))
|
||||
|
||||
Reference in New Issue
Block a user