From 7f2c6dc6ebbdcf0aa7f9b0df530145a1a791c7e6 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sat, 3 Nov 2012 14:44:06 +0100
Subject: [PATCH] Only code comments

---
 htdocs/product/stock/class/mouvementstock.class.php | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php
index e7a30ab3c96..870987ea240 100644
--- a/htdocs/product/stock/class/mouvementstock.class.php
+++ b/htdocs/product/stock/class/mouvementstock.class.php
@@ -52,7 +52,7 @@ class MouvementStock
 	 *	@param		int		$type			Direction of movement:
 	 *										0=input (stock increase after stock transfert), 1=output (stock decrease after stock transfer),
 	 *										2=output (stock decrease), 3=input (stock increase)
-	 *	@param		int		$price			Unit price HT of product
+	 *	@param		int		$price			Unit price HT of product, used to calculate average weighted price (PMP in french). If 0, average weighted price is not changed.
 	 *	@param		string	$label			Label of stock movement
 	 *	@param		string	$datem			Force date of movement
 	 *	@return		int						<0 if KO, 0 if fk_product is null, >0 if OK
@@ -78,6 +78,7 @@ class MouvementStock
 			return -1;
 		}
 
+		// Define if we must make the stock change (If product type is a service or if stock is used also for services)
 		$movestock=0;
 		if ($product->type != 1 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) $movestock=1;
 
@@ -211,16 +212,9 @@ class MouvementStock
 		// Add movement for sub products (recursive call)
 		if (! $error && ! empty($conf->global->PRODUIT_SOUSPRODUITS))
 		{
-			$error = $this->_createSubProduct($user, $fk_product, $entrepot_id, $qty, $type, 0, $label);	// pmp is not change for subproduct
+			$error = $this->_createSubProduct($user, $fk_product, $entrepot_id, $qty, $type, 0, $label);	// we use 0 as price, because pmp is not changed for subproduct
 		}
 
-		// Composition module (this is an external module)
-		/* Removed. This code must be provided by module on trigger STOCK_MOVEMENT
-		if (! $error && $qty < 0 && ! empty($conf->global->MAIN_MODULE_COMPOSITION))
-		{
-			$error = $this->_createProductComposition($user, $fk_product, $entrepot_id, $qty, $type, 0, $label);	// pmp is not change for subproduct
-		}*/
-
 		if ($movestock && ! $error)
 		{
 			// Appel des triggers
-- 
GitLab