From ccad5bbab84d1368d2b48f3d16aa013bc98edb89 Mon Sep 17 00:00:00 2001 From: mMarinetti Date: Wed, 21 Dec 2011 20:36:17 +0000 Subject: [PATCH] // reported fix from 1.4.x --- controllers/admin/AdminBackupController.php | 1 + controllers/admin/AdminCategoriesController.php | 3 +++ controllers/admin/AdminCustomerThreadsController.php | 6 +++--- controllers/admin/AdminImportController.php | 7 ++++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/controllers/admin/AdminBackupController.php b/controllers/admin/AdminBackupController.php index 2e6eeee63..3c32ee847 100644 --- a/controllers/admin/AdminBackupController.php +++ b/controllers/admin/AdminBackupController.php @@ -142,6 +142,7 @@ class AdminBackupControllerCore extends AdminController 'content' => $this->content, 'url_post' => self::$currentIndex.'&token='.$this->token, )); + parent::initContent(); } /** diff --git a/controllers/admin/AdminCategoriesController.php b/controllers/admin/AdminCategoriesController.php index ce7279d00..efc90314f 100644 --- a/controllers/admin/AdminCategoriesController.php +++ b/controllers/admin/AdminCategoriesController.php @@ -372,7 +372,10 @@ class AdminCategoriesControllerCore extends AdminController if (!$object->updatePosition((int)Tools::getValue('way'), (int)Tools::getValue('position'))) $this->_errors[] = Tools::displayError('Failed to update the position.'); else + { + $object->regenerateEntireNtree(); Tools::redirectAdmin(self::$currentIndex.'&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&conf=5'.(($id_category = (int)Tools::getValue($this->identifier, Tools::getValue('id_category_parent', 1))) ? ('&'.$this->identifier.'='.$id_category) : '').'&token='.Tools::getAdminTokenLite('AdminCategories')); + } } /* Delete multiple objects */ else if (Tools::getValue('submitDel'.$this->table)) diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php index 633aec9af..753f1d3c9 100644 --- a/controllers/admin/AdminCustomerThreadsController.php +++ b/controllers/admin/AdminCustomerThreadsController.php @@ -315,9 +315,9 @@ class AdminCustomerThreadsControllerCore extends AdminController '{comment}' => stripslashes($_POST['message_forward'])); if (Mail::Send( - (int)$cookie->id_lang, + $this->context->language->id, 'forward_msg', - Mail::l('Fwd: Customer message', (int)$cookie->id_lang), + Mail::l('Fwd: Customer message', $this->context->language->id), $params, $email, null, $current_employee->email, $current_employee->firstname.' '.$current_employee->lastname, null, null, _PS_MAIL_DIR_, true)) @@ -357,7 +357,7 @@ class AdminCustomerThreadsControllerCore extends AdminController ); //#ct == id_customer_thread #tc == token of thread <== used in the synchronization imap if (Mail::Send( - $ct->id_lang, + (int)$ct->id_lang, 'reply_msg', Mail::l('An answer to your message is available', $ct->id_lang).' #ct'.$ct->id.'#tc'.$ct->token, $params, Tools::getValue('msg_email'), null, null, null, $file_attachment, null, diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 5170261d3..5824b1ec9 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -801,9 +801,10 @@ class AdminImportControllerCore extends AdminController $category->doNotRegenerateNTree = true; // If id category AND id category already in base, trying to update - if ($category->id && $category->categoryExists($category->id)) + if ($category->id && $category->categoryExists($category->id) && $category->id != 1) $res = $category->update(); - + if ($category->id == 1) + $this->_errors[] = Tools::displayError('Root category cannot be modify'); // If no id_category or update failed if (!$res) $res = $category->add(); @@ -1840,4 +1841,4 @@ class AdminImportControllerCore extends AdminController { $this->warnings[] = $product_name.(isset($product_id) ? ' (ID '.$product_id.')' : '').' '.Tools::displayError($message); } -} \ No newline at end of file +}