// stock : bugs fix and update of supplier order add product interface

This commit is contained in:
dSevere
2011-11-08 15:45:45 +00:00
parent 63c2159a98
commit 4812e7baf4
7 changed files with 78 additions and 28 deletions
+4 -4
View File
@@ -263,17 +263,17 @@ class StockAvailableCore extends ObjectModel
WHERE id_stock_available = '.(int)$id_stock_available);
}
}
/**
* For a given id_product and id_product_attribute update the quantity available
*/
public static function updateQuantity($id_product, $id_product_attribute, $delta_quantity, $id_shop = null)
{
$id_stock = self::getIdStockAvailable($id_product, $id_product_attribute, $id_shop);
if (!$id_stock)
return false;
// Update quantity of the pack products
if (Pack::isPack($id_product))
{
@@ -284,7 +284,7 @@ class StockAvailableCore extends ObjectModel
self::updateQuantity($product_pack->id, $pack_id_product_attribute, $product_pack->pack_quantity * $delta_quantity, $id_shop);
}
}
$stock_available = new StockAvailable($id_stock);
$stock_available->quantity = $stock_available->quantity + $delta_quantity;
$stock_available->save();
+11
View File
@@ -365,4 +365,15 @@ class SupplierOrderCore extends ObjectModel
$history->save();
}
/**
* Remove all products in the order
*/
public function resetProducts()
{
$products = $this->getEntriesCollection();
foreach ($products as $p)
$p->delete();
}
}