// AdminAttributeGenerator refactoring

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13998 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean committed 2012-03-09 10:34:48 +00:00
1 parent 808cb17eff
commit 79fa761968
1 file changed
+15 -4
@@ -76,12 +76,26 @@ class AdminAttributeGeneratorControllerCore extends AdminController
return $res; return $res;
} }
public function initProcess()
{
if (isset($_POST['generate']))
{
if ($this->tabAccess['edit'] === '1')
$this->action = 'generate';
else
$this->errors[] = Tools::displayError('You do not have permission to add here.');
}
parent::initProcess();
}
public function postProcess() public function postProcess()
{ {
$this->product = new Product((int)Tools::getValue('id_product')); $this->product = new Product((int)Tools::getValue('id_product'));
$this->product->loadStockData(); $this->product->loadStockData();
parent::postProcess();
}
if (isset($_POST['generate'])) public function processGenerate($token)
{ {
if (!is_array(Tools::getValue('options'))) if (!is_array(Tools::getValue('options')))
$this->errors[] = Tools::displayError('Please choose at least 1 attribute.'); $this->errors[] = Tools::displayError('Please choose at least 1 attribute.');
@@ -121,9 +135,6 @@ class AdminAttributeGeneratorControllerCore extends AdminController
} }
} }
parent::postProcess();
}
private static function displayAndReturnAttributeJs() private static function displayAndReturnAttributeJs()
{ {
$attributes = Attribute::getAttributes(Context::getContext()->language->id, true); $attributes = Attribute::getAttributes(Context::getContext()->language->id, true);