// Fixed supplier addresses
This commit is contained in:
@@ -355,6 +355,9 @@ class AddressCore extends ObjectModel
|
|||||||
$query->from('address');
|
$query->from('address');
|
||||||
$query->where('id_supplier = '.(int)$id_supplier);
|
$query->where('id_supplier = '.(int)$id_supplier);
|
||||||
$query->where('deleted = 0');
|
$query->where('deleted = 0');
|
||||||
|
$query->where('id_customer = 0');
|
||||||
|
$query->where('id_manufacturer = 0');
|
||||||
|
$query->where('id_warehouse = 0');
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.');
|
$this->errors[] = $this->l('It is not possible to delete a supplier if there are any pending supply order.');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$address = new Address($obj->id_address);
|
$id_address = Address::getAddressIdBySupplierId($obj->id);
|
||||||
|
$address = new Address($id_address);
|
||||||
if (Validate::isLoadedObject($address))
|
if (Validate::isLoadedObject($address))
|
||||||
{
|
{
|
||||||
$address->deleted = 1;
|
$address->deleted = 1;
|
||||||
@@ -417,7 +418,8 @@ class AdminSuppliersControllerCore extends AdminController
|
|||||||
*/
|
*/
|
||||||
protected function afterAdd($object)
|
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))
|
if (Validate::isLoadedObject($address))
|
||||||
{
|
{
|
||||||
$address->id_supplier = $object->id;
|
$address->id_supplier = $object->id;
|
||||||
@@ -432,7 +434,8 @@ class AdminSuppliersControllerCore extends AdminController
|
|||||||
*/
|
*/
|
||||||
protected function afterUpdate($object)
|
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 (Validate::isLoadedObject($address))
|
||||||
{
|
{
|
||||||
if ($address->id_supplier != $object->id)
|
if ($address->id_supplier != $object->id)
|
||||||
|
|||||||
Reference in New Issue
Block a user