// Clean AdminController methods did not return the appropriate value #PSCFV-3645

This commit is contained in:
dMetzger
2012-08-17 07:03:54 +00:00
parent 06ac6f04cd
commit 526a99f8c5
9 changed files with 27 additions and 10 deletions
@@ -370,7 +370,7 @@ class AdminAddressesControllerCore extends AdminController
} }
if (empty($this->errors)) if (empty($this->errors))
parent::processSave(); return parent::processSave();
else else
// if we have errors, we stay on the form instead of going back to the list // if we have errors, we stay on the form instead of going back to the list
$this->display = 'edit'; $this->display = 'edit';
@@ -386,7 +386,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
*/ */
public function processAdd() public function processAdd()
{ {
parent::processAdd(); $object = parent::processAdd();
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors)) if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors))
{ {
@@ -398,6 +398,8 @@ class AdminAttributesGroupsControllerCore extends AdminController
if (count($this->errors)) if (count($this->errors))
$this->setTypeAttribute(); $this->setTypeAttribute();
return $object;
} }
/** /**
@@ -406,7 +408,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
*/ */
public function processUpdate() public function processUpdate()
{ {
parent::processUpdate(); $object = parent::processUpdate();
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors)) if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors))
{ {
@@ -418,6 +420,8 @@ class AdminAttributesGroupsControllerCore extends AdminController
if (count($this->errors)) if (count($this->errors))
$this->setTypeAttribute(); $this->setTypeAttribute();
return $object;
} }
/** /**
@@ -532,10 +532,13 @@ class AdminCategoriesControllerCore extends AdminController
else else
$this->errors[] = Tools::displayError($this->l('Category cannot be parent of itself.')); $this->errors[] = Tools::displayError($this->l('Category cannot be parent of itself.'));
} }
parent::processAdd(); $object = parent::processAdd();
//if we create a you root category you have to associate to a shop before to add sub categories in. So we redirect to AdminCategories listing //if we create a you root category you have to associate to a shop before to add sub categories in. So we redirect to AdminCategories listing
if (Tools::isSubmit('is_root_category')) if (Tools::isSubmit('is_root_category'))
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminCategories').'&conf=3'); Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminCategories').'&conf=3');
return $object;
} }
protected function setDeleteMode() protected function setDeleteMode()
@@ -731,11 +731,12 @@ class AdminCustomersControllerCore extends AdminController
{ {
$this->errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$customer_email; $this->errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$customer_email;
$this->display = 'edit'; $this->display = 'edit';
return $customer;
} }
elseif ($customer = parent::processAdd()) elseif ($customer = parent::processAdd())
{ {
$this->context->smarty->assign('new_customer', $customer); $this->context->smarty->assign('new_customer', $customer);
return true; return $customer;
} }
return false; return false;
} }
@@ -400,10 +400,12 @@ class AdminFeaturesControllerCore extends AdminController
*/ */
public function processAdd() public function processAdd()
{ {
parent::processAdd(); $object = parent::processAdd();
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors)) if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors))
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token; $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token;
return $object;
} }
/** /**
@@ -412,10 +414,12 @@ class AdminFeaturesControllerCore extends AdminController
*/ */
public function processUpdate() public function processUpdate()
{ {
parent::processUpdate(); $object = parent::processUpdate();
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors)) if (Tools::isSubmit('submitAdd'.$this->table.'AndStay') && !count($this->errors))
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token; $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'=&conf=3&update'.$this->table.'&token='.$this->token;
return $object;
} }
/** /**
@@ -442,7 +446,7 @@ class AdminFeaturesControllerCore extends AdminController
if (preg_match('/^name_/Ui', $key)) if (preg_match('/^name_/Ui', $key))
$_POST[$key] = str_replace ('\n', '', str_replace('\r', '', $value)); $_POST[$key] = str_replace ('\n', '', str_replace('\r', '', $value));
} }
parent::processSave(); return parent::processSave();
} }
/** /**
+2 -1
View File
@@ -363,8 +363,9 @@ class AdminGroupsControllerCore extends AdminController
else else
{ {
$this->updateCategoryReduction(); $this->updateCategoryReduction();
parent::processSave(); $object = parent::processSave();
$this->updateRestrictions(); $this->updateRestrictions();
return $object;
} }
} }
@@ -1579,6 +1579,8 @@ class AdminProductsControllerCore extends AdminController
} }
else else
$this->errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.'</b>'; $this->errors[] = Tools::displayError('An error occurred while creating object.').' <b>'.$this->table.'</b>';
return $this->object;
} }
protected function isTabSubmitted($tab_name) protected function isTabSubmitted($tab_name)
@@ -1707,6 +1709,7 @@ class AdminProductsControllerCore extends AdminController
} }
else else
$this->errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b> ('.Tools::displayError('Cannot load object').')'; $this->errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b> ('.Tools::displayError('Cannot load object').')';
return $object;
} }
} }
+1 -1
View File
@@ -370,7 +370,7 @@ class AdminShopUrlControllerCore extends AdminController
if (($object->main || Tools::getValue('main')) && !Tools::getValue('active')) if (($object->main || Tools::getValue('main')) && !Tools::getValue('active'))
$this->errors[] = Tools::displayError('You can\'t disable a Main URL'); $this->errors[] = Tools::displayError('You can\'t disable a Main URL');
parent::processAdd(); return parent::processAdd();
} }
public function processUpdate() public function processUpdate()
@@ -319,6 +319,7 @@ class AdminSpecificPriceRuleControllerCore extends AdminController
} }
} }
$object->apply(); $object->apply();
return $object;
} }
} }
} }