From 52c111157f2df8f8c776d7c76cea82c459c96dbf Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis@dolibarr.fr>
Date: Thu, 12 Nov 2009 13:33:55 +0000
Subject: [PATCH] Fix: Assigning the return value of new by reference is
 deprecated Fix: utf-8

---
 .../modules/compta.export.poivre.class.php    | 56 +++++++++---------
 .../modules/compta.export.safran.class.php    | 12 ++--
 htdocs/expedition/expedition.class.php        | 59 ++++++++++---------
 .../modules/export/export_excel.modules.php   |  2 +-
 htdocs/livraison/livraison.class.php          |  2 +-
 scripts/books/droits-nouveautes.php           |  2 +-
 .../company/export-contacts-xls-example.php   |  2 +-
 7 files changed, 69 insertions(+), 66 deletions(-)

diff --git a/htdocs/compta/export/modules/compta.export.poivre.class.php b/htdocs/compta/export/modules/compta.export.poivre.class.php
index 47489d5af47..e22be4f4650 100644
--- a/htdocs/compta/export/modules/compta.export.poivre.class.php
+++ b/htdocs/compta/export/modules/compta.export.poivre.class.php
@@ -43,7 +43,7 @@ class ComptaExportPoivre extends ComptaExport
 
   /**
      \brief      Constructeur de la class
-     \param      DB          Object de base de donn�es
+     \param      DB          Object de base de donnees
      \param      USER        Object utilisateur
   */  
   function ComptaExportPoivre ($DB, $USER)
@@ -53,12 +53,12 @@ class ComptaExportPoivre extends ComptaExport
   }
   
   /**
-   * Agr�gation des lignes de facture
+   * Agregation des lignes de facture
    */
   function Agregate($line_in)
   {
     dol_syslog("ComptaExportPoivre::Agregate");
-    dol_syslog("ComptaExportPoivre::Agregate " . sizeof($line_in) . " lignes en entr�es");
+    dol_syslog("ComptaExportPoivre::Agregate " . sizeof($line_in) . " lignes en entrees");
     $i = 0;
     $j = 0;
     $n = sizeof($line_in);
@@ -71,7 +71,7 @@ class ComptaExportPoivre extends ComptaExport
     
     for ( $i = 1 ; $i < $n ; $i++)
       {
-	// On agr�ge les lignes avec le m�me code comptable
+	// On agrege les lignes avec le meme code comptable
 	
 	if ( ($line_in[$i][1] == $line_in[$i-1][1]) && ($line_in[$i][4] == $line_in[$i-1][4]) )
 	  {
@@ -89,7 +89,7 @@ class ComptaExportPoivre extends ComptaExport
     return 0;
   }
   
-  /*
+  /**
    *
    */
   function Export($dir, $linec, $linep, $id=0)
@@ -97,7 +97,7 @@ class ComptaExportPoivre extends ComptaExport
     $error = 0;
     
     dol_syslog("ComptaExportPoivre::Export");
-    dol_syslog("ComptaExportPoivre::Export " . sizeof($linec) . " lignes en entr�es");
+    dol_syslog("ComptaExportPoivre::Export " . sizeof($linec) . " lignes en entrees");
     
     $this->Agregate($linec);
     
@@ -168,7 +168,7 @@ class ComptaExportPoivre extends ComptaExport
 	
 	$fxname = $dir . "/".$this->ref.".xls";
 	
-	$workbook = &new writeexcel_workbook($fxname);
+	$workbook = new writeexcel_workbook($fxname);
 	
 	$page = &$workbook->addworksheet('Export');
 	
@@ -177,21 +177,21 @@ class ComptaExportPoivre extends ComptaExport
 	$page->set_column(2,2,9); // C
 	$page->set_column(3,3,14); // D
 	$page->set_column(4,4,44); // E
-	$page->set_column(5,5,9); // F Num�ro de pi�ce
+	$page->set_column(5,5,9); // F Numero de piece
 	$page->set_column(6,6,8); // G
 
 	
 	// Pour les factures
 	
-	// A 0 Date Op�ration 040604 pour 4 juin 2004
+	// A 0 Date Operation 040604 pour 4 juin 2004
 	// B 1 VE -> ventilation
-	// C 2 code Compte g�n�ral
+	// C 2 code Compte general
 	// D 3 code client
 	// E 4 Intitul
-	// F 5 Num�ro de pi�ce
+	// F 5 Numero de piece
 	// G 7 Montant
-	// H 8 Type op�ration D pour D�bit ou C pour Cr�dit
-	// I Date d'�ch�ance, = � la date d'op�ration si pas d'�ch�ance
+	// H 8 Type operation D pour Debit ou C pour Credit
+	// I Date d'echeance, = a la date d'operation si pas d'echeance
 	// J EUR pour Monnaie en Euros
 	
 	// Pour les paiements
@@ -212,9 +212,9 @@ class ComptaExportPoivre extends ComptaExport
 		$page->write_string($j, 2,  "41100000");
 		$page->write_string($j, 3, stripslashes($this->line_out[$i][2]));
 		$page->write_string($j, 4, stripslashes($this->line_out[$i][3])." Facture");
-		$page->write_string($j, 5, $this->line_out[$i][5]); // Num�ro de factur
+		$page->write_string($j, 5, $this->line_out[$i][5]); // Numero de facture
 		$page->write($j, 6, price2num($this->line_out[$i][7]));
-		$page->write_string($j, 7, 'D' ); // D pour d�bit
+		$page->write_string($j, 7, 'D' ); // D pour debit
 		$page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0]));
 		
 		$j++;
