From 16c6dd3c95e2f81fa6faee0c54d3f6640275cef0 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Wed, 4 Jan 2012 13:54:07 +0100
Subject: [PATCH] Doxygen

---
 .../product/class/html.formproduct.class.php  | 26 +++---
 htdocs/product/class/product.class.php        | 90 ++++++++++---------
 htdocs/product/class/service.class.php        | 17 ++--
 3 files changed, 73 insertions(+), 60 deletions(-)

diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php
index 08e5812e235..ef1a475f9fd 100644
--- a/htdocs/product/class/html.formproduct.class.php
+++ b/htdocs/product/class/html.formproduct.class.php
@@ -138,12 +138,14 @@ class FormProduct
 	}
 
 	/**
-	 *  \brief      Output a combo box with list of units
-	 *  \param      name                Name of HTML field
-	 *  \param      measuring_style     Unit to show: weight, size, surface, volume
-	 *  \param      default             Force unit
-	 * 	\param		adddefault			Add empty unit called "Default"
-	 *  \remarks pour l'instant on ne definit pas les unites dans la base
+	 *  Output a combo box with list of units
+	 *  pour l'instant on ne definit pas les unites dans la base
+	 *
+	 *  @param	string		$name               Name of HTML field
+	 *  @param	string		$measuring_style    Unit to show: weight, size, surface, volume
+	 *  @param  string		$default            Force unit
+	 * 	@param	int			$adddefault			Add empty unit called "Default"
+	 * 	@return	void
 	 */
 	function select_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0)
 	{
@@ -152,11 +154,13 @@ class FormProduct
 
 	/**
 	 *  Return a combo box with list of units
-	 *  @param  name                Name of HTML field
-	 *  @param  measuring_style     Unit to show: weight, size, surface, volume
-	 *  @param  default             Force unit
-	 * 	@param	adddefault			Add empty unit called "Default"
-	 *  @see 	For the moment, units labels are defined in measuring_units_string
+	 *  For the moment, units labels are defined in measuring_units_string
+	 *
+	 *  @param	string		$name                Name of HTML field
+	 *  @param  string		$measuring_style     Unit to show: weight, size, surface, volume
+	 *  @param  string		$default             Force unit
+	 * 	@param	int			$adddefault			Add empty unit called "Default"
+	 * 	@return	void
 	 */
 	function load_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0)
 	{
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 9c8d61f4251..6d3a63efe2b 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1510,7 +1510,7 @@ class Product extends CommonObject
 	 *  @param		string	$mode		'byunit'=number of unit, 'bynumber'=nb of entities
 	 * 	@return   	array       		<0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
 	 */
-	function get_nb_vente($socid=0,$mode)
+	function get_nb_vente($socid,$mode)
 	{
 		global $conf;
 		global $user;
@@ -1539,7 +1539,7 @@ class Product extends CommonObject
 	 * 	@param		string	$mode		'byunit'=number of unit, 'bynumber'=nb of entities
 	 * 	@return   	array       		<0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
 	 */
-	function get_nb_achat($socid=0,$mode)
+	function get_nb_achat($socid,$mode)
 	{
 		global $conf;
 		global $user;
@@ -1568,7 +1568,7 @@ class Product extends CommonObject
 	 * 	@param		string	$mode		'byunit'=number of unit, 'bynumber'=nb of entities
 	 * 	@return   	array       		<0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
 	 */
-	function get_nb_propal($socid=0,$mode)
+	function get_nb_propal($socid,$mode)
 	{
 		global $conf;
 		global $user;
@@ -1596,7 +1596,7 @@ class Product extends CommonObject
 	 *  @param		string	$mode		'byunit'=number of unit, 'bynumber'=nb of entities
 	 * 	@return   	array       		<0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11
 	 */
-	function get_nb_order($socid=0,$mode)
+	function get_nb_order($socid,$mode)
 	{
 		global $conf, $user;
 
@@ -1621,6 +1621,7 @@ class Product extends CommonObject
 	 *
 	 *  @param      int	$id_pere    Id du produit auquel sera lie le produit a lier
 	 *  @param      int	$id_fils    Id du produit a lier
+	 *  @param		int	$qty		Quantity
 	 *  @return     int        		< 0 if KO, > 0 if OK
 	 */
 	function add_sousproduit($id_pere, $id_fils,$qty)
@@ -1871,22 +1872,22 @@ class Product extends CommonObject
 	/**
 	 *  Recopie les prix d'un produit/service sur un autre
 	 *
-	 *  @param    fromId      Id produit source
-	 *  @param    toId        Id produit cible
-	 *  @return   int         < 0 si erreur, > 0 si ok
+	 *  @param	int		$fromId     Id product source
+	 *  @param  int		$toId       Id product target
+	 *  @return nt         			< 0 if KO, > 0 if OK
 	 */
 	function clone_price($fromId, $toId)
 	{
 		$this->db->begin();
 
 		// les prix
-		$sql = "INSERT ".MAIN_DB_PREFIX."product_price ("
-		. " fk_product, date_price, price, tva_tx, localtax1_tx, localtax2_tx, fk_user_author, tosell )"
-		. " SELECT ".$toId . ", date_price, price, tva_tx, localtax1_tx, localtax2_tx, fk_user_author, tosell "
-		. " FROM ".MAIN_DB_PREFIX."product_price "
-		. " WHERE fk_product = ". $fromId;
+		$sql = "INSERT ".MAIN_DB_PREFIX."product_price (";
+		$sql.= " fk_product, date_price, price, tva_tx, localtax1_tx, localtax2_tx, fk_user_author, tosell)";
+		$sql.= " SELECT ".$toId . ", date_price, price, tva_tx, localtax1_tx, localtax2_tx, fk_user_author, tosell";
+		$sql.= " FROM ".MAIN_DB_PREFIX."product_price ";
+		$sql.= " WHERE fk_product = ". $fromId;
 
-		if ( ! $this->db->query($sql ) )
+		if (! $this->db->query($sql))
 		{
 			$this->db->rollback();
 			return -1;
@@ -1920,11 +1921,11 @@ class Product extends CommonObject
 		}*/
 
 		// les prix de fournisseurs.
-		$sql = "INSERT ".MAIN_DB_PREFIX."product_fournisseur_price ("
-		. " datec, fk_product, fk_soc, price, quantity, fk_user )"
-		. " SELECT '".$this->db->idate(mktime())."', ".$toId. ", fk_soc, price, quantity, fk_user"
-		. " FROM ".MAIN_DB_PREFIX."product_fournisseur_price"
-		. " WHERE fk_product = ".$fromId;
+		$sql = "INSERT ".MAIN_DB_PREFIX."product_fournisseur_price (";
+		$sql.= " datec, fk_product, fk_soc, price, quantity, fk_user)";
+		$sql.= " SELECT '".$this->db->idate(mktime())."', ".$toId. ", fk_soc, price, quantity, fk_user";
+		$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
+		$sql.= " WHERE fk_product = ".$fromId;
 
 		$resql=$this->db->query($sql);
 		if (! $resql)
@@ -2037,7 +2038,7 @@ class Product extends CommonObject
 	/**
 	 *  reconstruit l'arborescence des categories sous la forme d'un tableau
 	 *
-	 *	@param		int		$multiply	
+	 *	@param		int		$multiply		Because each sublevel must be multiplicated by parent nb
 	 *  @return 	array 					$this->res
 	 */
 	function get_arbo_each_prod($multiply=1)
@@ -2055,7 +2056,7 @@ class Product extends CommonObject
 	}
 
 	/**
-	 *  renvoie tous les sousproduits dans le tableau res, chaque ligne de res contient : id -> qty
+	 *  Renvoie tous les sousproduits dans le tableau res, chaque ligne de res contient : id -> qty
 	 *
 	 *  @return array $this->res
 	 */
@@ -2104,7 +2105,7 @@ class Product extends CommonObject
 		}
 		else
 		{
-			dol_print_error ($this->db);
+			dol_print_error($this->db);
 			return -1;
 		}
 	}
@@ -2136,7 +2137,7 @@ class Product extends CommonObject
 		}
 		else
 		{
-			dol_print_error ($this->db);
+			dol_print_error($this->db);
 			return -1;
 		}
 	}
@@ -2174,7 +2175,7 @@ class Product extends CommonObject
 		}
 		else
 		{
-			dol_print_error ($this->db);
+			dol_print_error($this->db);
 			return -1;
 		}
 	}
