// Warehouse: when being flaged as deleted, fixed deletion of associations with carriers, products, shops. StockInterfaces: fixed size of the filters

This commit is contained in:
bMancone
2011-12-22 13:58:16 +00:00
parent 66d84c6bd1
commit 73a09574ec
5 changed files with 31 additions and 6 deletions
@@ -437,14 +437,21 @@ class AdminWarehousesControllerCore extends AdminController
if (!($obj = $this->loadObject(true)))
return;
else if ($obj->getQuantitiesOfProducts() > 0)
$this->_errors[] = $this->l('It is not possible to delete a Warehosue when there are products in it.');
$this->_errors[] = $this->l('It is not possible to delete a Warehouse when there are products in it.');
else if (SupplyOrder::warehouseHasPendingOrders($obj->id))
$this->_errors[] = $this->l('It is not possible to delete a Warehouse if it has pending supply orders.');
else
{
// sets the address of the warehouse as deleted
$address = new Address($obj->id_address);
$address->deleted = 1;
$address->save();
// removes associations
$obj->setCarriers(array());
$obj->setShops(array());
$obj->resetProductsLocations();
return parent::postProcess();
}
}