// Fixed #PSFV-521
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13461 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+6
-2
@@ -3960,12 +3960,16 @@ class ProductCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function addStockMvt($quantity, $id_reason, $id_product_attribute = null, $id_order = null, $id_employee = null)
|
public function addStockMvt($quantity, $id_reason, $id_product_attribute = null, $id_order = null, $id_employee = null)
|
||||||
{
|
{
|
||||||
if (!$this->id)
|
if (!$this->id || !$id_reason)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if ($id_product_attribute == null)
|
if ($id_product_attribute == null)
|
||||||
$id_product_attribute = 0;
|
$id_product_attribute = 0;
|
||||||
|
|
||||||
|
$reason = new StockMvtReason((int)$id_reason);
|
||||||
|
if (!Validate::isLoadedObject($reason))
|
||||||
|
return false;
|
||||||
|
|
||||||
$quantity = abs((int)$quantity) * $reason->sign;
|
$quantity = abs((int)$quantity) * $reason->sign;
|
||||||
|
|
||||||
return StockAvailable::updateQuantity($this->id, $id_product_attribute, $quantity);
|
return StockAvailable::updateQuantity($this->id, $id_product_attribute, $quantity);
|
||||||
|
|||||||
Reference in New Issue
Block a user