From d2d63bcb81bb92cb999fee526708587e02d5e907 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Wed, 2 Jun 2010 08:34:44 +0000
Subject: [PATCH] Fix: Fix a lot of broken features when renaming produit to
 product

---
 htdocs/comm/addpropal.php                     |  6 +-
 htdocs/comm/propal.php                        |  4 +-
 htdocs/commande/fiche.php                     |  8 +--
 htdocs/compta/facture.php                     |  8 +--
 htdocs/contrat/fiche.php                      |  4 +-
 htdocs/core/class/conf.class.php              |  7 +-
 htdocs/core/photos_resize.php                 | 20 ++++--
 htdocs/document.php                           |  2 +-
 htdocs/fourn/product/fourn.php                |  2 +-
 htdocs/fourn/product/photos.php               |  4 +-
 htdocs/lib/images.lib.php                     |  3 +-
 htdocs/main.inc.php                           |  2 +-
 .../canvas/default/product.default.class.php  | 66 +++++++++----------
 htdocs/product/class/product.class.php        |  2 +-
 htdocs/product/document.php                   |  2 +-
 htdocs/product/fiche.php                      |  4 +-
 htdocs/product/photos.php                     |  2 +-
 htdocs/product/price.php                      |  4 +-
 htdocs/product/stats/fiche.php                |  2 +-
 htdocs/viewimage.php                          |  6 +-
 20 files changed, 86 insertions(+), 72 deletions(-)

diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php
index 03674a54683..4d6718a0915 100644
--- a/htdocs/comm/addpropal.php
+++ b/htdocs/comm/addpropal.php
@@ -87,7 +87,7 @@ if ($_GET["action"] == 'create')
 	$sql.= " FROM ".MAIN_DB_PREFIX."propal";
 	$sql.= " WHERE ref LIKE '".$numpr."%'";
 	$sql.= " AND entity = ".$conf->entity;
-	
+
 	$resql=$db->query($sql);
 	if ($resql)
 	{
@@ -293,9 +293,9 @@ if ($_GET["action"] == 'create')
 				print '<tr><td>';
 				// multiprix
 				if($conf->global->PRODUIT_MULTIPRICES && $soc->price_level)
-				$html->select_produits('',"idprod".$i,'',$conf->produit->limit_size,$soc->price_level);
+				$html->select_produits('',"idprod".$i,'',$conf->product->limit_size,$soc->price_level);
 				else
-				$html->select_produits('',"idprod".$i,'',$conf->produit->limit_size);
+				$html->select_produits('',"idprod".$i,'',$conf->product->limit_size);
 				print '</td>';
 				print '<td><input type="text" size="2" name="qty'.$i.'" value="1"></td>';
 				print '<td><input type="text" size="2" name="remise'.$i.'" value="'.$soc->remise_client.'">%</td>';
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 836e02c62e6..9648fb703ad 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -1780,11 +1780,11 @@ if ($id > 0 || ! empty($ref))
 			// multiprix
 			if($conf->global->PRODUIT_MULTIPRICES)
 			{
-				$html->select_produits('','idprod','',$conf->produit->limit_size,$societe->price_level);
+				$html->select_produits('','idprod','',$conf->product->limit_size,$societe->price_level);
 			}
 			else
 			{
-				$html->select_produits('','idprod','',$conf->produit->limit_size);
+				$html->select_produits('','idprod','',$conf->product->limit_size);
 			}
 			if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
 
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 7ae856a9a41..5dc4e65c069 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -1174,9 +1174,9 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
 						print '<tr><td>';
 						// multiprix
 						if($conf->global->PRODUIT_MULTIPRICES)
-						print $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size,$soc->price_level);
+						print $html->select_produits('','idprod'.$i,'',$conf->product->limit_size,$soc->price_level);
 						else
-						print $html->select_produits('','idprod'.$i,'',$conf->produit->limit_size);
+						print $html->select_produits('','idprod'.$i,'',$conf->product->limit_size);
 						print '</td>';
 						print '<td><input type="text" size="3" name="qty'.$i.'" value="1"></td>';
 						print '<td><input type="text" size="3" name="remise_percent'.$i.'" value="'.$soc->remise_client.'">%</td></tr>';
