From 8fc5329fe920b137ff4e3d77d07543fb139444ce Mon Sep 17 00:00:00 2001 From: bMancone Date: Mon, 20 Feb 2012 13:58:19 +0000 Subject: [PATCH] // Fixed #PSFV-521 git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13461 b9a71923-0436-4b27-9f14-aed3839534dd --- 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);