From e43e69a4d4f01e46403d3bf8cc025ec346222d0a Mon Sep 17 00:00:00 2001 From: lLefevre Date: Mon, 15 Oct 2012 08:15:18 +0000 Subject: [PATCH] [-] BO : fix #PSCFV-4766 --- classes/controller/AdminController.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 2e84b1a5b..5620561a2 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -636,30 +636,30 @@ class AdminControllerCore extends Controller $this->validateRules(); if (count($this->errors) <= 0) { - $object = new $this->className(); + $this->object = new $this->className(); - $this->copyFromPost($object, $this->table); - $this->beforeAdd($object); - if (method_exists($object, 'add') && !$object->add()) + $this->copyFromPost($this->object, $this->table); + $this->beforeAdd($this->object); + if (method_exists($this->object, 'add') && !$this->object->add()) { $this->errors[] = Tools::displayError('An error occurred while creating object.'). ' '.$this->table.' ('.Db::getInstance()->getMsgError().')'; } /* voluntary do affectation here */ - elseif (($_POST[$this->identifier] = $object->id) && $this->postImage($object->id) && !count($this->errors) && $this->_redirect) + elseif (($_POST[$this->identifier] = $this->object->id) && $this->postImage($this->object->id) && !count($this->errors) && $this->_redirect) { $parent_id = (int)Tools::getValue('id_parent', 1); - $this->afterAdd($object); - $this->updateAssoShop($object->id); + $this->afterAdd($this->object); + $this->updateAssoShop($this->object->id); // Save and stay on same form if (empty($this->redirect_after) && $this->redirect_after !== false && Tools::isSubmit('submitAdd'.$this->table.'AndStay')) - $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&update'.$this->table.'&token='.$this->token; + $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$this->object->id.'&conf=3&update'.$this->table.'&token='.$this->token; // Save and back to parent if (empty($this->redirect_after) && $this->redirect_after !== false && Tools::isSubmit('submitAdd'.$this->table.'AndBackToParent')) $this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$parent_id.'&conf=3&token='.$this->token; // Default behavior (save and back) if (empty($this->redirect_after) && $this->redirect_after !== false) - $this->redirect_after = self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$object->id : '').'&conf=3&token='.$this->token; + $this->redirect_after = self::$currentIndex.($parent_id ? '&'.$this->identifier.'='.$this->object->id : '').'&conf=3&token='.$this->token; } }