@@ -2407,10 +2408,11 @@ class Product extends CommonObject
 	/**
 	 *  Deplace fichier uploade sous le nom $files dans le repertoire sdir
 	 *
-	 *  @param      string	$sdir       Repertoire destination finale
-	 *  @param      string	$file       Nom du fichier uploade
-	 *  @param      int		$maxWidth   Largeur maximum que dois faire la miniature (160 par defaut)
-	 *  @param      int		$maxHeight  Hauteur maximum que dois faire la miniature (120 par defaut)
+	 *  @param  string	$sdir       Repertoire destination finale
+	 *  @param  string	$file       Nom du fichier uploade
+	 *  @param  int		$maxWidth   Largeur maximum que dois faire la miniature (160 par defaut)
+	 *  @param  int		$maxHeight  Hauteur maximum que dois faire la miniature (120 par defaut)
+	 *  @return	void
 	 */
 	function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
 	{
@@ -2439,10 +2441,10 @@ class Product extends CommonObject
 	/**
 	 *  Build thumb
 	 *
-	 *  @param      string	$sdir           Repertoire destination finale
-	 *  @param      string	$file           Chemin du fichier d'origine
-	 *  @param      int		$maxWidth       Largeur maximum que dois faire la miniature (160 par defaut)
-	 *  @param      int		$maxHeight      Hauteur maximum que dois faire la miniature (120 par defaut)
+	 *  @param  string	$file           Chemin du fichier d'origine
+	 *  @param  int		$maxWidth       Largeur maximum que dois faire la miniature (160 par defaut)
+	 *  @param  int		$maxHeight      Hauteur maximum que dois faire la miniature (120 par defaut)
+	 *  @return	void
 	 */
 	function add_thumb($file, $maxWidth = 160, $maxHeight = 120)
 	{
@@ -2458,9 +2460,9 @@ class Product extends CommonObject
 	/**
 	 *  Deplace fichier recupere sur internet (utilise pour interface avec OSC)
 	 *
-	 *  @param      string	$sdir        	Repertoire destination finale
-	 *  @param      string	$file      		url de l'image
-	 *	@author	  Jean Heimburger	june 2007
+	 *  @param  string	$sdir        	Repertoire destination finale
+	 *  @param  string	$file      		url de l'image
+	 *  @return	void
 	 */
 	function add_photo_web($sdir, $file)
 	{
@@ -2749,7 +2751,8 @@ class Product extends CommonObject
 	/**
 	 *  Efface la photo du produit et sa vignette
 	 *
-	 *  @param      string		$file        Chemin de l'image
+	 *  @param  string		$file        Chemin de l'image
+	 *  @return	void
 	 */
 	function delete_photo($file)
 	{
@@ -2776,7 +2779,8 @@ class Product extends CommonObject
 	/**
 	 *  Load size of image file
 	 *
-	 *  @param      string	$file        Path to file
+	 *  @param  string	$file        Path to file
+	 *  @return	void
 	 */
 	function get_image_size($file)
 	{
@@ -2822,7 +2826,8 @@ class Product extends CommonObject
 	/**
 	 *  Mise a jour du code barre
 	 *
-	 *  @param      User	$user    Utilisateur qui fait la modification
+	 *  @param  User	$user    Utilisateur qui fait la modification
+	 *  @return	void
 	 */
 	function update_barcode($user)
 	{
@@ -2830,7 +2835,7 @@ class Product extends CommonObject
 		$sql.= " SET barcode = '".$this->barcode."'";
 		$sql.= " WHERE rowid = ".$this->id;
 
-		dol_syslog("Product::update_barcode sql=".$sql);
+		dol_syslog(get_class($this)."::update_barcode sql=".$sql);
 		$resql=$this->db->query($sql);
 		if ($resql)
 		{
@@ -2846,7 +2851,8 @@ class Product extends CommonObject
 	/**
 	 *  Mise a jour du type de code barre
 	 *
-	 *  @param      User	$user     Utilisateur qui fait la modification
+	 *  @param  User	$user     Utilisateur qui fait la modification
+	 *  @return	void
 	 */
 	function update_barcode_type($user)
 	{
@@ -2854,7 +2860,7 @@ class Product extends CommonObject
 		$sql.= " SET fk_barcode_type = '".$this->barcode_type."'";
 		$sql.= " WHERE rowid = ".$this->id;
 
-		dol_syslog("Product::update_barcode_type sql=".$sql);
+		dol_syslog(get_class($this)."::update_barcode_type sql=".$sql);
 		$resql=$this->db->query($sql);
 		if ($resql)
 		{
@@ -2870,7 +2876,7 @@ class Product extends CommonObject
 
     /**
      * Return if object is a product
-     * 
+     *
      * @return  boolean     True if it's a product
      */
 	function isproduct()
@@ -2887,7 +2893,7 @@ class Product extends CommonObject
 
     /**
      * Return if object is a product
-     * 
+     *
      * @return  boolean     True if it's a service
      */
 	function isservice()
diff --git a/htdocs/product/class/service.class.php b/htdocs/product/class/service.class.php
index 3e99a65dfac..35b936c604d 100644
--- a/htdocs/product/class/service.class.php
+++ b/htdocs/product/class/service.class.php
@@ -42,18 +42,21 @@ class Service extends CommonObject
 	var $debut_epoch;
 	var $fin_epoch;
 
-
-	function Service($DB, $id=0) {
-		$this->db = $DB;
-		$this->id = $id;
-
-		return 1;
+	/**
+	*  Constructor
+	*
+	*  @param      DoliDB		$db      Database handler
+	*/
+	function Service($db)
+	{
+		$this->db = $db;
 	}
 
 
 	/**
 	 *	Charge indicateurs this->nb de tableau de bord
-	 *	@return     int         <0 si ko, >0 si ok
+	 *
+	 *	@return     int         <0 if KO, >0 if OK
 	 */
 	function load_state_board()
 	{
-- 
GitLab