From adda69b5f6e5db846a181eb68e23a6ce39b867fe Mon Sep 17 00:00:00 2001 From: lLefevre Date: Tue, 29 Nov 2011 15:18:10 +0000 Subject: [PATCH] // fix remove button delete for AdminCountriesController --- admin-dev/header.inc.php | 2 +- .../admin/AdminCountriesController.php | 74 +++++++++---------- 2 files changed, 35 insertions(+), 41 deletions(-) diff --git a/admin-dev/header.inc.php b/admin-dev/header.inc.php index 68d018b58..abdc145c7 100644 --- a/admin-dev/header.inc.php +++ b/admin-dev/header.inc.php @@ -220,7 +220,7 @@ echo ' var html = ""; '; } echo ' - '.translate('My preferences').' + '.translate('My preferences').' '.Tools::substr(Context::getContext()->employee->firstname, 0, 1).'. '.htmlentities(Context::getContext()->employee->lastname, ENT_COMPAT, 'UTF-8').' diff --git a/controllers/admin/AdminCountriesController.php b/controllers/admin/AdminCountriesController.php index 713fffbc6..b839610de 100644 --- a/controllers/admin/AdminCountriesController.php +++ b/controllers/admin/AdminCountriesController.php @@ -35,7 +35,6 @@ class AdminCountriesControllerCore extends AdminController $this->deleted = false; $this->addRowAction('edit'); - $this->addRowAction('delete'); $this->requiredDatabase = true; @@ -111,7 +110,7 @@ class AdminCountriesControllerCore extends AdminController parent::__construct(); } - + /** * AdminController::setMedia() override * @see AdminController::setMedia() @@ -119,7 +118,7 @@ class AdminCountriesControllerCore extends AdminController public function setMedia() { parent::setMedia(); - + $this->addJqueryPlugin('fieldselection'); } @@ -358,48 +357,43 @@ class AdminCountriesControllerCore extends AdminController public function postProcess() { - if (isset($_GET['delete'.$this->table]) || Tools::getValue('submitDel'.$this->table)) - $this->_errors[] = Tools::displayError('You cannot delete a country. If you do not want it available for customers, please disable it.'); - else + if (Tools::getValue('submitAdd'.$this->table)) { - if (Tools::getValue('submitAdd'.$this->table)) + $id_country = Tools::getValue('id_country'); + $tmp_addr_format = new AddressFormat($id_country); + + $save_status = false; + + $is_new = is_null($tmp_addr_format->id_country); + if ($is_new) { - $id_country = Tools::getValue('id_country'); - $tmp_addr_format = new AddressFormat($id_country); - - $save_status = false; - - $is_new = is_null($tmp_addr_format->id_country); - if ($is_new) - { - $tmp_addr_format = new AddressFormat(); - $tmp_addr_format->id_country = $id_country; - } - - $object = new $this->className(); - $this->updateAssoShop($object->id); - - $tmp_addr_format->format = Tools::getValue('address_layout'); - - if (strlen($tmp_addr_format->format) > 0) - { - if ($tmp_addr_format->checkFormatFields()) - $save_status = ($is_new) ? $tmp_addr_format->save(): $tmp_addr_format->update(); - else - { - $error_list = $tmp_addr_format->getErrorList(); - foreach ($error_list as $num_error => $error) - $this->_errors[] = $error; - } - - if (!$save_status) - $this->_errors[] = Tools::displayError('Invalid address layout'.Db::getInstance()->getMsgError()); - } - unset($tmp_addr_format); + $tmp_addr_format = new AddressFormat(); + $tmp_addr_format->id_country = $id_country; } - return parent::postProcess(); + $object = new $this->className(); + $this->updateAssoShop($object->id); + + $tmp_addr_format->format = Tools::getValue('address_layout'); + + if (strlen($tmp_addr_format->format) > 0) + { + if ($tmp_addr_format->checkFormatFields()) + $save_status = ($is_new) ? $tmp_addr_format->save(): $tmp_addr_format->update(); + else + { + $error_list = $tmp_addr_format->getErrorList(); + foreach ($error_list as $num_error => $error) + $this->_errors[] = $error; + } + + if (!$save_status) + $this->_errors[] = Tools::displayError('Invalid address layout'.Db::getInstance()->getMsgError()); + } + unset($tmp_addr_format); } + + return parent::postProcess(); } private function displayValidFields()