@@ -225,9 +225,9 @@ class ComptaExportPoivre extends ComptaExport
 		$page->write_string($j, 2, '4457119');
 		
 		$page->write_string($j, 4, stripslashes($this->line_out[$i][3])." Facture");
-		$page->write_string($j, 5, $this->line_out[$i][5]); // Num�ro de facture
+		$page->write_string($j, 5, $this->line_out[$i][5]); // Numero de facture
 		$page->write($j, 6, price2num($this->line_out[$i][6])); // Montant de TVA
-		$page->write_string($j, 7, 'C'); // C pour cr�dit
+		$page->write_string($j, 7, 'C'); // C pour credit
 		$page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0]));
 				
 		$oldfacture = $this->line_out[$i][1];
@@ -240,7 +240,7 @@ class ComptaExportPoivre extends ComptaExport
 	    $page->write_string($j, 4, $this->line_out[$i][3]." Facture");
 	    $page->write_string($j, 5, $this->line_out[$i][5]);
 	    $page->write($j, 6, price2num(round($this->line_out[$i][8], 2)));
-	    $page->write_string($j, 7, 'C');                     // C pour cr�dit
+	    $page->write_string($j, 7, 'C');                     // C pour credit
 	    $page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0]));
 	    
 	    $j++;
@@ -262,15 +262,15 @@ class ComptaExportPoivre extends ComptaExport
 	
 	// Pour les paiements
 	
-	// A Date Op�ration 040604 pour 4 juin 2004
+	// A Date Operation 040604 pour 4 juin 2004
 	// B CE -> caisse d'epargne
-	// C code Compte g�n�ral
+	// C code Compte general
 	// D code client
 	// E Intitul
-	// F Num�ro de pi�ce
+	// F Numero de piece
 	// G Montant
-	// H Type op�ration D pour D�bit ou C pour Cr�dit
-	// I Date d'�ch�ance, = � la date d'op�ration si pas d'�ch�ance
+	// H Type operation D pour Debit ou C pour Credit
+	// I Date d'echeance, = a la date d'operation si pas d'echeance
 	// J EUR pour Monnaie en Euros
 	
 	$i = 0;
