From f0a1fc667b4e38e7697c4086949f5033a4f12aca Mon Sep 17 00:00:00 2001 From: bMancone Date: Mon, 19 Dec 2011 09:10:21 +0000 Subject: [PATCH] // StockMvt : added id_warehouse as part of the params of getNegativeStockMvts() git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11334 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/stock/StockMvt.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/classes/stock/StockMvt.php b/classes/stock/StockMvt.php index 15aa6b5ef..4523d8d0b 100644 --- a/classes/stock/StockMvt.php +++ b/classes/stock/StockMvt.php @@ -168,16 +168,18 @@ class StockMvtCore extends ObjectModel } /** - * Gets the negative stock mvts that correspond to the given order, for the given product, in the given quantity + * Gets the negative (decrements the stock) stock mvts that correspond to the given order, for : + * the given product, in the given quantity. * * @since 1.5.0 * @param int $id_order * @param int $id_product * @param int $id_product_attribute * @param int $quantity + * @param int $id_warehouse Optional * @return Array mvts */ - public static function getNegativeStockMvts($id_order, $id_product, $id_product_attribute, $quantity) + public static function getNegativeStockMvts($id_order, $id_product, $id_product_attribute, $quantity, $id_warehouse = null) { $mvts = array(); $quantity_total = 0; @@ -189,6 +191,8 @@ class StockMvtCore extends ObjectModel $query->where('sm.sign = -1'); $query->where('sm.id_order = '.(int)$id_order); $query->where('s.id_product = '.(int)$id_product.' AND s.id_product_attribute = '.(int)$id_product_attribute); + if (!is_null($id_warehouse)) + $query->where('s.id_warehouse = '.(int)$id_warehouse); $query->orderBy('date_add DESC'); $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->query($query); @@ -202,4 +206,5 @@ class StockMvtCore extends ObjectModel return $mvts; } -} \ No newline at end of file + +}