@@ -2019,11 +2019,11 @@ else
 					// multiprix
 					if($conf->global->PRODUIT_MULTIPRICES)
 					{
-						$html->select_produits('','idprod','',$conf->produit->limit_size,$soc->price_level);
+						$html->select_produits('','idprod','',$conf->product->limit_size,$soc->price_level);
 					}
 					else
 					{
-						$html->select_produits('','idprod','',$conf->produit->limit_size);
+						$html->select_produits('','idprod','',$conf->product->limit_size);
 					}
 
 					if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index b9a94675da3..18ab40b29c7 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1697,9 +1697,9 @@ if ($_GET['action'] == 'create')
 				print '<td>';
 				// multiprix
 				if($conf->global->PRODUIT_MULTIPRICES)
-				$html->select_produits('','idprod'.$i,'',$conf->produit->limit_size,$soc->price_level);
+				$html->select_produits('','idprod'.$i,'',$conf->product->limit_size,$soc->price_level);
 				else
-				$html->select_produits('','idprod'.$i,'',$conf->produit->limit_size);
+				$html->select_produits('','idprod'.$i,'',$conf->product->limit_size);
 				print '</td>';
 				print '<td><input type="text" size="2" name="qty'.$i.'" value="1"></td>';
 				print '<td nowrap="nowrap"><input type="text" size="1" name="remise_percent'.$i.'" value="'.$soc->remise_client.'">%</td>';
@@ -3065,11 +3065,11 @@ else
 					// multiprix
 					if($conf->global->PRODUIT_MULTIPRICES)
 					{
-						$html->select_produits((! empty($_POST['idprod'])?$_POST['idprod']:''),'idprod','',$conf->produit->limit_size,$soc->price_level);
+						$html->select_produits((! empty($_POST['idprod'])?$_POST['idprod']:''),'idprod','',$conf->product->limit_size,$soc->price_level);
 					}
 					else
 					{
-						$html->select_produits((! empty($_POST['idprod'])?$_POST['idprod']:''),'idprod','',$conf->produit->limit_size);
+						$html->select_produits((! empty($_POST['idprod'])?$_POST['idprod']:''),'idprod','',$conf->product->limit_size);
 					}
 
 					if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php
index 3e54e2dad22..8e458fec911 100644
--- a/htdocs/contrat/fiche.php
+++ b/htdocs/contrat/fiche.php
@@ -1214,9 +1214,9 @@ else
 			print '<td colspan="3">';
 			// multiprix
 			if($conf->global->PRODUIT_MULTIPRICES)
-				$form->select_produits('','p_idprod',1,$conf->produit->limit_size,$contrat->societe->price_level);
+				$form->select_produits('','p_idprod',1,$conf->product->limit_size,$contrat->societe->price_level);
 			else
-				$form->select_produits('','p_idprod',1,$conf->produit->limit_size);
+				$form->select_produits('','p_idprod',1,$conf->product->limit_size);
 			if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
 			print '<textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea>';
 			print '</td>';
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 972966646d3..6f98527a6ed 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -341,9 +341,9 @@ class Conf
 		if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25;
 		$this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT;
 
-		// $this->produit->limit_size = constante de taille maximale des select de produit
+		// $this->product->limit_size = constante de taille maximale des select de produit
 		if (! isset($this->global->PRODUIT_LIMIT_SIZE)) $this->global->PRODUIT_LIMIT_SIZE=100;
-		$this->produit->limit_size=$this->global->PRODUIT_LIMIT_SIZE;
+		$this->product->limit_size=$this->global->PRODUIT_LIMIT_SIZE;
 
 		// $this->theme et $this->css
 		if (empty($this->global->MAIN_THEME)) $this->global->MAIN_THEME="eldy";
@@ -412,6 +412,9 @@ class Conf
 		$this->adherent->cotisation->warning_delay=$this->global->MAIN_DELAY_MEMBERS*24*60*60;
 		$this->bank->rappro->warning_delay=$this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE*24*60*60;
 		$this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60;
+
+		// For backward compatibility
+		$this->produit=$this->product;
 	}
 
 }
diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php
index 2a2d42d4ec5..8a352b52211 100644
--- a/htdocs/core/photos_resize.php
+++ b/htdocs/core/photos_resize.php
@@ -44,7 +44,13 @@ if ($modulepart=='produit|service' && (! $user->rights->produit->lire && ! $user
 
 if ($_POST["action"] == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POST["sizex"]) != "") && (isset($_POST["sizey"]) != ""))
 {
-	$fullpath=$conf->produit->dir_output."/".$original_file;
+	$product=new Product($db);
+	$result=$product->fetch($_POST["id"]);
+	$dir=$conf->product->dir_output;	// By default
+	if ($product->type == 0) $dir=$conf->product->dir_output;
+	if ($product->type == 1) $dir=$conf->service->dir_output;
+
+	$fullpath=$dir."/".$original_file;
 	$result=dol_imageResizeOrCrop($fullpath,0,$_POST['sizex'],$_POST['sizey']);
 
 	if ($result == $fullpath)
@@ -63,7 +69,13 @@ if ($_POST["action"] == 'confirm_resize' && (isset($_POST["file"]) != "") && (is
 // Crop d'une image
 if ($_POST["action"] == 'confirm_crop')
 {
-	$fullpath=$conf->produit->dir_output."/".$original_file;
+	$product=new Product($db);
+	$result=$product->fetch($_POST["id"]);
+	$dir=$conf->product->dir_output;	// By default
+	if ($product->type == 0) $dir=$conf->product->dir_output;
+	if ($product->type == 1) $dir=$conf->service->dir_output;
+
+	$fullpath=$dir."/".$original_file;
 	$result=dol_imageResizeOrCrop($fullpath,1,$_POST['w'],$_POST['h'],$_POST['x'],$_POST['y']);
 
 	if ($result == $fullpath)
@@ -91,7 +103,7 @@ print_fiche_titre($langs->trans("Image"));
 
 if ($mesg) print '<div class="error">'.$mesg.'</div>';
 
-$infoarray=dol_getImageSize($conf->produit->dir_output."/".urldecode($_GET["file"]));
+$infoarray=dol_getImageSize($conf->product->dir_output."/".urldecode($_GET["file"]));
 $height=$infoarray['height'];
 $width=$infoarray['width'];
 print $langs->trans("CurrentInformationOnImage").':';
@@ -129,7 +141,7 @@ print $langs->trans("DefineNewAreaToPick").'...<br>';
 print '<br>';
 print '<img style="border: 1px solid #888888;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.$original_file.'" alt="Taille origine" id="cropbox" />';
 print '<br>';
-$infoarray=dol_getImageSize($conf->produit->dir_output."/".urldecode($_GET["file"]));
+$infoarray=dol_getImageSize($conf->product->dir_output."/".urldecode($_GET["file"]));
 $height=$infoarray['height'];
 $width=$infoarray['width'];
 print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$_GET['id'].'" method="post" onsubmit="return checkCoords();">
diff --git a/htdocs/document.php b/htdocs/document.php
index 99e9f8573ef..448d27227b2 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -293,7 +293,7 @@ if ($modulepart)
 		{
 			$accessallowed=1;
 		}
-		if ($conf->product->enabled) $original_file=$conf->produit->dir_output.'/'.$original_file;
+		if ($conf->product->enabled) $original_file=$conf->product->dir_output.'/'.$original_file;
 		elseif ($conf->service->enabled) $original_file=$conf->service->dir_output.'/'.$original_file;
 	}
 
diff --git a/htdocs/fourn/product/fourn.php b/htdocs/fourn/product/fourn.php
index b93dbbd1696..1c188834d83 100644
--- a/htdocs/fourn/product/fourn.php
+++ b/htdocs/fourn/product/fourn.php
@@ -105,7 +105,7 @@ if ($_GET["id"])
 		print '<tr><td width="20%">'.$langs->trans("InternalRef").'</td><td width="40%">'.$product->ref.'</td>';
 
 		print '<td class="photo" valign="top" rowspan="6">';
-		$product->show_photos($conf->produit->dir_output,1,1,0);
+		$product->show_photos($conf->product->dir_output,1,1,0);
 		print '</td></tr>';
 
 		print "<tr>";
diff --git a/htdocs/fourn/product/photos.php b/htdocs/fourn/product/photos.php
index 7a275d69a4c..0fa452a3087 100644
--- a/htdocs/fourn/product/photos.php
+++ b/htdocs/fourn/product/photos.php
@@ -42,7 +42,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
 		$product = new Product($db);
 		$result = $product->fetch($_GET["id"]);
 
-		$product->add_photo($conf->produit->dir_output, $_FILES['photofile']);
+		$product->add_photo($conf->product->dir_output, $_FILES['photofile']);
 	}
 }
 /*
@@ -140,7 +140,7 @@ if ($_GET["id"])
 			$nbbyrow=5;
 
 			$pdir = get_exdir($product->id,2) . $product->id ."/photos/";
-			$dir = $conf->produit->dir_output . '/'. $pdir;
+			$dir = $conf->product->dir_output . '/'. $pdir;
 
 			print '<br><table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
 
diff --git a/htdocs/lib/images.lib.php b/htdocs/lib/images.lib.php
index b66f6161cd0..32b1e6992ec 100644
--- a/htdocs/lib/images.lib.php
+++ b/htdocs/lib/images.lib.php
@@ -58,7 +58,6 @@ function dol_getImageSize($file)
  * 		\param		src_x			Position of croping image in source image (not use if mode=0)
  * 		\param		src_y			Position of croping image in source image (not use if mode=0)
  *		\return		int				File name if OK, error message if KO
- *		\remarks					With file=myfile.jpg -> myfile_small.jpg
  */
 function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x=0, $src_y=0)
 {
@@ -244,7 +243,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x=0, $s
 	// Free memory
 	imagedestroy($imgThumb);
 
-	clearstatcache();	// File was replaced by a modified on, so we clear file caches.
+	clearstatcache();	// File was replaced by a modified one, so we clear file caches.
 
 	return $imgThumbName;
 }
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index df82ae3d0f2..90bf135bf0a 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -577,7 +577,7 @@ if (! defined('NOLOGIN'))
 	}
 	if (isset($user->conf->PRODUIT_LIMIT_SIZE))		// Can be 0
 	{
-		$conf->produit->limit_size = $user->conf->PRODUIT_LIMIT_SIZE;
+		$conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE;
 	}
 	// Replace conf->css by personalized value
 	if (isset($user->conf->MAIN_THEME) && $user->conf->MAIN_THEME)
