// AdminController refactoring

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13300 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2012-02-14 10:47:40 +00:00
parent 79f75172c8
commit 3311fd7d25
2 changed files with 11 additions and 6 deletions
+8 -2
View File
@@ -1766,7 +1766,10 @@ class AdminControllerCore extends Controller
if ($this->tabAccess['edit'] === '1')
{
$this->action = 'save';
$this->display = 'edit';
if (Tools::getValue('submitAdd'.$this->table.'AndStay'))
$this->display = 'edit';
else
$this->display = 'list';
}
else
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
@@ -1777,7 +1780,10 @@ class AdminControllerCore extends Controller
if ($this->tabAccess['add'] === '1')
{
$this->action = 'save';
$this->display = 'edit';
if (Tools::getValue('submitAdd'.$this->table.'AndStay'))
$this->display = 'edit';
else
$this->display = 'list';
}
else
$this->errors[] = Tools::displayError('You do not have permission to add here.');
@@ -997,7 +997,6 @@ class AdminProductsControllerCore extends AdminController
// And if still not set, use default
if (!$this->tab_display)
$this->tab_display = $this->default_tab;
}
/**
@@ -1435,7 +1434,7 @@ class AdminProductsControllerCore extends AdminController
.'&token='.($token ? $token : $this->token);
// Save and stay on same form
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
if ($this->display == 'edit')
$this->redirect_after = self::$currentIndex.'&id_product='.(int)$this->object->id
.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '')
.'&addproduct&conf=3&key_tab='.Tools::safeOutput(Tools::getValue('key_tab')).'&token='.($token ? $token : $this->token);
@@ -1481,7 +1480,7 @@ class AdminProductsControllerCore extends AdminController
$this->processWarehouses($token);
$this->processFeatures($token);
$this->processProductAttribute($token);
//d($this->redirect_after);
if (!$this->updatePackItems($object))
$this->errors[] = Tools::displayError('An error occurred while adding products to the pack.');
elseif (!$object->updateCategories(Tools::getValue('categoryBox'), true))
@@ -1513,7 +1512,7 @@ class AdminProductsControllerCore extends AdminController
else
{
// Save and stay on same form
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
if ($this->display == 'edit')
$this->confirmations[] = $this->l('Update successful');
else
// Default behavior (save and back)