// Refactor AdminController::_errors to errors
This commit is contained in:
@@ -352,7 +352,7 @@ class AdminGroupsControllerCore extends AdminController
|
||||
public function processSave($token)
|
||||
{
|
||||
if (!$this->validateDiscount(Tools::getValue('reduction')))
|
||||
$this->_errors[] = Tools::displayError('Discount value is incorrect (must be a percentage)');
|
||||
$this->errors[] = Tools::displayError('Discount value is incorrect (must be a percentage)');
|
||||
else
|
||||
{
|
||||
$this->updateCategoryReduction();
|
||||
@@ -419,7 +419,7 @@ class AdminGroupsControllerCore extends AdminController
|
||||
foreach ($category_reduction as $cat => $reduction)
|
||||
{
|
||||
if (!Validate::isUnsignedId($cat) || !$this->validateDiscount($reduction))
|
||||
$this->_errors[] = Tools::displayError('Discount value is incorrect');
|
||||
$this->errors[] = Tools::displayError('Discount value is incorrect');
|
||||
else
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
@@ -438,7 +438,7 @@ class AdminGroupsControllerCore extends AdminController
|
||||
$group_reduction->reduction = (float)($reduction / 100);
|
||||
$group_reduction->id_category = (int)$cat;
|
||||
if (!$group_reduction->save())
|
||||
$this->_errors[] = Tools::displayError('Cannot save group reductions');
|
||||
$this->errors[] = Tools::displayError('Cannot save group reductions');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -453,10 +453,10 @@ class AdminGroupsControllerCore extends AdminController
|
||||
{
|
||||
$group = new Group($this->id_object);
|
||||
if (!Validate::isLoadedObject($group))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating group.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating group.');
|
||||
$update = Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'group` SET show_prices = '.($group->show_prices ? 0 : 1).' WHERE `id_group` = '.(int)$group->id);
|
||||
if (!$update)
|
||||
$this->_errors[] = Tools::displayError('An error occurred while updating group.');
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating group.');
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user