diff --git a/htdocs/product/canvas/default/product.default.class.php b/htdocs/product/canvas/default/product.default.class.php
index c76130ed72c..0ef72c94caa 100644
--- a/htdocs/product/canvas/default/product.default.class.php
+++ b/htdocs/product/canvas/default/product.default.class.php
@@ -33,7 +33,7 @@ class ProductDefault extends Product
 	var $errno = 0;
 	//! Template container
 	var $tpl = array();
-	
+
 	/**
 	 *    \brief      Constructeur de la classe
 	 *    \param      DB          Handler acces base de donnees
@@ -53,14 +53,14 @@ class ProductDefault extends Product
 
 		$this->next_prev_filter = "canvas='default'";
 	}
-	
+
 	function getTitle()
 	{
 		global $langs;
-		
+
 		return $langs->trans("Products");
 	}
-	
+
 	/**
 	 *    \brief      Lecture des donnees dans la base
 	 *    \param      id          Product id
@@ -71,7 +71,7 @@ class ProductDefault extends Product
 
 		return $result;
 	}
-	
+
 	/**
 	 *    \brief      Assigne les valeurs pour les templates
 	 *    \param      object     object
@@ -81,53 +81,53 @@ class ProductDefault extends Product
 		global $conf,$langs;
 		global $html;
 		global $formproduct;
-		
+
 		parent::assign_values($action);
-		
+
 		// Stock alert
 		$this->tpl['seuil_stock_alerte'] = $this->seuil_stock_alerte;
-		
+
 		if ($action == 'create')
 		{
 			// Title
 			$this->tpl['title'] = load_fiche_titre($langs->trans("NewProduct"));
 		}
-		
+
 		if ($action == 'edit')
 		{
 			$this->tpl['title'] = load_fiche_titre($langs->trans('Modify').' '.$langs->trans('Product').' : '.$this->ref, "");
 		}
-		
+
 		if ($action == 'create' || $action == 'edit')
 		{
 			// Finished
 			$statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
 			$this->tpl['finished'] = $html->selectarray('finished',$statutarray,$this->finished);
-			
+
 			// Weight
 			$this->tpl['weight'] = $this->weight;
 			$this->tpl['weight_units'] = $formproduct->load_measuring_units("weight_units","weight",$this->weight_units);
-			
+
 			// Length
 			$this->tpl['length'] = $this->length;
 			$this->tpl['length_units'] = $formproduct->load_measuring_units("length_units","size",$this->length_units);
-			
+
 			// Surface
 			$this->tpl['surface'] = $this->surface;
 			$this->tpl['surface_units'] = $formproduct->load_measuring_units("surface_units","surface",$this->surface_units);
-			
+
 			// Volume
 			$this->tpl['volume'] = $this->volume;
 			$this->tpl['volume_units'] = $formproduct->load_measuring_units("volume_units","volume",$this->volume_units);
 		}
-		
+
 		if ($action == 'view')
-		{	
+		{
 			// Photo
 			$this->tpl['nblignes'] = 4;
-			if ($this->is_photo_available($conf->produit->dir_output))
+			if ($this->is_photo_available($conf->product->dir_output))
 			{
-				$this->tpl['photos'] = $this->show_photos($conf->produit->dir_output,1,1,0,0,0,80);
+				$this->tpl['photos'] = $this->show_photos($conf->product->dir_output,1,1,0,0,0,80);
 			}
 
 			// Nature
@@ -158,20 +158,20 @@ class ProductDefault extends Product
 			}
 		}
 	}
-	
+
 	/**
 	 * 	\brief	Fetch datas list
 	 */
 	function LoadListDatas($limit, $offset, $sortfield, $sortorder)
 	{
 		global $conf, $langs;
-		
+
 		$this->list_datas = array();
-		
+
 		//$_GET["sall"] = 'LL';
 		// Clean parameters
 		$sall=trim(isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"]);
-		
+
 		foreach($this->field_list as $field)
 		{
 			if ($field['enabled'])
@@ -180,12 +180,12 @@ class ProductDefault extends Product
 				$$fieldname = trim(isset($_GET[$fieldname])?$_GET[$fieldname]:$_POST[$fieldname]);
 			}
 		}
-		
+
 		$sql = 'SELECT DISTINCT ';
-		
+
 		// Fields requiered
 		$sql.= 'p.rowid, p.price_base_type, p.fk_product_type, p.seuil_stock_alerte';
-		
+
 		// Fields not requiered
 		foreach($this->field_list as $field)
 		{
@@ -198,7 +198,7 @@ class ProductDefault extends Product
 		$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
 		$sql.= " WHERE p.entity = ".$conf->entity;
 		if (!$user->rights->produit->hidden) $sql.=' AND p.hidden = 0';
-		
+
 		if ($sall)
 		{
 			$clause = '';
@@ -213,7 +213,7 @@ class ProductDefault extends Product
 			}
 			$sql.= ")";
 		}
-		
+
 		// Search fields
 		foreach($this->field_list as $field)
 		{
@@ -223,7 +223,7 @@ class ProductDefault extends Product
 				if (${$fieldname}) $sql.= " AND ".$field['name']." LIKE '%".addslashes(${$fieldname})."%'";
 			}
 		}