@@ -282,7 +282,7 @@ class ComptaExportPoivre extends ComptaExport
 	for ( $i = 0 ; $i < $n ; $i++)
 	  {
 	    /*
-	     * En cas de rejet ou paiement en n�gatif on inverse debit et credit
+	     * En cas de rejet ou paiement en negatif on inverse debit et credit
 	     *
 	     *
 	     */
@@ -296,7 +296,7 @@ class ComptaExportPoivre extends ComptaExport
 		$debit = "C";
 		$credit = "D";
 		
-		if ($linep[$i][6] == 'Pr�l�vement')
+		if ($linep[$i][6] == 'Prelevement')
 		  {
 		    $linep[$i][6] = 'Rejet Prelevement';
 		  }		
@@ -307,13 +307,13 @@ class ComptaExportPoivre extends ComptaExport
 	    
 	    $page->write_string($j,2, '5122000');
 
-	    if ($linep[$i][6] == 'Pr�l�vement')
+	    if ($linep[$i][6] == 'Prelevement')
 	      {
 		$linep[$i][6] = 'Prelevement';
 	      }
 	    
 	    $page->write_string($j,4, stripslashes($linep[$i][3])." ".stripslashes($linep[$i][6])); //
-	    $page->write_string($j,5, $linep[$i][7]);                  // Num�ro de facture
+	    $page->write_string($j,5, $linep[$i][7]);                  // Numero de facture
 	    
 	    $page->write($j,6, price2num(round(abs($linep[$i][5]), 2)));  // Montant de la ligne
 	    $page->write_string($j,7,$debit);
@@ -328,7 +328,7 @@ class ComptaExportPoivre extends ComptaExport
 	    $page->write_string($j,2, '41100000');
 	    $page->write_string($j,3, $linep[$i][2]);
 	    $page->write_string($j,4, stripslashes($linep[$i][3])." ".stripslashes($linep[$i][6])); //
-	    $page->write_string($j,5, $linep[$i][7]);     // Num�ro de facture
+	    $page->write_string($j,5, $linep[$i][7]);     // Numero de facture
 	    $page->write($j,6, price2num(round(abs($linep[$i][5]), 2)));  // Montant de la ligne
 	    $page->write_string($j,7, $credit);
 	    $page->write_string($j,8, strftime("%d%m%y",$linep[$i][0]));
diff --git a/htdocs/compta/export/modules/compta.export.safran.class.php b/htdocs/compta/export/modules/compta.export.safran.class.php
index 783550581b0..305f19ae7f5 100644
--- a/htdocs/compta/export/modules/compta.export.safran.class.php
+++ b/htdocs/compta/export/modules/compta.export.safran.class.php
@@ -64,21 +64,21 @@ class ComptaExportTableur extends ComptaExport
       //$fname = $dir . "/tmp/toto.xls"; DEBUG DEBUG
       $fname = "/tmp/toto.xls";
 
-        $workbook = &new writeexcel_workbook($fname);
+        $workbook = new writeexcel_workbook($fname);
 
         $worksheet = &$workbook->addworksheet();
 
         // Pour les factures
 
-        // Date Op�ration 040604 pour 4 juin 2004
+        // Date Operation 040604 pour 4 juin 2004
         // VE -> ventilation
-        // code Compte g�n�ral
+        // code Compte general
         // code client
         // Intitul
-        // Num�ro de pi�ce
+        // Numero de piece
         // Montant
-        // Type op�ration D pour D�bit ou C pour Cr�dit
-        // Date d'�ch�ance, = � la date d'op�ration si pas d'�ch�ance
+        // Type operation D pour Debit ou C pour Credit
+        // Date d'echeance, = a la date d'operation si pas d'echeance
         // EUR pour Monnaie en Euros
 
         // Pour les paiements
diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php
index 48213c6042b..aa85442ec71 100644
--- a/htdocs/expedition/expedition.class.php
+++ b/htdocs/expedition/expedition.class.php
@@ -19,10 +19,10 @@
  */
 
 /**
- \file       htdocs/expedition/expedition.class.php
- \ingroup    expedition
- \brief      Fichier de la classe de gestion des expeditions
- \version    $Id$
+ *  \file       htdocs/expedition/expedition.class.php
+ *  \ingroup    expedition
+ *  \brief      Fichier de la classe de gestion des expeditions
+ *  \version    $Id$
  */
 
 require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
@@ -71,9 +71,9 @@ class Expedition extends CommonObject
 	}
 
 	/**
-	 *    \brief      Cr�� exp�dition en base
-	 *    \param      user        Objet du user qui cr�
-	 *    \return     int         <0 si erreur, id exp�dition cr��e si ok
+	 *    \brief      Cree expedition en base
+	 *    \param      user        Objet du user qui cree
+	 *    \return     int         <0 si erreur, id expedition creee si ok
 	 */
 	function create($user)
 	{
@@ -421,7 +421,7 @@ class Expedition extends CommonObject
 						{
 							$mouvS = new MouvementStock($this->db);
 							// We decrement stock of product (and sub-products)
-							$entrepot_id = "1"; // TODO ajouter possibilit� de choisir l'entrepot
+							$entrepot_id = "1"; // TODO ajouter possibilit� de choisir l'entrepot
 							$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice);
 							if ($result < 0) { $error++; }
 						}
