From 422da7c69acc2976dbf386544760d84e1ca658d5 Mon Sep 17 00:00:00 2001 From: bMancone Date: Tue, 17 Apr 2012 12:21:22 +0000 Subject: [PATCH] // Fixed warehouses/carriers associations - #PI-134 --- .../admin/AdminWarehousesController.php | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/controllers/admin/AdminWarehousesController.php b/controllers/admin/AdminWarehousesController.php index a73ab5922..837fcf608 100644 --- a/controllers/admin/AdminWarehousesController.php +++ b/controllers/admin/AdminWarehousesController.php @@ -538,18 +538,6 @@ class AdminWarehousesControllerCore extends AdminController } } - // if updating - if ($obj->id > 0) - { - // handles shops associations - if (Tools::isSubmit('ids_shops')) - $obj->setShops(Tools::getValue('ids_shops')); - - // handles carriers associations - if (Tools::isSubmit('ids_carriers')) - $obj->setCarriers(Tools::getValue('ids_carriers')); - } - // hack for enable the possibility to update a warehouse without recreate new id $this->deleted = false; @@ -588,6 +576,25 @@ class AdminWarehousesControllerCore extends AdminController } } + /** + * @see AdminController::processUpdate(); + */ + public function processUpdate() + { + if (!($obj = $this->loadObject(true))) + return; + + // handles shops associations + if (Tools::isSubmit('ids_shops')) + $obj->setShops(Tools::getValue('ids_shops')); + + // handles carriers associations + $obj->setCarriers(Tools::getValue('ids_carriers'), array()); + + + return parent::processUpdate(); + } + /** * @see AdminController::initProcess() */