From b08468ecd73bdf9bc31c5f2d783b166c9a7fb25e Mon Sep 17 00:00:00 2001 From: bMancone Date: Mon, 20 Feb 2012 13:58:19 +0000 Subject: [PATCH] // Fixed #PSFV-521 --- classes/Product.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/Product.php b/classes/Product.php index b63289ca1..bc4ff4be2 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -3960,12 +3960,16 @@ class ProductCore extends ObjectModel */ public function addStockMvt($quantity, $id_reason, $id_product_attribute = null, $id_order = null, $id_employee = null) { - if (!$this->id) - return; + if (!$this->id || !$id_reason) + return false; if ($id_product_attribute == null) $id_product_attribute = 0; + $reason = new StockMvtReason((int)$id_reason); + if (!Validate::isLoadedObject($reason)) + return false; + $quantity = abs((int)$quantity) * $reason->sign; return StockAvailable::updateQuantity($this->id, $id_product_attribute, $quantity);