@@ -441,7 +441,7 @@ class Expedition extends CommonObject
 
 		if (! $error)
 		{
-			// On efface le r�pertoire de pdf provisoire
+			// On efface le repertoire de pdf provisoire
 			$expeditionref = dol_sanitizeFileName($this->ref);
 			if ($conf->expedition->dir_output)
 			{
@@ -495,7 +495,7 @@ class Expedition extends CommonObject
 
 
 	/**
-	 *      \brief      Cr�e un bon de livraison � partir de l'exp�dition
+	 *      \brief      Cree un bon de livraison a partir de l'expedition
 	 *      \param      user        Utilisateur
 	 *      \return     int         <0 si ko, >=0 si ok
 	 */
@@ -507,7 +507,7 @@ class Expedition extends CommonObject
 		{
 			if ($this->statut == 1)
 			{
-				// Exp�dition valid�e
+				// Expedition validee
 				include_once(DOL_DOCUMENT_ROOT."/livraison/livraison.class.php");
 				$livraison = new Livraison($this->db);
 				$result=$livraison->create_from_sending($user, $this->id);
@@ -584,7 +584,7 @@ class Expedition extends CommonObject
 				{
 					$this->db->commit();
 
-					// On efface le r�pertoire de pdf provisoire
+					// On efface le r�pertoire de pdf provisoire
 					$expref = dol_sanitizeFileName($this->ref);
 					if ($conf->expedition->dir_output)
 					{
@@ -630,22 +630,25 @@ class Expedition extends CommonObject
 	}
 
 
-	/*
-	 * Lit le document associ�
+	/**
+	 * Lit le document associe
 	 *
 	 */
 	function fetch_object()
 	{
 		$object = $this->origin;
 		$class = ucfirst($object);
-		$this->$object = & new $class($this->db);
+		$this->$object = new $class($this->db);
 		$this->$object->fetch($this->origin_id);
 	}
 
-
+	/**
+	 *
+	 *
+	 */
 	function fetch_lines()
 	{
-		//Todo: r�cup�rer les champs du document associ� a part
+		// TODO: recuperer les champs du document associe a part
 
 		$sql = "SELECT cd.rowid, cd.fk_product, cd.description, cd.qty as qty_asked";
 		$sql.= ", ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
@@ -696,8 +699,8 @@ class Expedition extends CommonObject
 	}
 
 	/**
-	 *    \brief      Retourne le libell� du statut d'une expedition
-	 *    \return     string      Libell�
+	 *    \brief      Retourne le libelle du statut d'une expedition
+	 *    \return     string      Libelle
 	 */
 	function getLibStatut($mode=0)
 	{
@@ -705,10 +708,10 @@ class Expedition extends CommonObject
 	}
 
 	/**
-	 *		\brief      Renvoi le libell� d'un statut donn�
+	 *		\brief      Renvoi le libelle d'un statut donne
 	 *    	\param      statut      Id statut
-	 *    	\param      mode        0=libell� long, 1=libell� court, 2=Picto + Libell� court, 3=Picto, 4=Picto + Libell� long, 5=Libell� court + Pict
-	 *    	\return     string		Libell�
+	 *    	\param      mode        0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+	 *    	\return     string		Libelle
 	 */
 	function LibStatut($statut,$mode)
 	{
@@ -737,8 +740,8 @@ class Expedition extends CommonObject
 	}
 
 	/**
-	 *		\brief		Initialise la facture avec valeurs fictives al�atoire
-	 *					Sert � g�n�rer une facture pour l'aperu des mod�les ou dem
+	 *		\brief		Initialise la facture avec valeurs fictives aleatoire
+	 *					Sert a generer une facture pour l'aperu des modeles ou dem
 	 */
 	function initAsSpecimen()
 	{
@@ -746,7 +749,7 @@ class Expedition extends CommonObject
 
 		dol_syslog("Expedition::initAsSpecimen");
 
-		// Charge tableau des id de soci�t� socids
+		// Charge tableau des id de societe socids
 		$socids = array();
 
 		$sql = "SELECT rowid";
@@ -793,7 +796,7 @@ class Expedition extends CommonObject
 		$order=new Commande($this->db);
 		$order->initAsSpecimen();
 
-		// Initialise param�tres
+		// Initialise parametres
 		$this->id=0;
 		$this->ref = 'SPECIMEN';
 		$this->specimen=1;
@@ -895,8 +898,8 @@ class Expedition extends CommonObject
 
 
 /**
- \class      ExpeditionLigne
- \brief      Classe de gestion des lignes de bons d'expedition
+ *  \class      ExpeditionLigne
+ *  \brief      Classe de gestion des lignes de bons d'expedition
  */
 class ExpeditionLigne
 {
diff --git a/htdocs/includes/modules/export/export_excel.modules.php b/htdocs/includes/modules/export/export_excel.modules.php
index 8fa84c9e627..aecd5ffbf94 100644
--- a/htdocs/includes/modules/export/export_excel.modules.php
+++ b/htdocs/includes/modules/export/export_excel.modules.php
@@ -127,7 +127,7 @@ class ExportExcel extends ModeleExports
 		$ret=1;
 
 		$outputlangs->load("exports");
-		$this->workbook = &new writeexcel_workbookbig($file);
+		$this->workbook = new writeexcel_workbookbig($file);
 		$this->workbook->set_tempdir($conf->export->dir_temp);			// Set temporary directory
 		$this->workbook->set_sheetname($outputlangs->trans("Sheet"));
 		$this->worksheet = &$this->workbook->addworksheet();
diff --git a/htdocs/livraison/livraison.class.php b/htdocs/livraison/livraison.class.php
index 369f079d328..b903c1b9589 100644
--- a/htdocs/livraison/livraison.class.php
+++ b/htdocs/livraison/livraison.class.php
@@ -627,7 +627,7 @@ class Livraison extends CommonObject
 	{
 		$object = $this->origin;
 		$class = ucfirst($this->origin);
-		$this->$object = & new $class($this->db);
+		$this->$object = new $class($this->db);
 		$this->$object->fetch($this->origin_id);
 	}
 
diff --git a/scripts/books/droits-nouveautes.php b/scripts/books/droits-nouveautes.php
index beb3ac34b43..ec77cc33b5b 100644
--- a/scripts/books/droits-nouveautes.php
+++ b/scripts/books/droits-nouveautes.php
@@ -35,7 +35,7 @@ $year = strftime('%Y', time());
 
 $fname = "/tmp/droits-nouveautes-".$year.".xls";
 
-$workbook = &new writeexcel_workbook($fname);
+$workbook = new writeexcel_workbook($fname);
 
 $page = &$workbook->addworksheet("Droits nouveautes ".$year);
 
diff --git a/scripts/company/export-contacts-xls-example.php b/scripts/company/export-contacts-xls-example.php
index 49aade1ee1b..e9ca406acb1 100644
--- a/scripts/company/export-contacts-xls-example.php
+++ b/scripts/company/export-contacts-xls-example.php
@@ -53,7 +53,7 @@ $error = 0;
 
 $fname = DOL_DATA_ROOT.'/export-contacts.xls';
 
-$workbook = &new writeexcel_workbook($fname);
+$workbook = new writeexcel_workbook($fname);
 
 $page = &$workbook->addworksheet('Export Dolibarr');
 
-- 
GitLab