[-] BO: fix PSCFV-3681 - addresses of warehouses cant be updated

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16924 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard committed 2012-08-21 09:08:02 +00:00
1 parent 6277b71d20
commit e353808db3
1 file changed
+12 -8
@@ -501,12 +501,22 @@ class AdminWarehousesControllerCore extends AdminController
if (!($obj = $this->loadObject(true))) if (!($obj = $this->loadObject(true)))
return; return;
$this->updateAddress();
// hack for enable the possibility to update a warehouse without recreate new id
$this->deleted = false;
return parent::processAdd();
}
}
protected function updateAddress()
{
// updates/creates address if it does not exist // updates/creates address if it does not exist
if (Tools::isSubmit('id_address') && (int)Tools::getValue('id_address') > 0) if (Tools::isSubmit('id_address') && (int)Tools::getValue('id_address') > 0)
$address = new Address((int)Tools::getValue('id_address')); // updates address $address = new Address((int)Tools::getValue('id_address')); // updates address
else else
$address = new Address(); // creates address $address = new Address(); // creates address
// sets the address // sets the address
$address->alias = Tools::getValue('reference', null); $address->alias = Tools::getValue('reference', null);
$address->lastname = 'warehouse'; // skip problem with numeric characters in warehouse name $address->lastname = 'warehouse'; // skip problem with numeric characters in warehouse name
@@ -539,12 +549,6 @@ class AdminWarehousesControllerCore extends AdminController
$_POST['id_address'] = $address->id; $_POST['id_address'] = $address->id;
} }
} }
// hack for enable the possibility to update a warehouse without recreate new id
$this->deleted = false;
return parent::processAdd();
}
} }
/** /**
@@ -585,7 +589,7 @@ class AdminWarehousesControllerCore extends AdminController
// loads object // loads object
if (!($obj = $this->loadObject(true))) if (!($obj = $this->loadObject(true)))
return; return;
$this->updateAddress();
// handles carriers associations // handles carriers associations
$obj->setCarriers(Tools::getValue('ids_carriers'), array()); $obj->setCarriers(Tools::getValue('ids_carriers'), array());