-		
+
 		if (isset($_GET["envente"]) && strlen($_GET["envente"]) > 0)
 		{
 			$sql.= " AND p.envente = ".addslashes($_GET["envente"]);
@@ -244,17 +244,17 @@ class ProductDefault extends Product
 			while ($i < min($num,$limit))
 			{
 				$datas = array();
-				
+
 				$obj = $this->db->fetch_object($resql);
 
 				$datas["id"]        = $obj->rowid;
-				
+
 				foreach($this->field_list as $field)
 				{
 					if ($field['enabled'])
 					{
 						$alias = $field['alias'];
-						
+
 						if ($alias == 'ref')
 						{
 							$this->id 		= $obj->rowid;
@@ -287,7 +287,7 @@ class ProductDefault extends Product
 			print $sql;
 		}
 	}
-	
+
 }
- 
+
 ?>
\ No newline at end of file
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index e33b32f8627..0e88c8c2bb2 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -68,7 +68,7 @@ class Product extends CommonObject
 	// Local taxes
 	var $localtax1_tx;
 	var $localtax2_tx;
-	//! Type 0 for regular product, 1 for service, 2 for assembly kit, 3 for stock kit
+	//! Type 0 for regular product, 1 for service (Advanced feature: 2 for assembly kit, 3 for stock kit)
 	var $type;
 	var $typestring;
 
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index ecfd18fa1c1..b0f71d5aa6f 100755
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -66,7 +66,7 @@ if ($_GET['id'] || $_GET["ref"])
     if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
     if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
 
-    if ($conf->product->enabled) $upload_dir = $conf->produit->dir_output.'/'.dol_sanitizeFileName($product->ref);
+    if ($conf->product->enabled) $upload_dir = $conf->product->dir_output.'/'.dol_sanitizeFileName($product->ref);
     elseif ($conf->service->enabled) $upload_dir = $conf->service->dir_output.'/'.dol_sanitizeFileName($product->ref);
 }
 $modulepart='produit';
diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php
index 08856cd81d4..0a192d4934f 100644
--- a/htdocs/product/fiche.php
+++ b/htdocs/product/fiche.php
@@ -1047,11 +1047,11 @@ if ($_GET["id"] || $_GET["ref"])
 			print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
 
 			$nblignes=4;
-			if ($product->is_photo_available($conf->produit->dir_output))
+			if ($product->is_photo_available($conf->product->dir_output))
 			{
 				// Photo
 				print '<td valign="middle" align="center" width="30%" rowspan="'.$nblignes.'">';
-				print $product->show_photos($conf->produit->dir_output,1,1,0,0,0,80);
+				print $product->show_photos($conf->product->dir_output,1,1,0,0,0,80);
 				print '</td>';
 			}
 
diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php
index 92d76807bdd..89fb60e8968 100644
--- a/htdocs/product/photos.php
+++ b/htdocs/product/photos.php
@@ -44,7 +44,7 @@ if ($user->societe_id) $socid=$user->societe_id;
 $result=restrictedArea($user,'produit|service',$id,'product','','',$fieldid);
 
 $mesg = '';
-$dir = (!empty($conf->produit->dir_output)?$conf->produit->dir_output:$conf->service->dir_output);
+$dir = (!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output);
 
 /*
  * Actions
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index 9e36ba8841a..e2392cf1eaa 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -137,11 +137,11 @@ print '</tr>';
 print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
 
 $nblignes=4;
-if ($product->is_photo_available($conf->produit->dir_output))
+if ($product->is_photo_available($conf->product->dir_output))
 {
 	// Photo
 	print '<td valign="middle" align="center" width="30%" rowspan="'.$nblignes.'">';
-	print $product->show_photos($conf->produit->dir_output,1,1,0,0,0,80);
+	print $product->show_photos($conf->product->dir_output,1,1,0,0,0,80);
 	print '</td>';
 }
 
diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php
index 72fc6a7f314..857253020ee 100644
--- a/htdocs/product/stats/fiche.php
+++ b/htdocs/product/stats/fiche.php
@@ -127,7 +127,7 @@ if ($_GET["id"] || $_GET["ref"])
 		// Generation des graphs
 		$WIDTH=380;
 		$HEIGHT=160;
-		$dir = (!empty($conf->produit->dir_temp)?$conf->produit->dir_temp:$conf->service->dir_temp);
+		$dir = (!empty($conf->product->dir_temp)?$conf->product->dir_temp:$conf->service->dir_temp);
 		if (! file_exists($dir.'/'.$product->id))
 		{
 			if (create_exdir($dir.'/'.$product->id) < 0)
diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php
index ff6a1d0ae60..b079ff9b05a 100644
--- a/htdocs/viewimage.php
+++ b/htdocs/viewimage.php
@@ -199,7 +199,7 @@ if ($modulepart)
 		{
 			$accessallowed=1;
 		}
-		$original_file=(!empty($conf->produit->dir_temp)?$conf->produit->dir_temp:$conf->service->dir_temp).'/'.$original_file;
+		$original_file=(!empty($conf->product->dir_temp)?$conf->product->dir_temp:$conf->service->dir_temp).'/'.$original_file;
 	}
 
 	// Wrapping for products or services
@@ -209,7 +209,7 @@ if ($modulepart)
 		{
 			$accessallowed=1;
 		}
-		$original_file=(!empty($conf->produit->dir_output)?$conf->produit->dir_output:$conf->service->dir_output).'/'.$original_file;
+		$original_file=(!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output).'/'.$original_file;
 	}
 
 	// Wrapping for categories
@@ -269,7 +269,7 @@ if ($modulepart)
 	elseif ($modulepart == 'graph_product')
 	{
 		$accessallowed=1;
-		$original_file=$conf->produit->dir_temp.'/'.$original_file;
+		$original_file=$conf->product->dir_temp.'/'.$original_file;
 	}
 
 	// Wrapping pour les code barre
-- 
GitLab