// Fixed supplier addresses

This commit is contained in:
bMancone
2012-03-27 12:25:43 +00:00
parent 0b4a3b7763
commit feb7682e67
2 changed files with 9 additions and 3 deletions
@@ -399,7 +399,8 @@ class AdminSuppliersControllerCore extends AdminController
$this->errors[] = $this->l('It is not possible to delete a supplier if there are any pending supply order.');
else
{
$address = new Address($obj->id_address);
$id_address = Address::getAddressIdBySupplierId($obj->id);
$address = new Address($id_address);
if (Validate::isLoadedObject($address))
{
$address->deleted = 1;
@@ -417,7 +418,8 @@ class AdminSuppliersControllerCore extends AdminController
*/
protected function afterAdd($object)
{
$address = new Address($object->id_address);
$id_address = (int)$_POST['id_address'];
$address = new Address($id_address);
if (Validate::isLoadedObject($address))
{
$address->id_supplier = $object->id;
@@ -432,7 +434,8 @@ class AdminSuppliersControllerCore extends AdminController
*/
protected function afterUpdate($object)
{
$address = new Address($object->id_address);
$id_address = (int)$_POST['id_address'];
$address = new Address($id_address);
if (Validate::isLoadedObject($address))
{
if ($address->id_supplier != $object->id)