diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index eebd5a35c4f..3be832dcea3 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5111,7 +5111,7 @@ class Product extends CommonObject * * @param User $user user asking change * @param int $id_entrepot id of warehouse - * @param double $nbpiece nb of units + * @param double $nbpiece nb of units (should be always positive, use $movement to decide if we add or remove) * @param int $movement 0 = add, 1 = remove * @param string $label Label of stock movement * @param double $price Unit price HT of product, used to calculate average weighted price (PMP in french). If 0, average weighted price is not changed. @@ -5133,7 +5133,7 @@ class Product extends CommonObject if (!$movement) { $movement = 1; } - $nbpiece *= -1; + $nbpiece = abs($nbpiece); } $op[0] = "+".trim($nbpiece); @@ -5162,7 +5162,7 @@ class Product extends CommonObject * * @param User $user user asking change * @param int $id_entrepot id of warehouse - * @param double $nbpiece nb of units + * @param double $nbpiece nb of units (should be always positive, use $movement to decide if we add or remove) * @param int $movement 0 = add, 1 = remove * @param string $label Label of stock movement * @param double $price Price to use for stock eval @@ -5187,7 +5187,7 @@ class Product extends CommonObject if (!$movement) { $movement = 1; } - $nbpiece *= -1; + $nbpiece = abs($nbpiece); } $op[0] = "+".trim($nbpiece);