[-] BO: Fix some bugs on advanced stock management

This commit is contained in:
rGaillard
2012-07-16 18:29:34 +00:00
parent 399526e451
commit 10d148782a
6 changed files with 81 additions and 75 deletions
+7 -21
View File
@@ -127,27 +127,6 @@ class WarehouseCore extends ObjectModel
return $res;
}
/**
* Sets the shops associated to the current warehouse
*
* @param array $ids_shop Ids to set
*/
public function setShops($ids_shop)
{
if (!is_array($ids_shop))
$ids_shop = array();
$row_to_insert = array();
foreach ($ids_shop as $id_shop)
$row_to_insert[] = array($this->def['primary'] => $this->id, 'id_shop' => (int)$id_shop);
Db::getInstance()->execute('
DELETE FROM '._DB_PREFIX_.'warehouse_shop
WHERE '.$this->def['primary'].' = '.(int)$this->id);
Db::getInstance()->insert('warehouse_shop', $row_to_insert);
}
/**
* Gets the carriers associated to the current warehouse
*
@@ -551,6 +530,13 @@ class WarehouseCore extends ObjectModel
$res = call_user_func_array('array_intersect', $list);
return $res;
}
public function resetStockAvailable()
{
$products = WarehouseProductLocation::getProducts((int)$this->id);
foreach ($products as $product)
StockAvailable::synchronize((int)$product['id_product']);
}
/*********************************\
*