From ed17d511def0b2dd0232ea8742cb4cb934fd5ccf Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Fri, 9 Mar 2012 09:57:17 +0000 Subject: [PATCH] [-] BO : fix bug #PSTEST-1003 - Saving product attached documents redirect to informations tab --- controllers/admin/AdminProductsController.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 9c9e5297c..05c81c21e 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -408,14 +408,13 @@ class AdminProductsControllerCore extends AdminController */ public function processAttachments($token) { - if ($this->action == 'attachments') - if ($id = (int)Tools::getValue($this->identifier)) - { - $attachments = trim(Tools::getValue('arrayAttachments'), ','); - $attachments = explode(',', $attachments); - if (Attachment::attachToProduct($id, $attachments)) - $this->redirect_after = self::$currentIndex.'&id_product='.(int)$id.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&conf=4&add'.$this->table.'&action=Attachments&token='.($token ? $token : $this->token); - } + if ($id = (int)Tools::getValue($this->identifier)) + { + $attachments = trim(Tools::getValue('arrayAttachments'), ','); + $attachments = explode(',', $attachments); + if (!Attachment::attachToProduct($id, $attachments)) + $this->errors[] = Tools::displayError('There was an error while saving product attachments.'); + } } public function processDuplicate($token) @@ -1541,6 +1540,7 @@ class AdminProductsControllerCore extends AdminController $this->processProductAttribute($token); $this->processPriceAddition($token); $this->processSpecificPricePriorities($token); + $this->processAttachments($token); $this->object->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group')); if (!$this->updatePackItems($object)) $this->errors[] = Tools::displayError('An error occurred while adding products to the pack.');