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() */