// AdminCurrencies refactoring

This commit is contained in:
tDidierjean committed 2011-12-01 09:44:58 +00:00
1 parent 59cbc01d4e
commit 93fe92e6dd
2 files changed
+32 -8

No files matched your search

+1 -1
View File
@@ -677,7 +677,7 @@ class AdminControllerCore extends Controller
} }
/** /**
* Change object statuts (active, inactive) * Change object status (active, inactive)
* *
* @param string $token * @param string $token
*/ */
@@ -251,9 +251,11 @@ class AdminCurrenciesControllerCore extends AdminController
return parent::renderForm(); return parent::renderForm();
} }
public function postProcess() /**
{ * @see AdminController::processDelete()
if ($this->action == 'delete') * @param $token
*/
public function processDelete($token)
{ {
if (Validate::isLoadedObject($object = $this->loadObject())) if (Validate::isLoadedObject($object = $this->loadObject()))
{ {
@@ -268,7 +270,12 @@ class AdminCurrenciesControllerCore extends AdminController
$this->_errors[] = Tools::displayError('An error occurred while deleting object.').' $this->_errors[] = Tools::displayError('An error occurred while deleting object.').'
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)'); <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
} }
else if ($this->action == 'status')
/**
* @see AdminController::processStatus()
* @param $token
*/
public function processStatus($token)
{ {
if (Validate::isLoadedObject($object = $this->loadObject())) if (Validate::isLoadedObject($object = $this->loadObject()))
{ {
@@ -284,13 +291,30 @@ class AdminCurrenciesControllerCore extends AdminController
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.').' $this->_errors[] = Tools::displayError('An error occurred while updating status for object.').'
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)'); <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
} }
else if (Tools::isSubmit('submitExchangesRates'))
/**
* Update currency exchange rates
* @param $token
*/
public function processExchangeRates($token)
{ {
if (!$this->_errors[] = Currency::refreshCurrencies()) if (!$this->_errors[] = Currency::refreshCurrencies())
Tools::redirectAdmin(self::$currentIndex.'&conf=6'.'&token='.$this->token); Tools::redirectAdmin(self::$currentIndex . '&conf=6' . '&token=' . $this->token);
} }
/**
* @see AdminController::initProcess()
*/
public function initProcess()
{
if (Tools::isSubmit('submitExchangesRates'))
{
if ($this->tabAccess['edit'] === '1')
$this->action = 'exchangeRates';
else else
parent::postProcess(); $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
parent::initProcess();
} }
public function updateOptionPsCurrencyDefault($value) public function updateOptionPsCurrencyDefault($value)