From 7322cd136ef6fe0117cdf0e88d61bfd5109f32f7 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Wed, 29 Apr 2009 18:02:50 +0000
Subject: [PATCH] Fix: rename function sanitizeFileName into
 dol_sanitizeFileName to avoir conflict with fckeditor

---
 htdocs/comm/action/document.php               |   6 +-
 htdocs/comm/index.php                         |  12 +-
 htdocs/comm/propal.php                        |  14 +-
 htdocs/comm/propal/apercu.php                 |   2 +-
 htdocs/comm/propal/document.php               |   6 +-
 htdocs/commande/apercu.php                    |   2 +-
 htdocs/commande/commande.class.php            |  14 +-
 htdocs/commande/document.php                  |   6 +-
 htdocs/commande/fiche.php                     |  10 +-
 htdocs/commande/index.php                     |  14 +-
 htdocs/commande/liste.php                     |  10 +-
 htdocs/compta/bank/fiche.php                  |  94 +++++------
 htdocs/compta/commande/fiche.php              |   2 +-
 htdocs/compta/commande/liste.php              |  16 +-
 htdocs/compta/dons/fiche.php                  |   2 +-
 htdocs/compta/facture.php                     |  14 +-
 htdocs/compta/facture/apercu.php              |   2 +-
 htdocs/compta/facture/document.php            |   6 +-
 htdocs/compta/facture/impayees.php            |   8 +-
 htdocs/compta/index.php                       |   8 +-
 htdocs/compta/propal.php                      |   8 +-
 htdocs/contact/vcard.php                      |   4 +-
 htdocs/contrat/document.php                   |   2 +-
 htdocs/ecm/ecmdirectory.class.php             | 150 +++++++++---------
 htdocs/expedition/expedition.class.php        |   6 +-
 htdocs/expedition/fiche.php                   |   2 +-
 htdocs/facture.class.php                      |  10 +-
 htdocs/fichinter/apercu.php                   |   2 +-
 htdocs/fichinter/document.php                 |   2 +-
 htdocs/fichinter/fiche.php                    |   6 +-
 htdocs/fichinter/fichinter.class.php          |   6 +-
 htdocs/fourn/commande/document.php            |   6 +-
 htdocs/fourn/commande/fiche.php               |   2 +-
 htdocs/html.formfile.class.php                |   4 +-
 .../modules/commande/modules_commande.php     |   2 +-
 .../modules/commande/pdf_edison.modules.php   |   2 +-
 .../modules/commande/pdf_einstein.modules.php |   2 +-
 .../modules/dons/html_cerfafr.modules.php     |   4 +-
 .../pdf/pdf_expedition_merou.modules.php      |   2 +-
 .../pdf/pdf_expedition_rouget.modules.php     |   2 +-
 .../modules/facture/modules_facture.php       |  16 +-
 .../modules/facture/pdf_crabe.modules.php     |   2 +-
 .../modules/facture/pdf_oursin.modules.php    |   2 +-
 .../modules/fichinter/modules_fichinter.php   |   2 +-
 .../modules/fichinter/pdf_soleil.modules.php  |   2 +-
 .../modules/livraison/modules_livraison.php   |   2 +-
 .../livraison/pdf/pdf_sirocco.modules.php     |   2 +-
 .../livraison/pdf/pdf_typhon.modules.php      |   2 +-
 .../modules/propale/modules_propale.php       |   2 +-
 .../propale/pdf_propale_azur.modules.php      |   2 +-
 .../propale/pdf_propale_jaune.modules.php     |   2 +-
 .../modules_commandefournisseur.php           |   2 +-
 .../pdf/pdf_muscadet.modules.php              |   2 +-
 ...ace_modNotification_Notification.class.php |  24 +--
 htdocs/install/upgrade2.php                   |  32 ++--
 htdocs/lib/functions.lib.php                  |   6 +-
 htdocs/livraison/fiche.php                    |   2 +-
 htdocs/livraison/livraison.class.php          |   4 +-
 htdocs/product.class.php                      |   6 +-
 htdocs/product/document.php                   |   2 +-
 htdocs/propal.class.php                       |   8 +-
 htdocs/societe.class.php                      |  18 +--
 htdocs/telephonie/client/facture.php          |  80 +++++-----
 63 files changed, 347 insertions(+), 347 deletions(-)

diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php
index 7681f1a4c23..ea125a2ae49 100755
--- a/htdocs/comm/action/document.php
+++ b/htdocs/comm/action/document.php
@@ -71,7 +71,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
     /*
      * Creation repertoire si n'existe pas
      */
-	$upload_dir = $conf->commercial->dir_actions.'/'.sanitizeFileName($objectid);
+	$upload_dir = $conf->commercial->dir_actions.'/'.dol_sanitizeFileName($objectid);
 	if (! is_dir($upload_dir)) create_exdir($upload_dir);
 
     if (is_dir($upload_dir))
@@ -95,7 +95,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
  */
 if ($_GET["action"] == 'delete')
 {
-	$upload_dir = $conf->commercial->dir_actions.'/'.sanitizeFileName($objectid);
+	$upload_dir = $conf->commercial->dir_actions.'/'.dol_sanitizeFileName($objectid);
 	$file = $upload_dir . '/' . urldecode($_GET['urlfile']);
 	dol_delete_file($file);
 }
@@ -113,7 +113,7 @@ if ($objectid > 0)
 	$act = new ActionComm($db);
 	if ($act->fetch($objectid))
 	{
-		$upload_dir = $conf->commercial->dir_actions.'/'.sanitizeFileName($objectid);
+		$upload_dir = $conf->commercial->dir_actions.'/'.dol_sanitizeFileName($objectid);
 
 		$company=new Societe($db);
 		$company->fetch($act->societe->id);
diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php
index 02520469d84..c84a4c517a0 100644
--- a/htdocs/comm/index.php
+++ b/htdocs/comm/index.php
@@ -147,7 +147,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
 	$sql.= " AND s.entity = ".$conf->entity;
 	if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
 	if ($socid)	$sql.= " AND s.rowid = ".$socid;
-	
+
 	$resql=$db->query($sql);
 	if ($resql)
 	{
@@ -202,7 +202,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
 if ($conf->commande->enabled && $user->rights->commande->lire)
 {
 	$langs->load("orders");
-	
+
 	$sql = "SELECT c.rowid, c.ref, c.total_ttc, s.rowid as socid, s.nom, s.client";
 	$sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
 	$sql.= ", ".MAIN_DB_PREFIX."societe as s";
@@ -314,8 +314,8 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
 			if (($objp->fk_statut <= 1) && $objp->dp < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
 			print '</td>';
 			print '<td width="16" align="center" class="nobordernopadding">';
-			$filename=sanitizeFileName($objp->ref);
-			$filedir=$conf->propale->dir_output . '/' . sanitizeFileName($objp->ref);
+			$filename=dol_sanitizeFileName($objp->ref);
+			$filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($objp->ref);
 			$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
 			$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
 			print '</td></tr></table>';
@@ -513,8 +513,8 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
 				if ($obj->dp < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
 				print '</td>';
 				print '<td width="16" align="center" class="nobordernopadding">';
-				$filename=sanitizeFileName($obj->ref);
-				$filedir=$conf->propale->dir_output . '/' . sanitizeFileName($obj->ref);
+				$filename=dol_sanitizeFileName($obj->ref);
+				$filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($obj->ref);
 				$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$obj->propalid;
 				$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
 				print '</td></tr></table>';
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 7f6689c2e29..296ffeb84b8 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -404,7 +404,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel'])
 	$propal= new Propal($db);
 	if ( $propal->fetch($_POST['propalid']) )
 	{
-		$propalref = sanitizeFileName($propal->ref);
+		$propalref = dol_sanitizeFileName($propal->ref);
 		$file = $conf->propale->dir_output . '/' . $propalref . '/' . $propalref . '.pdf';
 
 		if (is_readable($file))
@@ -1785,7 +1785,7 @@ if ($id > 0 || ! empty($ref))
 			// Send
 			if ($propal->statut == 1 && $user->rights->propale->envoyer)
 			{
-				$propref = sanitizeFileName($propal->ref);
+				$propref = dol_sanitizeFileName($propal->ref);
 				$file = $conf->propale->dir_output . '/'.$propref.'/'.$propref.'.pdf';
 				if (file_exists($file))
 				{
@@ -1849,8 +1849,8 @@ if ($id > 0 || ! empty($ref))
 		/*
 		 * Documents generes
 		 */
-		$filename=sanitizeFileName($propal->ref);
-		$filedir=$conf->propale->dir_output . "/" . sanitizeFileName($propal->ref);
+		$filename=dol_sanitizeFileName($propal->ref);
+		$filedir=$conf->propale->dir_output . "/" . dol_sanitizeFileName($propal->ref);
 		$urlsource=$_SERVER["PHP_SELF"]."?propalid=".$propal->id;
 		$genallowed=$user->rights->propale->creer;
 		$delallowed=$user->rights->propale->supprimer;
@@ -1910,7 +1910,7 @@ if ($id > 0 || ! empty($ref))
 	 */
 	if ($_GET['action'] == 'presend')
 	{
-		$ref = sanitizeFileName($propal->ref);
+		$ref = dol_sanitizeFileName($propal->ref);
 		$file = $conf->propale->dir_output . '/' . $ref . '/' . $ref . '.pdf';
 
 		print '<br>';
@@ -2115,8 +2115,8 @@ else
 
 			print '<td width="16" align="right" class="nobordernopadding">';
 
-			$filename=sanitizeFileName($objp->ref);
-			$filedir=$conf->propale->dir_output . '/' . sanitizeFileName($objp->ref);
+			$filename=dol_sanitizeFileName($objp->ref);
+			$filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($objp->ref);
 			$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
 			$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
 
diff --git a/htdocs/comm/propal/apercu.php b/htdocs/comm/propal/apercu.php
index 0b4d1fb2b7b..3927f7a807b 100644
--- a/htdocs/comm/propal/apercu.php
+++ b/htdocs/comm/propal/apercu.php
@@ -133,7 +133,7 @@ if ($_GET["propalid"] > 0)
 				/*
   				 * Documents
  				 */
-				$propalref = sanitizeFileName($propal->ref);
+				$propalref = dol_sanitizeFileName($propal->ref);
 				$dir_output = $conf->propale->dir_output . "/";
 				$filepath = $dir_output . $propalref . "/";
 				$file = $filepath . $propalref . ".pdf";
diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php
index 51c212428f2..8df14b0133a 100644
--- a/htdocs/comm/propal/document.php
+++ b/htdocs/comm/propal/document.php
@@ -72,7 +72,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
 
 	if ($propal->fetch($propalid))
     {
-        $upload_dir = $conf->propale->dir_output . "/" . sanitizeFileName($propal->ref);
+        $upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($propal->ref);
         if (! is_dir($upload_dir)) create_exdir($upload_dir);
 
         if (is_dir($upload_dir))
@@ -100,7 +100,7 @@ if ($action=='delete')
 	$propalid=$_GET["id"];
 	if ($propal->fetch($propalid))
     {
-        $upload_dir = $conf->propale->dir_output . "/" . sanitizeFileName($propal->ref);
+        $upload_dir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($propal->ref);
     	$file = $upload_dir . '/' . urldecode($_GET['urlfile']);
     	dol_delete_file($file);
         $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
@@ -119,7 +119,7 @@ if ($propalid > 0)
 	$propal = new Propal($db);
 	if ($propal->fetch($propalid))
     {
-		$upload_dir = $conf->propale->dir_output.'/'.sanitizeFileName($propal->ref);
+		$upload_dir = $conf->propale->dir_output.'/'.dol_sanitizeFileName($propal->ref);
 
         $societe = new Societe($db);
         $societe->fetch($propal->socid);
diff --git a/htdocs/commande/apercu.php b/htdocs/commande/apercu.php
index 9c591717876..984d3c4b39d 100644
--- a/htdocs/commande/apercu.php
+++ b/htdocs/commande/apercu.php
@@ -126,7 +126,7 @@ if ($_GET["id"] > 0) {
 				/*
   				 * Documents
  				 */
-				$commanderef = sanitizeFileName($commande->ref);
+				$commanderef = dol_sanitizeFileName($commande->ref);
 				$dir_output = $conf->commande->dir_output . "/";
 				$filepath = $dir_output . $commanderef . "/";
 				$file = $filepath . $commanderef . ".pdf";
diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php
index 11e014f14d6..3344bf50eb1 100644
--- a/htdocs/commande/commande.class.php
+++ b/htdocs/commande/commande.class.php
@@ -257,8 +257,8 @@ class Commande extends CommonObject
 			{
 				// On renomme repertoire facture ($this->ref = ancienne ref, $numfa = nouvelle ref)
 				// afin de ne pas perdre les fichiers attach�s
-				$comref = sanitizeFileName($this->ref);
-				$snum = sanitizeFileName($num);
+				$comref = dol_sanitizeFileName($this->ref);
+				$snum = dol_sanitizeFileName($num);
 				$dirsource = $conf->commande->dir_output.'/'.$comref;
 				$dirdest = $conf->commande->dir_output.'/'.$snum;
 				if (file_exists($dirsource))
@@ -699,7 +699,7 @@ class Commande extends CommonObject
 	function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0)
 	{
 		dol_syslog("Commande::addline commandeid=$commandeid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type", LOG_DEBUG);
-		
+
 		include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
 
 		// Clean parameters
@@ -763,7 +763,7 @@ class Commande extends CommonObject
 			$ligne->total_tva=$total_tva;
 			$ligne->total_ttc=$total_ttc;
 			$ligne->product_type=$type;
-			
+
 			// \TODO Ne plus utiliser
 			$ligne->price=$price;
 			$ligne->remise=$remise;
@@ -1066,7 +1066,7 @@ class Commande extends CommonObject
 	{
 		$this->lignes=array();	// deprecated
 		$this->lines=array();
-		
+
 		$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.fk_commande, l.description, l.price, l.qty, l.tva_tx,';
 		$sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.marge_tx, l.marque_tx, l.rang, l.info_bits,';
 		$sql.= ' l.total_ht, l.total_ttc, l.total_tva, l.date_start, l.date_end,';
@@ -1799,7 +1799,7 @@ class Commande extends CommonObject
 		}
 
 		// On efface le repertoire de pdf provisoire
-		$comref = sanitizeFileName($this->ref);
+		$comref = dol_sanitizeFileName($this->ref);
 		if ($conf->commande->dir_output)
 		{
 			$dir = $conf->commande->dir_output . "/" . $comref ;
@@ -2170,7 +2170,7 @@ class Commande extends CommonObject
 			$clause = "AND";
 		}
 		$sql.= " ".$clause." s.entity = ".$conf->entity;
-		
+
 		$resql=$this->db->query($sql);
 		if ($resql)
 		{
diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php
index be17613f6b4..9bdf75885c0 100644
--- a/htdocs/commande/document.php
+++ b/htdocs/commande/document.php
@@ -75,7 +75,7 @@ if (! $commande->fetch($_GET['id'],$_GET['ref']) > 0)
 // Envoi fichier
 if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
 {
-	$upload_dir = $conf->commande->dir_output . "/" . sanitizeFileName($commande->ref);
+	$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($commande->ref);
 	if (! is_dir($upload_dir)) create_exdir($upload_dir);
 
 	if (is_dir($upload_dir))
@@ -97,7 +97,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
 // Delete
 if ($action=='delete')
 {
-	$upload_dir = $conf->commande->dir_output . "/" . sanitizeFileName($commande->ref);
+	$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($commande->ref);
 	$file = $upload_dir . '/' . urldecode($_GET['urlfile']);
 	dol_delete_file($file);
 	$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
@@ -114,7 +114,7 @@ $html = new Form($db);
 
 if ($id > 0 || ! empty($ref))
 {
-	$upload_dir = $conf->commande->dir_output.'/'.sanitizeFileName($commande->ref);
+	$upload_dir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($commande->ref);
 
 	$societe = new Societe($db);
 	$societe->fetch($commande->socid);
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 0cbc1056caf..b49f59d42c8 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -724,7 +724,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel'])
 	$result=$commande->fetch($_POST['orderid']);
 	if ($result)
 	{
-		$ref = sanitizeFileName($commande->ref);
+		$ref = dol_sanitizeFileName($commande->ref);
 		$file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
 
 		if (is_readable($file))
@@ -1267,7 +1267,7 @@ else
 				$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id,$langs->trans('CloneOrder'),$langs->trans('ConfirmCloneOrder',$commande->ref),'confirm_clone',$formquestion,'yes');
 				print '<br>';
 			}
-			
+
 			/*
 			 *   Commande
 			 */
@@ -1966,7 +1966,7 @@ else
 					{
 						if ($user->rights->commande->envoyer)
 						{
-							$comref = sanitizeFileName($commande->ref);
+							$comref = dol_sanitizeFileName($commande->ref);
 							$file = $conf->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf';
 							if (file_exists($file))
 							{
@@ -2075,7 +2075,7 @@ else
 				 * Documents generes
 				 *
 				 */
-				$comref = sanitizeFileName($commande->ref);
+				$comref = dol_sanitizeFileName($commande->ref);
 				$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
 				$relativepath = $comref.'/'.$comref.'.pdf';
 				$filedir = $conf->commande->dir_output . '/' . $comref;
@@ -2142,7 +2142,7 @@ else
 			 */
 			if ($_GET['action'] == 'presend')
 			{
-				$ref = sanitizeFileName($commande->ref);
+				$ref = dol_sanitizeFileName($commande->ref);
 				$file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
 
 				print '<br>';
diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php
index 29d90669b01..da3ecb9cd5d 100644
--- a/htdocs/commande/index.php
+++ b/htdocs/commande/index.php
@@ -157,8 +157,8 @@ if ( $db->query($sql) )
 			print '</td>';
 
 			print '<td width="16" align="right" class="nobordernopadding">';
-			$filename=sanitizeFileName($obj->ref);
-			$filedir=$conf->commande->dir_output . '/' . sanitizeFileName($obj->ref);
+			$filename=dol_sanitizeFileName($obj->ref);
+			$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
 			$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
 			$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
 			print '</td></tr></table>';
@@ -193,7 +193,7 @@ $sql.= " ORDER BY c.rowid DESC";
 if ( $db->query($sql) )
 {
 	$num = $db->num_rows();
-	
+
 	print '<table class="noborder" width="100%">';
 	print '<tr class="liste_titre">';
 	print '<td colspan="3">'.$langs->trans("OnProcessOrders").' ('.$num.')</td></tr>';
@@ -222,8 +222,8 @@ if ( $db->query($sql) )
 			print '</td>';
 
 			print '<td width="16" align="right" class="nobordernopadding">';
-			$filename=sanitizeFileName($obj->ref);
-			$filedir=$conf->commande->dir_output . '/' . sanitizeFileName($obj->ref);
+			$filename=dol_sanitizeFileName($obj->ref);
+			$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
 			$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
 			$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
 			print '</td></tr></table>';
@@ -290,8 +290,8 @@ if ($resql)
 			print '</td>';
 
 			print '<td width="16" align="right" class="nobordernopadding">';
-			$filename=sanitizeFileName($obj->ref);
-			$filedir=$conf->commande->dir_output . '/' . sanitizeFileName($obj->ref);
+			$filename=dol_sanitizeFileName($obj->ref);
+			$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
 			$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
 			$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
 			print '</td></tr></table>';
diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php
index 1a40023516a..d3f8c2040a9 100644
--- a/htdocs/commande/liste.php
+++ b/htdocs/commande/liste.php
@@ -199,14 +199,14 @@ if ($resql)
 		print '<td width="90" class="nobordernopadding" nowrap="nowrap">';
 		print $generic_commande->getNomUrl(1,$objp->fk_statut);
 		print '</td>';
-		 
+
 		print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
 		if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $objp->date_commande < ($now - $conf->commande->traitement->warning_delay)) print img_picto($langs->trans("Late"),"warning");
 		print '</td>';
 
 		print '<td width="16" align="right" class="nobordernopadding">';
-		$filename=sanitizeFileName($objp->ref);
-		$filedir=$conf->commande->dir_output . '/' . sanitizeFileName($objp->ref);
+		$filename=dol_sanitizeFileName($objp->ref);
+		$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
 		$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid;
 		$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
 		print '</td></tr></table>';
@@ -214,9 +214,9 @@ if ($resql)
 		print '</td>';
 
 		print '<td><a href="../comm/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>';
-		
+
 		print '<td>'.$objp->ref_client.'</td>';
-		
+
 		// Date
 		$y = dol_print_date($objp->date_commande,'%Y');
 		$m = dol_print_date($objp->date_commande,'%m');
diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php
index f0a50c8cf6c..46262051181 100644
--- a/htdocs/compta/bank/fiche.php
+++ b/htdocs/compta/bank/fiche.php
@@ -41,16 +41,16 @@ if ($_POST["action"] == 'add')
 {
     // Creation compte
     $account = new Account($db,0);
-    
-    $account->ref           = sanitizeFileName(trim($_POST["ref"]));
+
+    $account->ref           = dol_sanitizeFileName(trim($_POST["ref"]));
     $account->label         = trim($_POST["label"]);
     $account->courant       = $_POST["type"];
     $account->clos          = $_POST["clos"];
     $account->rappro        = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
     $account->url           = $_POST["url"];
-    
+
     $account->account_number  = trim($_POST["account_number"]);
-    
+
     $account->solde           = $_POST["solde"];
     $account->date_solde      = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
 
@@ -60,7 +60,7 @@ if ($_POST["action"] == 'add')
     $account->min_allowed     = $_POST["account_min_allowed"];
     $account->min_desired     = $_POST["account_min_desired"];
     $account->comment         = trim($_POST["account_comment"]);
-    
+
     if ($account->label)
     {
         $id = $account->create($user->id);
@@ -187,7 +187,7 @@ if ($_GET["action"] == 'create')
 		print '<input type="hidden" name="account_number" value="'.$account->account_number.'">';
 	}
 
-	// Currency		
+	// Currency
 	print '<tr><td valign="top">'.$langs->trans("Currency").'</td>';
 	print '<td colspan="3">';
 /*
@@ -199,7 +199,7 @@ if ($_GET["action"] == 'create')
 	print '<input type="hidden" name="account_currency_code" value="'.$conf->monnaie.'">';
 	print '</td></tr>';
 
-	// Pays		
+	// Pays
 	print '<tr><td valign="top">'.$langs->trans("Country").'</td>';
 	print '<td colspan="3">';
 	$selectedcode=$account->account_country_code;
@@ -256,19 +256,19 @@ if ($_GET["action"] == 'create')
 /* ************************************************************************** */
 else
 {
-    if (($_GET["id"] || $_GET["ref"]) && $_GET["action"] != 'edit') 
+    if (($_GET["id"] || $_GET["ref"]) && $_GET["action"] != 'edit')
 	{
 		$account = new Account($db);
-		if ($_GET["id"]) 
+		if ($_GET["id"])
 		{
 			$account->fetch($_GET["id"]);
 		}
-		if ($_GET["ref"]) 
+		if ($_GET["ref"])
 		{
 			$account->fetch(0,$_GET["ref"]);
 			$_GET["id"]=$account->id;
 		}
-	
+
 		/*
 		* Affichage onglets
 		*/
@@ -276,7 +276,7 @@ else
 		// Onglets
 		$head=bank_prepare_head($account);
 		dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"));
-	
+
 		/*
 		* Confirmation de la suppression
 		*/
@@ -285,30 +285,30 @@ else
 			$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete");
 			print '<br />';
 		}
-	
+
 		print '<table class="border" width="100%">';
-	
+
 		// Ref
 		print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
 		print '<td colspan="3">';
 		print $form->showrefnav($account,'ref','',1,'ref');
 		print '</td></tr>';
-	
+
 		print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
 		print '<td colspan="3">'.$account->label.'</td></tr>';
-	
+
 		print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>';
 		print '<td colspan="3">'.$account->type_lib[$account->type].'</td></tr>';
-	
+
 		print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
 		print '<td colspan="3">'.$account->getLibStatut(4).'</td></tr>';
-	
+
 		print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
 		print '<td colspan="3">';
 		if ($account->type == 0 || $account->type == 1) print ($account->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')'));
 		if ($account->type == 2)                        print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
 		print '</td></tr>';
-	
+
 		// Code compta
 		if ($conf->comptaexpert->enabled)
 		{
@@ -316,7 +316,7 @@ else
 			print '<td colspan="3">'.$account->account_number.'</td></tr>';
 		}
 
-		// Currency		
+		// Currency
 		print '<tr><td valign="top">'.$langs->trans("Currency").'</td>';
 		print '<td colspan="3">';
 	/*
@@ -327,10 +327,10 @@ else
 		print $langs->trans("Currency".$conf->monnaie);
 		print '<input type="hidden" name="account_currency_code" value="'.$conf->monnaie.'">';
 		print '</td></tr>';
-	
+
 		print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
 		print '<td colspan="3">'.$account->min_allowed.'</td></tr>';
-	
+
 		print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
 		print '<td colspan="3">'.$account->min_desired.'</td></tr>';
 
@@ -339,34 +339,34 @@ else
 		print $account->url;
 		if ($account->url) print '</a>';
 		print "</td></tr>\n";
-	
+
 		print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
 		print '<td colspan="3">'.$account->comment.'</td></tr>';
-	
+
 		print '</table>';
-	
+
 		print '</div>';
-	
-	
+
+
 		/*
 		* Barre d'actions
 		*
 		*/
 		print '<div class="tabsAction">';
-	
+
 		if ($user->rights->banque->configurer)
 		{
 			print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$account->id.'">'.$langs->trans("Modify").'</a>';
 		}
-	
+
 		$canbedeleted=$account->can_be_deleted();   // Renvoi vrai si compte sans mouvements
 		if ($user->rights->banque->configurer && $canbedeleted)
 		{
 			print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$account->id.'">'.$langs->trans("Delete").'</a>';
 		}
-	
+
 		print '</div>';
-	
+
 	}
 
     /* ************************************************************************** */
@@ -374,46 +374,46 @@ else
     /* Edition                                                                    */
     /*                                                                            */
     /* ************************************************************************** */
-      
-    if ($_GET["id"] && $_GET["action"] == 'edit' && $user->rights->banque->configurer) 
+
+    if ($_GET["id"] && $_GET["action"] == 'edit' && $user->rights->banque->configurer)
     {
         $account = new Account($db, $_GET["id"]);
         $account->fetch($_GET["id"]);
-        
+
         print_titre($langs->trans("EditFinancialAccount"));
         print "<br>";
-        
+
         if ($message) { print "$message<br>\n"; }
-        
+
         print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$account->id.'" method="post">';
         print '<input type="hidden" name="action" value="update">';
         print '<input type="hidden" name="id" value="'.$_GET["id"].'">'."\n\n";
-        
+
         print '<table class="border" width="100%">';
-        
+
 		// Ref
 		print '<tr><td valign="top">'.$langs->trans("Ref").'</td>';
 		print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.$account->ref.'"></td></tr>';
 
         print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
         print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.$account->label.'"></td></tr>';
-        
+
         print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>';
         print '<td colspan="3">';
 		print $form->select_type_comptes_financiers($account->type,"type");
         print '</td></tr>';
-        
+
         print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
         print '<td colspan="3">';
         $form->select_array("clos",array(0=>$account->status[0],1=>$account->status[1]),$account->clos);
         print '</td></tr>';
-        
+
         print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
         print '<td colspan="3">';
         if ($account->type == 0 || $account->type == 1) print '<input type="checkbox" class="flat" name="norappro" '.($account->rappro?'':'checked="true"').'"> '.$langs->trans("DisableConciliation");
         if ($account->type == 2)                        print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
         print '</td></tr>';
-        
+
 		// Code compta
 		if ($conf->comptaexpert->enabled)
 		{
@@ -425,7 +425,7 @@ else
 	        print '<input type="hidden" name="account_number" value="'.$account->account_number.'">';
 		}
 
-		// Currency		
+		// Currency
 		print '<tr><td valign="top">'.$langs->trans("Currency");
 		print '<input type="hidden" value="'.$account->currency_code.'">';
 		print '</td>';
@@ -438,10 +438,10 @@ else
 		print $langs->trans("Currency".$conf->monnaie);
 		print '<input type="hidden" name="account_currency_code" value="'.$conf->monnaie.'">';
 		print '</td></tr>';
-	
+
 		print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
 		print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.$account->min_allowed.'"></td></tr>';
-	
+
 		print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
 		print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.$account->min_desired.'"></td></tr>';
 
@@ -466,7 +466,7 @@ else
 			print dol_htmlentitiesbr_decode($account->comment).'</textarea>';
 		}
 		print '</td></tr>';
-        
+
         print '<tr><td align="center" colspan="4"><input value="'.$langs->trans("Modify").'" type="submit" class="button">';
         print ' &nbsp; <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">';
         print '</td></tr>';
@@ -474,7 +474,7 @@ else
 
         print '</form>';
 	}
-      
+
 }
 
 
diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php
index d6e0b84f546..6bbfe07b3b7 100644
--- a/htdocs/compta/commande/fiche.php
+++ b/htdocs/compta/commande/fiche.php
@@ -526,7 +526,7 @@ if ($id > 0 || ! empty($ref))
 		 * Documents g�n�r�s
 		 *
 		 */
-		$comref = sanitizeFileName($commande->ref);
+		$comref = dol_sanitizeFileName($commande->ref);
 		$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
 		$relativepath = $comref.'/'.$comref.'.pdf';
 		$filedir = $conf->commande->dir_output . '/' . $comref;
diff --git a/htdocs/compta/commande/liste.php b/htdocs/compta/commande/liste.php
index 02fdb4ad199..3d72d00e9fc 100644
--- a/htdocs/compta/commande/liste.php
+++ b/htdocs/compta/commande/liste.php
@@ -132,28 +132,28 @@ if ($resql)
 
         $var=!$var;
         print "<tr $bc[$var]>";
-        
+
         print '<td width="20%" nowrap="nowrap">';
-        
+
         $generic_commande->id=$objp->rowid;
         $generic_commande->ref=$objp->ref;
-        
+
         print '<table class="nobordernopadding"><tr class="nocellnopadd">';
         print '<td width="90" class="nobordernopadding" nowrap="nowrap">';
         print $generic_commande->getNomUrl(1);
         print '</td>';
-        
+
         print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
         if (($objp->date_commande < ($now - $conf->commande->traitement->warning_delay)) && $objp->statutid == 1 ) print img_picto($langs->trans("Late"),"warning");
         print '</td>';
-        
+
         print '<td width="16" align="right" class="nobordernopadding">';
-        $filename=sanitizeFileName($objp->ref);
-        $filedir=$conf->commande->dir_output . '/' . sanitizeFileName($objp->ref);
+        $filename=dol_sanitizeFileName($objp->ref);
+        $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
         $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid;
         $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
         print '</td></tr></table>';
-        
+
         print '</td>';
 
         print "<td><a href=\"".DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid."\">".img_object($langs->trans("ShowCompany"),"company")." ".$objp->nom."</a>";
diff --git a/htdocs/compta/dons/fiche.php b/htdocs/compta/dons/fiche.php
index 8a8f02b8a93..183b62fbe44 100644
--- a/htdocs/compta/dons/fiche.php
+++ b/htdocs/compta/dons/fiche.php
@@ -454,7 +454,7 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
 	/*
 	 * Documents g�n�r�s
 	 */
-	$filename=sanitizeFileName($don->id);
+	$filename=dol_sanitizeFileName($don->id);
 	$filedir=$conf->don->dir_output . '/' . get_exdir($filename,2);
 	$urlsource=$_SERVER['PHP_SELF'].'?rowid='.$don->id;
 	//            $genallowed=($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer);
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index ca4cfa22b94..5d56969054b 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1150,7 +1150,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a
 	$result=$fac->fetch($_POST['facid']);
 	if ($result)
 	{
-		$ref = sanitizeFileName($fac->ref);
+		$ref = dol_sanitizeFileName($fac->ref);
 		$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
 
 		if (is_readable($file))
@@ -3338,8 +3338,8 @@ else
 				/*
 				 * Documents g�n�r�s
 				 */
-				$filename=sanitizeFileName($fac->ref);
-				$filedir=$conf->facture->dir_output . '/' . sanitizeFileName($fac->ref);
+				$filename=dol_sanitizeFileName($fac->ref);
+				$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($fac->ref);
 				$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
 				$genallowed=$user->rights->facture->creer;
 				$delallowed=$user->rights->facture->supprimer;
@@ -3474,7 +3474,7 @@ else
 			 */
 			if ($_GET['action'] == 'presend')
 			{
-				$ref = sanitizeFileName($fac->ref);
+				$ref = dol_sanitizeFileName($fac->ref);
 				$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
 
 				// Construit PDF si non existant
@@ -3541,7 +3541,7 @@ else
 
 			if ($_GET['action'] == 'prerelance')
 			{
-				$ref = sanitizeFileName($fac->ref);
+				$ref = dol_sanitizeFileName($fac->ref);
 				$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
 
 				// Construit PDF si non existant
@@ -3787,8 +3787,8 @@ else
 					print '</td>';
 
 					print '<td width="16" align="right" class="nobordernopadding">';
-					$filename=sanitizeFileName($objp->facnumber);
-					$filedir=$conf->facture->dir_output . '/' . sanitizeFileName($objp->facnumber);
+					$filename=dol_sanitizeFileName($objp->facnumber);
+					$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($objp->facnumber);
 					$urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid;
 					$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
 					print '</td>';
diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php
index b53c5dcea65..d1d5ba0e819 100644
--- a/htdocs/compta/facture/apercu.php
+++ b/htdocs/compta/facture/apercu.php
@@ -136,7 +136,7 @@ if ($_GET["facid"] > 0)
         /*
          * Documents
          */
-        $facref = sanitizeFileName($fac->ref);
+        $facref = dol_sanitizeFileName($fac->ref);
         $dir_output = $conf->facture->dir_output . "/";
 				$filepath = $dir_output . $facref . "/";
         $file = $filepath . $facref . ".pdf";
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index 3b326dcdcc1..daea34688cb 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -73,7 +73,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
 	$facture = new Facture($db);
 	if ($facture->fetch($facid))
 	{
-		$upload_dir = $conf->facture->dir_output . "/" . sanitizeFileName($facture->ref);
+		$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($facture->ref);
 		if (! is_dir($upload_dir)) create_exdir($upload_dir);
 
 		if (is_dir($upload_dir))
@@ -101,7 +101,7 @@ if ($action=='delete')
 	$facid=$_GET["id"];
 	if ($facture->fetch($facid))
 	{
-		$upload_dir = $conf->facture->dir_output . "/" . sanitizeFileName($facture->ref);
+		$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($facture->ref);
 		$file = $upload_dir . '/' . urldecode($_GET['urlfile']);
 		dol_delete_file($file);
 		$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
@@ -119,7 +119,7 @@ if ($facid > 0)
 	$facture = new Facture($db);
 	if ($facture->fetch($facid))
 	{
-		$upload_dir = $conf->facture->dir_output.'/'.sanitizeFileName($facture->ref);
+		$upload_dir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($facture->ref);
 
 		$societe = new Societe($db);
 		$societe->fetch($facture->socid);
diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php
index 9fd4f35a330..f8dd006469b 100644
--- a/htdocs/compta/facture/impayees.php
+++ b/htdocs/compta/facture/impayees.php
@@ -96,8 +96,8 @@ if ($_POST["action"] == "builddoc" && $user->rights->facture->lire)
 		create_exdir($diroutputpdf);
 
 		// Save merged file
-		$filename=strtolower(sanitizeFileName($langs->transnoentities("Unpayed")));
-		if ($option=='late') $filename.='_'.strtolower(sanitizeFileName($langs->transnoentities("Late")));
+		$filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Unpayed")));
+		if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
 		if ($pagecount)
 		{
 			$file=$diroutputpdf.'/'.$filename.'_'.dol_print_date(mktime(),'dayhourlog').'.pdf';
@@ -338,8 +338,8 @@ if ($result)
 
 			// PDF Picto
 			print '<td width="16" align="right" class="nobordernopadding">';
-			$filename=sanitizeFileName($objp->facnumber);
-			$filedir=$conf->facture->dir_output . '/' . sanitizeFileName($objp->facnumber);
+			$filename=dol_sanitizeFileName($objp->facnumber);
+			$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($objp->facnumber);
 			$foundpdf=$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1,$param);
 			print '</td>';
 
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index edca0eaae74..2f2e6944026 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -555,8 +555,8 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman
 				print '&nbsp;';
 				print '</td>';
 				print '<td width="16" align="right" class="nobordernopadding">';
-				$filename=sanitizeFileName($obj->ref);
-				$filedir=$conf->commande->dir_output . '/' . sanitizeFileName($obj->ref);
+				$filename=dol_sanitizeFileName($obj->ref);
+				$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
 				$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
 				$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
 				print '</td></tr></table>';
@@ -651,8 +651,8 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
 				if ($obj->datelimite < ($now - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late"));
 				print '</td>';
 				print '<td width="16" align="right" class="nobordernopadding">';
-				$filename=sanitizeFileName($obj->facnumber);
-				$filedir=$conf->facture->dir_output . '/' . sanitizeFileName($obj->facnumber);
+				$filename=dol_sanitizeFileName($obj->facnumber);
+				$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber);
 				$urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
 				$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
 				print '</td></tr></table>';
diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php
index 63677dc1dc9..7f1f5844974 100644
--- a/htdocs/compta/propal.php
+++ b/htdocs/compta/propal.php
@@ -491,8 +491,8 @@ if ($id > 0 || ! empty($ref))
 	/*
 	 * Documents generes
 	 */
-	$filename=sanitizeFileName($propal->ref);
-	$filedir=$conf->propale->dir_output . "/" . sanitizeFileName($propal->ref);
+	$filename=dol_sanitizeFileName($propal->ref);
+	$filedir=$conf->propale->dir_output . "/" . dol_sanitizeFileName($propal->ref);
 	$urlsource=$_SERVER["PHP_SELF"]."?propalid=".$propal->id;
 	$genallowed=0;
 	$delallowed=0;
@@ -773,8 +773,8 @@ else
 
 			print '<td width="16" align="right" class="nobordernopadding">';
 
-			$filename=sanitizeFileName($objp->ref);
-			$filedir=$conf->propale->dir_output . '/' . sanitizeFileName($objp->ref);
+			$filename=dol_sanitizeFileName($objp->ref);
+			$filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($objp->ref);
 			$urlsource=$_SERVER['PHP_SELF'].'?propalid='.$objp->propalid;
 			$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','','','',1);
 
diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php
index 38bcc1f9ab2..038f83c3f39 100644
--- a/htdocs/contact/vcard.php
+++ b/htdocs/contact/vcard.php
@@ -85,8 +85,8 @@ $db->close();
 $output = $v->getVCard();
 
 $filename =trim(urldecode($v->getFileName()));      // "Nom prenom.vcf"
-$filenameurlencoded = sanitizeFileName(urlencode($filename));
-//$filename = sanitizeFileName($filename);
+$filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
+//$filename = dol_sanitizeFileName($filename);
 
 Header("Content-Disposition: attachment; filename=\"$filename\"");
 Header("Content-Length: ".strlen($output));
diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php
index 0fdb81aba2d..c53b0a0b254 100644
--- a/htdocs/contrat/document.php
+++ b/htdocs/contrat/document.php
@@ -63,7 +63,7 @@ $pagenext = $page + 1;
 $contrat = new Contrat($db);
 $contrat->fetch($_GET["id"]);
 
-$upload_dir = $conf->contrat->dir_output.'/'.sanitizeFileName($contrat->ref);
+$upload_dir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($contrat->ref);
 $modulepart='contract';
 
 
diff --git a/htdocs/ecm/ecmdirectory.class.php b/htdocs/ecm/ecmdirectory.class.php
index 340436d1d85..6f891bec62e 100644
--- a/htdocs/ecm/ecmdirectory.class.php
+++ b/htdocs/ecm/ecmdirectory.class.php
@@ -38,31 +38,31 @@ class EcmDirectory // extends CommonObject
 	var $errors=array();				//!< To return several error codes (or messages)
 	//var $element='ecm_directories';			//!< Id that identify managed objects
 	//var $table_element='ecm_directories';	//!< Name of table without prefix where object is stored
-    
+
     var $id;
-    
+
 	var $label;
 	var $fk_parent;
 	var $description;
 	var $cachenbofdoc;
 	var $date_c;
 	var $date_m;
-		
+
     var $cats=array();
 	var $motherof=array();
-	
-	
+
+
     /**
      *      \brief      Constructor
      *      \param      DB      Database handler
      */
-    function EcmDirectory($DB) 
+    function EcmDirectory($DB)
     {
         $this->db = $DB;
         return 1;
     }
 
-	
+
     /**
      *      \brief      Create in database
      *      \param      user        User that create
@@ -71,9 +71,9 @@ class EcmDirectory // extends CommonObject
     function create($user)
     {
     	global $conf, $langs;
-    	
+
 		$now=time();
-		
+
 		// Clean parameters
     	$this->label=dol_string_nospecial(trim($this->label));
 		$this->fk_parent=trim($this->fk_parent);
@@ -112,12 +112,12 @@ class EcmDirectory // extends CommonObject
 		{
 	        $this->error="ErrorDirAlreadyExists";
 	        dol_syslog("EcmDirectories::create ".$this->error, LOG_WARNING);
-			return -1;			
+			return -1;
 		}
 		else
 		{
 	        $this->db->begin();
-	        
+
 	        // Insert request
 			$sql = "INSERT INTO ".MAIN_DB_PREFIX."ecm_directories(";
 			$sql.= "label,";
@@ -136,23 +136,23 @@ class EcmDirectory // extends CommonObject
 			$sql.= " ".$this->db->idate($this->date_c).",";
 			$sql.= " '".$this->fk_user_c."'";
 			$sql.= ")";
-	
+
 		   	dol_syslog("EcmDirectories::create sql=".$sql, LOG_DEBUG);
 	        $resql=$this->db->query($sql);
 	        if ($resql)
 	        {
 	            $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."ecm_directories");
-	    
+
 				$dir=$conf->ecm->dir_output.'/'.$this->getRelativePath();
 				$result=create_exdir($dir);
-				
+
 	            // Appel des triggers
 	            include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
 	            $interface=new Interfaces($this->db);
 	            $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
 	            if ($result < 0) { $error++; $this->errors=$interface->errors; }
 	            // Fin appel triggers
-	
+
 	            if (! $error)
 	            {
 	            	$this->db->commit();
@@ -183,26 +183,26 @@ class EcmDirectory // extends CommonObject
     function update($user=0, $notrigger=0)
     {
     	global $conf, $langs;
-    	
+
     	$error=0;
-    	
+
     	// Clean parameters
     	$this->label=trim($this->label);
     	$this->fk_parent=trim($this->fk_parent);
     	$this->description=trim($this->description);
-    	
+
     	// Check parameters
     	// Put here code to add control on parameters values
-    	
+
     	$this->db->begin();
-    	
+
     	// Update request
     	$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
     	$sql.= " label='".addslashes($this->label)."',";
     	$sql.= " fk_parent='".$this->fk_parent."',";
     	$sql.= " description='".addslashes($this->description)."'";
     	$sql.= " WHERE rowid=".$this->id;
-    	
+
     	dol_syslog("EcmDirectories::update sql=".$sql, LOG_DEBUG);
     	$resql = $this->db->query($sql);
     	if (! $resql)
@@ -211,7 +211,7 @@ class EcmDirectory // extends CommonObject
       	$this->error="Error ".$this->db->lasterror();
         dol_syslog("EcmDirectories::update ".$this->error, LOG_ERR);
       }
-      
+
       if (! $error && ! $notrigger)
       {
       	// Appel des triggers
@@ -221,7 +221,7 @@ class EcmDirectory // extends CommonObject
         if ($result < 0) { $error++; $this->errors=$interface->errors; }
         // Fin appel triggers
     	}
-    	
+
     	if (! $error)
       {
       	$this->db->commit();
@@ -233,8 +233,8 @@ class EcmDirectory // extends CommonObject
         return -1;
       }
     }
-  
-  
+
+
     /**
      *      \brief      Update database
      * 		\sign		'+' or '-'
@@ -243,7 +243,7 @@ class EcmDirectory // extends CommonObject
     function changeNbOfFiles($sign)
     {
     	global $conf, $langs;
-    	
+
     	// Update request
     	$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
     	$sql.= " cachenbofdoc = cachenbofdoc ".$sign." 1";
@@ -261,7 +261,7 @@ class EcmDirectory // extends CommonObject
       return 1;
     }
 
-    
+
 	/**
      *    \brief      Load object in memory from database
      *    \param      id          id object
@@ -281,7 +281,7 @@ class EcmDirectory // extends CommonObject
     	$sql.= " ".$this->db->pdate('t.date_m')." as date_m";
     	$sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories as t";
     	$sql.= " WHERE t.rowid = ".$id;
-    
+
     	dol_syslog("EcmDirectories::fetch sql=".$sql, LOG_DEBUG);
       $resql=$this->db->query($sql);
       if ($resql)
@@ -291,7 +291,7 @@ class EcmDirectory // extends CommonObject
       	{
       		$this->id    = $obj->rowid;
           $this->ref   = $obj->rowid;
-          
+
           $this->label = $obj->label;
           $this->fk_parent = $obj->fk_parent;
           $this->description = $obj->description;
@@ -301,9 +301,9 @@ class EcmDirectory // extends CommonObject
           $this->date_c = $obj->date_c;
           $this->date_m = $obj->date_m;
         }
-        
+
         $this->db->free($resql);
-        
+
         return $obj?1:0;
       }
       else
@@ -313,8 +313,8 @@ class EcmDirectory // extends CommonObject
         return -1;
       }
     }
-    
-    
+
+
  	/**
 	*   \brief      Delete object in database
     *	\param      user        User that delete
@@ -323,10 +323,10 @@ class EcmDirectory // extends CommonObject
 	function delete($user)
 	{
 		global $conf, $langs;
-	
+
 		$sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_directories";
 		$sql.= " WHERE rowid=".$this->id;
-	
+
 	   	dol_syslog("EcmDirectories::delete sql=".$sql);
 		$resql = $this->db->query($sql);
 		if (! $resql)
@@ -335,10 +335,10 @@ class EcmDirectory // extends CommonObject
             dol_syslog("EcmDirectories::delete ".$this->error, LOG_ERR);
 			return -1;
 		}
-	
+
 		$file = $conf->ecm->dir_output . "/" . $this->label;
 		$result=@dol_delete_dir($file);
-		
+
         // Appel des triggers
         include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
         $interface=new Interfaces($this->db);
@@ -349,7 +349,7 @@ class EcmDirectory // extends CommonObject
 		return 1;
 	}
 
-  
+
 	/**
 	 *		\brief		Initialise object with example values
 	 *		\remarks	id must be 0 if object instance is a specimen.
@@ -357,13 +357,13 @@ class EcmDirectory // extends CommonObject
 	function initAsSpecimen()
 	{
 		$this->id=0;
-		
+
 		$this->label='MyDirectory';
 		$this->fk_parent='0';
 		$this->description='This is a directory';
 	}
 
-	
+
   	/**
      \brief      	Renvoie nom clicable (avec eventuellement le picto)
      \param			withpicto		0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
@@ -373,21 +373,21 @@ class EcmDirectory // extends CommonObject
   	function getNomUrl($withpicto=0,$option='')
   	{
 	    global $langs;
-			
+
 	    $result='';
-			
+
 	    $lien = '<a href="'.DOL_URL_ROOT.'/ecm/docmine.php?section='.$this->id.'">';
 	    if ($option == 'index') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true">';
 	    if ($option == 'indexexpanded') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=false">';
 	    if ($option == 'indexnotexpanded') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true">';
 	    $lienfin='</a>';
-			
+
 	    //$picto=DOL_URL_ROOT.'/theme/common/treemenu/folder.gif';
 		$picto='dir';
-	
+
 		$newref=eregi_replace('_',' ',$this->ref);
 		$newlabel=$langs->trans("ShowECMSection").': '.$newref;
-	    
+
 	    if ($withpicto) $result.=($lien.img_object($newlabel,$picto,'',1).$lienfin);
 	    if ($withpicto && $withpicto != 2) $result.=' ';
 	    if ($withpicto != 2) $result.=$lien.$newref.$lienfin;
@@ -402,7 +402,7 @@ class EcmDirectory // extends CommonObject
   	function getRelativePath($force=0)
   	{
 	    $this->get_full_arbo($force);
-	    
+
 		$ret='';
 		$idtosearch=$this->id;
 		$i=0;
@@ -418,21 +418,21 @@ class EcmDirectory // extends CommonObject
 				}
 			}
 			//print "c=".$idtosearch."-".$cursorindex;
-			
+
 			if ($cursorindex >= 0)
 			{
 				// Path is label sanitized (no space and no special char) and concatenated
-				$ret=sanitizeFileName($this->cats[$cursorindex]['label']).'/'.$ret;
-			
+				$ret=dol_sanitizeFileName($this->cats[$cursorindex]['label']).'/'.$ret;
+
 				$idtosearch=$this->cats[$cursorindex]['id_mere'];
 				$i++;
 			}
 		}
 		while ($cursorindex >= 0 && ! empty($idtosearch) && $i < 100);	// i avoid infinite loop
-		
+
 		return $ret;
   	}
-  	
+
   	/**
 	* 	\brief		Load this->motherof that is array(id_son=>id_parent, ...)
 	*	\return		int		<0 if KO, >0 if OK
@@ -440,15 +440,15 @@ class EcmDirectory // extends CommonObject
 	function load_motherof()
 	{
 		global $conf;
-		
+
 		$this->motherof=array();
-		
+
 		// Charge tableau des meres
 		$sql = "SELECT fk_parent as id_parent, rowid as id_son";
 		$sql.= " FROM ".MAIN_DB_PREFIX."ecm_directories";
 		$sql.= " WHERE fk_parent != 0";
 		$sql.= " AND entity = ".$conf->entity;
-		
+
 		dol_syslog("EcmDirectory::get_full_arbo sql=".$sql);
 		$resql = $this->db->query($sql);
 		if ($resql)
@@ -465,7 +465,7 @@ class EcmDirectory // extends CommonObject
 			return -1;
 		}
 	}
-		
+
 
 	/**
 	* 	\brief		Reconstruit l'arborescence des categories sous la forme d'un tableau
@@ -488,14 +488,14 @@ class EcmDirectory // extends CommonObject
 	function get_full_arbo($force=0)
 	{
 		global $conf;
-		
+
 		if (empty($force) && $this->full_arbo_loaded)
 		{
 			return $this->cats;
 		}
-		
+
 		// Init this->motherof that is array(id_son=>id_parent, ...)
-		$this->load_motherof();	
+		$this->load_motherof();
 
 		// Charge tableau des categories
 		$sql = "SELECT c.rowid as rowid, c.label as label,";
@@ -528,7 +528,7 @@ class EcmDirectory // extends CommonObject
 				$this->cats[$obj->rowid]['date_c'] = $obj->date_c;
 				$this->cats[$obj->rowid]['fk_user_c'] = $obj->fk_user_c;
 				$this->cats[$obj->rowid]['login_c'] = $obj->login_c;
-				
+
 				if ($obj->rowid_fille)
 				{
 					if (is_array($this->cats[$obj->rowid]['id_children']))
@@ -542,7 +542,7 @@ class EcmDirectory // extends CommonObject
 						//print "this->cats[".$obj->rowid."]['id_children'] n'est pas encore un tableau<br>";
 						$this->cats[$obj->rowid]['id_children']=array($obj->rowid_fille);
 					}
-				}				
+				}
 				$i++;
 
 			}
@@ -552,20 +552,20 @@ class EcmDirectory // extends CommonObject
 			dol_print_error ($this->db);
 			return -1;
 		}
-		
+
 		// On ajoute la propriete fullpath a tous les �l�ments
 		foreach($this->cats as $key => $val)
 		{
-			if (isset($motherof[$key])) continue;	
+			if (isset($motherof[$key])) continue;
 			$this->build_path_from_id_categ($key,0);
 		}
-		
+
 		$this->cats=dol_sort_array($this->cats, 'fulllabel', 'asc', true, false);
 		$this->full_arbo_loaded=1;
-		
+
 		return $this->cats;
 	}
-	
+
 	/**
 	*	\brief		Calcule les proprietes fullpath et fulllabel d'une categorie
 	*				du tableau this->cats et de toutes ces enfants
@@ -584,12 +584,12 @@ class EcmDirectory // extends CommonObject
 		}
 		else
 		{
-			$this->cats[$id_categ]['fullpath']='_'.$id_categ;			
+			$this->cats[$id_categ]['fullpath']='_'.$id_categ;
 			$this->cats[$id_categ]['fulllabel']=$this->cats[$id_categ]['label'];
 		}
 		// We count number of _ to have level
 		$this->cats[$id_categ]['level']=strlen(eregi_replace('[^_]','',$this->cats[$id_categ]['fullpath']));
-				
+
 		// Traite ces enfants
 		$protection++;
 		if ($protection > 20) return;	// On ne traite pas plus de 20 niveaux
@@ -600,9 +600,9 @@ class EcmDirectory // extends CommonObject
 				$this->build_path_from_id_categ($val,$protection);
 			}
 		}
-		
+
 		return 1;
-	}	
+	}
 
 	/**
 	*	\brief		Refresh value for cachenboffile
@@ -614,13 +614,13 @@ class EcmDirectory // extends CommonObject
 	{
 		global $conf;
 		include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
-		
+
 		$dir=$conf->ecm->dir_output.'/'.$this->getRelativePath();
 		$filelist=dol_dir_list($dir,'files',0,'','\.meta$');
 
 		// Test if filelist is in database
-		
-		
+
+
 		// Update request
     $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
 		$sql.= " cachenbofdoc = '".sizeof($filelist)."'";
@@ -632,7 +632,7 @@ class EcmDirectory // extends CommonObject
     {
     	$sql.= " WHERE entity = ".$conf->entity;
     }
-    
+
     dol_syslog("EcmDirectories::refreshcachenboffile sql=".$sql, LOG_DEBUG);
     $resql = $this->db->query($sql);
     if ($resql)
@@ -646,7 +646,7 @@ class EcmDirectory // extends CommonObject
       dol_syslog("EcmDirectories::refreshcachenboffile ".$this->error, LOG_ERR);
       return -1;
     }
-	}	
-	
+	}
+
 }
 ?>
diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php
index 9058ffc040f..e682aed7100 100644
--- a/htdocs/expedition/expedition.class.php
+++ b/htdocs/expedition/expedition.class.php
@@ -83,7 +83,7 @@ class Expedition extends CommonObject
 
 		// Clean parameters
 		$this->brouillon = 1;
-		$this->tracking_number = sanitizeFileName($this->tracking_number);
+		$this->tracking_number = dol_sanitizeFileName($this->tracking_number);
 
 		$this->user = $user;
 
@@ -404,7 +404,7 @@ class Expedition extends CommonObject
 	  	}
 
 	  	// On efface le r�pertoire de pdf provisoire
-	  	$expeditionref = sanitizeFileName($provref);
+	  	$expeditionref = dol_sanitizeFileName($provref);
 	  	if ($conf->expedition->dir_output)
 	  	{
 	  		$dir = $conf->expedition->dir_output . "/" . $expeditionref;
@@ -538,7 +538,7 @@ class Expedition extends CommonObject
 	        		$this->db->commit();
 
 					// On efface le r�pertoire de pdf provisoire
-					$expref = sanitizeFileName($this->ref);
+					$expref = dol_sanitizeFileName($this->ref);
 					if ($conf->expedition->dir_output)
 					{
 						$dir = $conf->expedition->dir_output . "/" . $expref ;
diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php
index c98a158d18d..861dd76de81 100644
--- a/htdocs/expedition/fiche.php
+++ b/htdocs/expedition/fiche.php
@@ -847,7 +847,7 @@ else
 		 */
 		if ($conf->expedition_bon->enabled)
 		{
-			$expeditionref = sanitizeFileName($expedition->ref);
+			$expeditionref = dol_sanitizeFileName($expedition->ref);
 			$filedir = $conf->expedition->dir_bon_expedition . "/" .$expeditionref;
 
 			$urlsource = $_SERVER["PHP_SELF"]."?id=".$expedition->id;
diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php
index 022352271cd..71c37974cc1 100644
--- a/htdocs/facture.class.php
+++ b/htdocs/facture.class.php
@@ -1308,8 +1308,8 @@ class Facture extends CommonObject
 			{
 				// On renomme repertoire facture ($this->ref = ancienne ref, $numfa = nouvelle ref)
 				// afin de ne pas perdre les fichiers attach�s
-				$facref = sanitizeFileName($this->ref);
-				$snumfa = sanitizeFileName($numfa);
+				$facref = dol_sanitizeFileName($this->ref);
+				$snumfa = dol_sanitizeFileName($numfa);
 				$dirsource = $conf->facture->dir_output.'/'.$facref;
 				$dirdest = $conf->facture->dir_output.'/'.$snumfa;
 				if (file_exists($dirsource))
@@ -2546,7 +2546,7 @@ class Facture extends CommonObject
 		$sql.= " AND s.entity = ".$conf->entity;
 		$sql.= " AND f.fk_statut = 1";
 		if ($user->societe_id) $sql.= " AND f.fk_soc = ".$user->societe_id;
-		
+
 		$resql=$this->db->query($sql);
 		if ($resql)
 		{
@@ -2674,7 +2674,7 @@ class Facture extends CommonObject
 		global $conf, $user;
 
 		$this->nb=array();
-		
+
 		$clause = "WHERE";
 
 		$sql = "SELECT count(f.rowid) as nb";
@@ -2687,7 +2687,7 @@ class Facture extends CommonObject
 			$clause = "AND";
 		}
 		$sql.= " ".$clause." s.entity = ".$conf->entity;
-		
+
 		$resql=$this->db->query($sql);
 		if ($resql)
 		{
diff --git a/htdocs/fichinter/apercu.php b/htdocs/fichinter/apercu.php
index 8145598ff47..b47cdc59b1e 100644
--- a/htdocs/fichinter/apercu.php
+++ b/htdocs/fichinter/apercu.php
@@ -109,7 +109,7 @@ if ($_GET["id"] > 0) {
 				/*
   			 * Documents
  				 */
-				$fichinterref = sanitizeFileName($fichinter->ref);
+				$fichinterref = dol_sanitizeFileName($fichinter->ref);
 				$dir_output = $conf->ficheinter->dir_output . "/";
 				$filepath = $dir_output . $fichinterref . "/";
 				$file = $filepath . $fichinterref . ".pdf";
diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php
index 9aeb9f382ce..1c33508c127 100644
--- a/htdocs/fichinter/document.php
+++ b/htdocs/fichinter/document.php
@@ -64,7 +64,7 @@ $pagenext = $page + 1;
 $object = new Fichinter($db);
 $object->fetch($_GET["id"]);
 
-$upload_dir = $conf->ficheinter->dir_output.'/'.sanitizeFileName($object->ref);
+$upload_dir = $conf->ficheinter->dir_output.'/'.dol_sanitizeFileName($object->ref);
 $modulepart='fichinter';
 
 
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index c3e6d73b072..a12228ad2a9 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -509,10 +509,10 @@ elseif ($_GET["id"] > 0)
 		exit;
 	}
 	$fichinter->fetch_client();
-	
+
 	$societe=new Societe($db);
 	$societe->fetch($fichinter->socid);
-	
+
 	if ($mesg) print $mesg."<br>";
 
 	$head = fichinter_prepare_head($fichinter);
@@ -902,7 +902,7 @@ elseif ($_GET["id"] > 0)
 	/*
 	 * Built documents
 	 */
-	$filename=sanitizeFileName($fichinter->ref);
+	$filename=dol_sanitizeFileName($fichinter->ref);
 	$filedir=$conf->ficheinter->dir_output . "/".$fichinter->ref;
 	$urlsource=$_SERVER["PHP_SELF"]."?id=".$fichinter->id;
 	$genallowed=$user->rights->ficheinter->creer;
diff --git a/htdocs/fichinter/fichinter.class.php b/htdocs/fichinter/fichinter.class.php
index 4e5d7ae8ffc..0bb789362df 100644
--- a/htdocs/fichinter/fichinter.class.php
+++ b/htdocs/fichinter/fichinter.class.php
@@ -387,9 +387,9 @@ class Fichinter extends CommonObject
 			if (! file_exists($dir.$file))
 			{
 				$file='mod_'.$file;
-				$classname='mod_'.$classname;		
+				$classname='mod_'.$classname;
 			}
-			
+
 			// Chargement de la classe de numerotation
 			require_once($dir.$file);
 
@@ -479,7 +479,7 @@ class Fichinter extends CommonObject
 			{
 
 				// Remove directory with files
-				$fichinterref = sanitizeFileName($this->ref);
+				$fichinterref = dol_sanitizeFileName($this->ref);
 				if ($conf->ficheinter->dir_output)
 				{
 					$dir = $conf->ficheinter->dir_output . "/" . $fichinterref ;
diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php
index 515b76700eb..1f46dae426e 100644
--- a/htdocs/fourn/commande/document.php
+++ b/htdocs/fourn/commande/document.php
@@ -76,7 +76,7 @@ if ($commande->fetch($_GET['id'],$_GET['ref']) < 0)
 // Envoi fichier
 if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
 {
-	$upload_dir = $conf->fournisseur->dir_commande . "/" . sanitizeFileName($commande->ref);
+	$upload_dir = $conf->fournisseur->dir_commande . "/" . dol_sanitizeFileName($commande->ref);
 	if (! is_dir($upload_dir)) create_exdir($upload_dir);
 
 	if (is_dir($upload_dir))
@@ -98,7 +98,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
 // Delete
 if ($action=='delete')
 {
-	$upload_dir = $conf->fournisseur->dir_commande . "/" . sanitizeFileName($commande->ref);
+	$upload_dir = $conf->fournisseur->dir_commande . "/" . dol_sanitizeFileName($commande->ref);
 	$file = $upload_dir . '/' . urldecode($_GET['urlfile']);
 	dol_delete_file($file);
 	$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
@@ -117,7 +117,7 @@ if ($id > 0 || ! empty($ref))
 {
 	llxHeader();
 
-	$upload_dir = $conf->fournisseur->dir_commande.'/'.sanitizeFileName($commande->ref);
+	$upload_dir = $conf->fournisseur->dir_commande.'/'.dol_sanitizeFileName($commande->ref);
 
 	$soc = new Societe($db);
 	$soc->fetch($commande->socid);
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index 2122872a3e9..8644471fc2b 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -995,7 +995,7 @@ if ($id > 0 || ! empty($ref))
 		/*
 		 * Documents	generes
 		 */
-		$comfournref = sanitizeFileName($commande->ref);
+		$comfournref = dol_sanitizeFileName($commande->ref);
 		$file =	$conf->fournisseur->dir_commande . '/' . $comfournref .	'/'	. $comfournref . '.pdf';
 		$relativepath =	$comfournref.'/'.$comfournref.'.pdf';
 		$filedir = $conf->fournisseur->dir_commande	. '/' .	$comfournref;
diff --git a/htdocs/html.formfile.class.php b/htdocs/html.formfile.class.php
index f8e443e7bed..05f10d3fdf1 100644
--- a/htdocs/html.formfile.class.php
+++ b/htdocs/html.formfile.class.php
@@ -157,7 +157,7 @@ class FormFile
 			$forcenomultilang=0;
 		}
 
-		$filename = sanitizeFileName($filename);
+		$filename = dol_sanitizeFileName($filename);
 		$headershown=0;
 		$i=0;
 
@@ -451,7 +451,7 @@ class FormFile
 				// Define relative path used to store the file
 				if (! $relativepath)
 				{
-					$relativepath=sanitizeFileName($object->ref).'/';
+					$relativepath=dol_sanitizeFileName($object->ref).'/';
 					if ($modulepart == 'facture_fournisseur')	$relativepath=get_exdir($object->id,2).$relativepath;
 				}
 
diff --git a/htdocs/includes/modules/commande/modules_commande.php b/htdocs/includes/modules/commande/modules_commande.php
index 1d43f9ca24e..c0f04b5860e 100644
--- a/htdocs/includes/modules/commande/modules_commande.php
+++ b/htdocs/includes/modules/commande/modules_commande.php
@@ -254,7 +254,7 @@ function commande_delete_preview($db, $commandeid, $commanderef='')
 
         if ($conf->commande->dir_output)
         {
-        	$comref = sanitizeFileName($commanderef);
+        	$comref = dol_sanitizeFileName($commanderef);
         	$dir = $conf->commande->dir_output . "/" . $comref ;
         	$file = $dir . "/" . $comref . ".pdf.png";
         	$multiple = $file . ".";
diff --git a/htdocs/includes/modules/commande/pdf_edison.modules.php b/htdocs/includes/modules/commande/pdf_edison.modules.php
index 711d333893e..c379896621a 100644
--- a/htdocs/includes/modules/commande/pdf_edison.modules.php
+++ b/htdocs/includes/modules/commande/pdf_edison.modules.php
@@ -134,7 +134,7 @@ class pdf_edison extends ModelePDFCommandes
 			}
 			else
 			{
-				$comref = sanitizeFileName($com->ref);
+				$comref = dol_sanitizeFileName($com->ref);
 				$dir = $conf->commande->dir_output . "/" . $comref;
 				$file = $dir . "/" . $comref . ".pdf";
 			}
diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php
index 38fd95335d3..2e52fac8757 100644
--- a/htdocs/includes/modules/commande/pdf_einstein.modules.php
+++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php
@@ -140,7 +140,7 @@ class pdf_einstein extends ModelePDFCommandes
 			}
 			else
 			{
-				$comref = sanitizeFileName($com->ref);
+				$comref = dol_sanitizeFileName($com->ref);
 				$dir = $conf->commande->dir_output . "/" . $comref;
 				$file = $dir . "/" . $comref . ".pdf";
 			}
diff --git a/htdocs/includes/modules/dons/html_cerfafr.modules.php b/htdocs/includes/modules/dons/html_cerfafr.modules.php
index 2169427b900..c7f88fffe14 100644
--- a/htdocs/includes/modules/dons/html_cerfafr.modules.php
+++ b/htdocs/includes/modules/dons/html_cerfafr.modules.php
@@ -88,7 +88,7 @@ class html_cerfafr extends ModeleDon
 		$outputlangs->load("companies");
 		$outputlangs->load("bills");
 		$outputlangs->load("products");
-		
+
         if ($conf->don->dir_output)
         {
 			// Definition de l'objet $don (pour compatibilite ascendante)
@@ -107,7 +107,7 @@ class html_cerfafr extends ModeleDon
 			}
 			else
 			{
-				$donref = sanitizeFileName($don->ref);
+				$donref = dol_sanitizeFileName($don->ref);
 				$dir = $conf->don->dir_output . "/" . get_exdir($donref,2);
 				$file = $dir . "/" . $donref . ".html";
 			}
diff --git a/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php b/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php
index 21162e2a63d..b8f2e661dd4 100644
--- a/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php
+++ b/htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php
@@ -126,7 +126,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
 			}
 			else
 			{
-				$expref = sanitizeFileName($this->expe->ref);
+				$expref = dol_sanitizeFileName($this->expe->ref);
 				$dir = $conf->expedition->dir_bon_expedition . "/" . $expref;
 				$file = $dir . "/" . $expref . ".pdf";
 			}
diff --git a/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php b/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php
index 8ab9288b8e0..c5199fc676a 100644
--- a/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php
+++ b/htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php
@@ -152,7 +152,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
 			}
 			else
 			{
-				$expref = sanitizeFileName($this->expe->ref);
+				$expref = dol_sanitizeFileName($this->expe->ref);
 				$dir = $conf->expedition->dir_bon_expedition . "/" . $expref;
 				$file = $dir . "/" . $expref . ".pdf";
 			}
diff --git a/htdocs/includes/modules/facture/modules_facture.php b/htdocs/includes/modules/facture/modules_facture.php
index 2b54a72d207..fae021c2007 100644
--- a/htdocs/includes/modules/facture/modules_facture.php
+++ b/htdocs/includes/modules/facture/modules_facture.php
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2007 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2009 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2004      Eric Seigne          <eric.seigne@ryxeo.com>
  * Copyright (C) 2005      Regis Houssin        <regis@dolibarr.fr>
  *
@@ -21,11 +21,11 @@
  */
 
 /**
- \file       htdocs/includes/modules/facture/modules_facture.php
- \ingroup    facture
- \brief      Fichier contenant la classe m�re de generation des factures en PDF
- et la classe m�re de num�rotation des factures
- \version    $Id$
+ *	\file       htdocs/includes/modules/facture/modules_facture.php
+ *	\ingroup    facture
+ *	\brief      Fichier contenant la classe mere de generation des factures en PDF
+ * 				et la classe mere de numerotation des factures
+ *	\version    $Id$
  */
 
 require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
@@ -241,7 +241,7 @@ function facture_meta_create($db, $facid, $message="")
 
 	if ($conf->facture->dir_output)
 	{
-		$facref = sanitizeFileName($fac->ref);
+		$facref = dol_sanitizeFileName($fac->ref);
 		$dir = $conf->facture->dir_output . "/" . $facref ;
 		$file = $dir . "/" . $facref . ".meta";
 
@@ -295,7 +295,7 @@ function facture_delete_preview($db, $facid)
 
 	if ($conf->facture->dir_output)
 	{
-		$facref = sanitizeFileName($fac->ref);
+		$facref = dol_sanitizeFileName($fac->ref);
 		$dir = $conf->facture->dir_output . "/" . $facref ;
 		$file = $dir . "/" . $facref . ".pdf.png";
 
diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php
index 53b529c1181..dd0b744c415 100644
--- a/htdocs/includes/modules/facture/pdf_crabe.modules.php
+++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php
@@ -145,7 +145,7 @@ class pdf_crabe extends ModelePDFFactures
 			}
 			else
 			{
-				$facref = sanitizeFileName($fac->ref);
+				$facref = dol_sanitizeFileName($fac->ref);
 				$dir = $conf->facture->dir_output . "/" . $facref;
 				$file = $dir . "/" . $facref . ".pdf";
 			}
diff --git a/htdocs/includes/modules/facture/pdf_oursin.modules.php b/htdocs/includes/modules/facture/pdf_oursin.modules.php
index 449d0f7e920..8cebf0cbfc6 100644
--- a/htdocs/includes/modules/facture/pdf_oursin.modules.php
+++ b/htdocs/includes/modules/facture/pdf_oursin.modules.php
@@ -145,7 +145,7 @@ class pdf_oursin extends ModelePDFFactures
 			}
 			else
 			{
-				$facref = sanitizeFileName($fac->ref);
+				$facref = dol_sanitizeFileName($fac->ref);
 				$dir = $conf->facture->dir_output . "/" . $facref;
 				$file = $dir . "/" . $facref . ".pdf";
 			}
diff --git a/htdocs/includes/modules/fichinter/modules_fichinter.php b/htdocs/includes/modules/fichinter/modules_fichinter.php
index 1cb6642c6cb..056dc548d8d 100644
--- a/htdocs/includes/modules/fichinter/modules_fichinter.php
+++ b/htdocs/includes/modules/fichinter/modules_fichinter.php
@@ -240,7 +240,7 @@ function fichinter_delete_preview($db, $fichinterid, $fichinterref='')
 
 	if ($conf->ficheinter->dir_output)
 	{
-		$fichinterref = sanitizeFileName($fichinterref);
+		$fichinterref = dol_sanitizeFileName($fichinterref);
 		$dir = $conf->ficheinter->dir_output . "/" . $fichinterref ;
 		$file = $dir . "/" . $fichinterref . ".pdf.png";
 		$multiple = $file . ".";
diff --git a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
index 26a1a31a46f..f68f0839bf5 100644
--- a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
+++ b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php
@@ -108,7 +108,7 @@ class pdf_soleil extends ModelePDFFicheinter
 				}
 			}
 
-			$fichref = sanitizeFileName($fichinter->ref);
+			$fichref = dol_sanitizeFileName($fichinter->ref);
 			$dir = $conf->ficheinter->dir_output;
 			if (! eregi('specimen',$fichref)) $dir.= "/" . $fichref;
 			$file = $dir . "/" . $fichref . ".pdf";
diff --git a/htdocs/includes/modules/livraison/modules_livraison.php b/htdocs/includes/modules/livraison/modules_livraison.php
index a1475acae12..4db4022f6bd 100644
--- a/htdocs/includes/modules/livraison/modules_livraison.php
+++ b/htdocs/includes/modules/livraison/modules_livraison.php
@@ -230,7 +230,7 @@ function delivery_order_delete_preview($db, $deliveryid)
 
 	if ($conf->livraison->dir_output)
 	{
-		$deliveryref = sanitizeFileName($delivery->ref);
+		$deliveryref = dol_sanitizeFileName($delivery->ref);
 		$dir = $conf->livraison->dir_output . "/" . $deliveryref ;
 		$file = $dir . "/" . $deliveryref . ".pdf.png";
 
diff --git a/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
index 4f40d1c7efd..7078cf89302 100644
--- a/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
+++ b/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php
@@ -123,7 +123,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
 
 			$nblignes = sizeof($delivery->lignes);
 
-			$deliveryref = sanitizeFileName($delivery->ref);
+			$deliveryref = dol_sanitizeFileName($delivery->ref);
 			$dir = $conf->expedition->dir_bon_livraison;
 			if (! eregi('specimen',$deliveryref)) $dir.= "/" . $deliveryref;
 			$file = $dir . "/" . $deliveryref . ".pdf";
diff --git a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
index 1cf3a4ca318..88b96701a95 100644
--- a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
+++ b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php
@@ -144,7 +144,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
 
 			$nblignes = sizeof($delivery->lignes);
 
-			$deliveryref = sanitizeFileName($delivery->ref);
+			$deliveryref = dol_sanitizeFileName($delivery->ref);
 			$dir = $conf->expedition->dir_bon_livraison;
 			if (! eregi('specimen',$deliveryref)) $dir.= "/" . $deliveryref;
 			$file = $dir . "/" . $deliveryref . ".pdf";
diff --git a/htdocs/includes/modules/propale/modules_propale.php b/htdocs/includes/modules/propale/modules_propale.php
index f252f7574e7..bf0f5b26dd7 100644
--- a/htdocs/includes/modules/propale/modules_propale.php
+++ b/htdocs/includes/modules/propale/modules_propale.php
@@ -256,7 +256,7 @@ function propale_delete_preview($db, $propalid, $propalref='')
 
         if ($conf->propale->dir_output)
         {
-        	$propalref = sanitizeFileName($propalref);
+        	$propalref = dol_sanitizeFileName($propalref);
         	$dir = $conf->propale->dir_output . "/" . $propalref ;
         	$file = $dir . "/" . $propalref . ".pdf.png";
         	$multiple = $file . ".";
diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
index d7521c35e06..20101226c31 100644
--- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
+++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
@@ -143,7 +143,7 @@ class pdf_propale_azur extends ModelePDFPropales
 			}
 			else
 			{
-				$propref = sanitizeFileName($propale->ref);
+				$propref = dol_sanitizeFileName($propale->ref);
 				$dir = $conf->propale->dir_output . "/" . $propref;
 				$file = $dir . "/" . $propref . ".pdf";
 			}
diff --git a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php
index a606c633038..8e3d292adba 100644
--- a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php
+++ b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php
@@ -127,7 +127,7 @@ class pdf_propale_jaune extends ModelePDFPropales
 			}
 			else
 			{
-				$propref = sanitizeFileName($propale->ref);
+				$propref = dol_sanitizeFileName($propale->ref);
 				$dir = $conf->propale->dir_output . "/" . $propref;
 				$file = $dir . "/" . $propref . ".pdf";
 			}
diff --git a/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php b/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php
index 1e22b757fb8..2ec705c7192 100644
--- a/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php
+++ b/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php
@@ -227,7 +227,7 @@ function supplier_order_delete_preview($db, $propalid)
 
 	if ($conf->fournisseur->dir_commande)
 	{
-		$comfournref = sanitizeFileName($comfourn->ref);
+		$comfournref = dol_sanitizeFileName($comfourn->ref);
 		$dir = $conf->commande->dir_output . "/" . $comfournref ;
 		$file = $dir . "/" . $comfournref . ".pdf.png";
 
diff --git a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
index e7942d4156b..3bf9dccbc1f 100644
--- a/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
+++ b/htdocs/includes/modules/supplier_order/pdf/pdf_muscadet.modules.php
@@ -143,7 +143,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
 			}
 			else
 			{
-				$comref = sanitizeFileName($com->ref);
+				$comref = dol_sanitizeFileName($com->ref);
 				$dir = $conf->fournisseur->dir_commande . "/" . $comref;
 				$file = $dir . "/" . $comref . ".pdf";
 			}
diff --git a/htdocs/includes/triggers/interface_modNotification_Notification.class.php b/htdocs/includes/triggers/interface_modNotification_Notification.class.php
index f160fa3f97e..551a2e9c400 100644
--- a/htdocs/includes/triggers/interface_modNotification_Notification.class.php
+++ b/htdocs/includes/triggers/interface_modNotification_Notification.class.php
@@ -32,7 +32,7 @@
 class InterfaceNotification
 {
     var $db;
-    
+
     /**
      *   \brief      Constructeur.
      *   \param      DB      Handler d'acc�s base
@@ -40,13 +40,13 @@ class InterfaceNotification
     function InterfaceNotification($DB)
     {
         $this->db = $DB ;
-    
+
         $this->name = eregi_replace('Interface','',get_class($this));
         $this->family = "notification";
         $this->description = "Triggers of this module send email notifications according to Notification module setup.";
         $this->version = 'dolibarr';                        // 'experimental' or 'dolibarr' or version
     }
-    
+
     /**
      *   \brief      Renvoi nom du lot de triggers
      *   \return     string      Nom du lot de triggers
@@ -55,7 +55,7 @@ class InterfaceNotification
     {
         return $this->name;
     }
-    
+
     /**
      *   \brief      Renvoi descriptif du lot de triggers
      *   \return     string      Descriptif du lot de triggers
@@ -79,7 +79,7 @@ class InterfaceNotification
         elseif ($this->version) return $this->version;
         else return $langs->trans("Unknown");
     }
-    
+
     /**
      *      \brief      Fonction appel�e lors du d�clenchement d'un �v�nement Dolibarr.
      *                  D'autres fonctions run_trigger peuvent etre pr�sentes dans includes/triggers
@@ -94,7 +94,7 @@ class InterfaceNotification
     {
         // Mettre ici le code � ex�cuter en r�action de l'action
         // Les donn�es de l'action sont stock�es dans $object
-    
+
 		// Si module notification non actif, on ne fait rien
 		if (! $conf->notification->enabled) return 0;
 
@@ -105,11 +105,11 @@ class InterfaceNotification
             dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
 
 			$action_notify = 2;
-            $ref = sanitizeFileName($object->ref);
+            $ref = dol_sanitizeFileName($object->ref);
             $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
             $mesg = 'La facture '.$object->ref." a �t� valid�e.\n";
 
-            $notify = new Notify($this->db); 
+            $notify = new Notify($this->db);
             $notify->send($action_notify, $object->socid, $mesg, 'facture', $object->id, $filepdf);
 		}
 
@@ -118,11 +118,11 @@ class InterfaceNotification
             dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
 
 			$action_notify = 1;
-            $ref = sanitizeFileName($object->ref);
+            $ref = dol_sanitizeFileName($object->ref);
             $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
             $mesg = 'La fiche intervention '.$object->ref." a �t� valid�e.\n";
 
-            $notify = new Notify($this->db); 
+            $notify = new Notify($this->db);
             $notify->send($action_notify, $object->socid, $mesg, 'ficheinter', $object->id, $filepdf);
 		}
 
@@ -131,11 +131,11 @@ class InterfaceNotification
             dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
 
 			$action_notify = 3;
-            $ref = sanitizeFileName($object->ref);
+            $ref = dol_sanitizeFileName($object->ref);
             $filepdf = $conf->fournisseur->dir_commande . '/' . $ref . '/' . $ref . '.pdf';
             $mesg = 'La commande fournisseur '.$object->ref." a �t� valid�e.\n";
 
-            $notify = new Notify($this->db); 
+            $notify = new Notify($this->db);
             $notify->send($action_notify, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf);
 		}
 
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 51291ad4eb6..b3a6ed08b4e 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2005      Marc Barilley / Ocebo <marc@ocebo.com>
- * Copyright (C) 2005-2008 Laurent Destailleur   <eldy@users.sourceforge.net>
+ * Copyright (C) 2005-2009 Laurent Destailleur   <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2008 Regis Houssin         <regis@dolibarr.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -19,10 +19,10 @@
  */
 
 /**
-	\file       htdocs/install/upgrade2.php
-	\brief      Effectue la migration de donnees diverses
-	\version    $Id$
-	*/
+ *	\file       htdocs/install/upgrade2.php
+ *	\brief      Effectue la migration de donnees diverses
+ *	\version    $Id$
+ */
 
 include_once('./inc.php');
 if (file_exists($conffile)) include_once($conffile);
@@ -44,7 +44,7 @@ $error = 0;
 // Ne fonctionne que si on est pas en safe_mode.
 $err=error_reporting();
 error_reporting(0);
-@set_time_limit(60);
+@set_time_limit(120);
 error_reporting($err);
 
 $setuplang=isset($_POST['selectlang'])?$_POST['selectlang']:(isset($_GET['selectlang'])?$_GET['selectlang']:'auto');
@@ -749,7 +749,7 @@ function migrate_contracts_date2($db,$langs,$conf)
 	$sql.= " WHERE c.rowid=cd.fk_contrat AND cd.date_ouverture IS NOT NULL";
 	$sql.= " GROUP BY c.rowid, c.date_contrat";
 	$resql = $db->query($sql);
-	
+
 	dolibarr_install_syslog("upgrade2::migrate_contracts_date2 sql=".$sql);
 	if ($resql)
 	{
@@ -891,8 +891,8 @@ function migrate_paiementfourn_facturefourn($db,$langs,$conf)
 	$select_sql  = 'SELECT rowid, fk_facture_fourn, amount ';
 	$select_sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn ';
 	$select_sql .= ' WHERE fk_facture_fourn IS NOT NULL';
-	
-	dolibarr_install_syslog("upgrade2::migrate_paiementfourn_facturefourn sql=".$sql);
+
+	dolibarr_install_syslog("upgrade2::migrate_paiementfourn_facturefourn sql=".$select_sql);
 	$select_resql = $db->query($select_sql);
 	if ($select_resql)
 	{
@@ -1517,7 +1517,7 @@ function migrate_modeles($db,$langs,$conf)
 	//print '<b>'.$langs->trans('UpdateModelsTable')."</b><br>\n";
 
 	dolibarr_install_syslog("upgrade2::migrate_modeles");
-	
+
 	if ($conf->facture->enabled)
 	{
 		include_once(DOL_DOCUMENT_ROOT.'/includes/modules/facture/modules_facture.php');
@@ -1571,7 +1571,7 @@ function migrate_delete_old_files($db,$langs,$conf)
 	$result=true;
 
 	dolibarr_install_syslog("upgrade2::migrate_delete_old_files");
-	
+
 	// List of files to delete
 	$filetodeletearray=array(
 	DOL_DOCUMENT_ROOT.'/includes/triggers/interface_demo.class.php',
@@ -1602,7 +1602,7 @@ function migrate_delete_old_files($db,$langs,$conf)
 function migrate_module_menus($db,$langs,$conf)
 {
 	dolibarr_install_syslog("upgrade2::migrate_module_menus");
-	
+
 	if (! empty($conf->global->MAIN_MODULE_AGENDA))
 	{
 		dolibarr_install_syslog("upgrade2::migrate_module_menus Reactivate module Agenda");
@@ -1648,7 +1648,7 @@ function migrate_module_menus($db,$langs,$conf)
 function migrate_commande_expedition($db,$langs,$conf)
 {
 	dolibarr_install_syslog("upgrade2::migrate_commande_expedition");
-	
+
 	print '<tr><td colspan="4">';
 
 	print '<br>';
@@ -1722,7 +1722,7 @@ function migrate_commande_expedition($db,$langs,$conf)
 function migrate_commande_livraison($db,$langs,$conf)
 {
 	dolibarr_install_syslog("upgrade2::migrate_commande_livraison");
-	
+
 	print '<tr><td colspan="4">';
 
 	print '<br>';
@@ -1810,7 +1810,7 @@ function migrate_commande_livraison($db,$langs,$conf)
 function migrate_detail_livraison($db,$langs,$conf)
 {
 	dolibarr_install_syslog("upgrade2::migrate_detail_livraison");
-	
+
 	print '<tr><td colspan="4">';
 
 	print '<br>';
@@ -1929,7 +1929,7 @@ function migrate_detail_livraison($db,$langs,$conf)
 function migrate_stocks($db,$langs,$conf)
 {
 	dolibarr_install_syslog("upgrade2::migrate_stocks");
-	
+
 	print '<tr><td colspan="4">';
 
 	print '<br>';
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index a44505251e7..ac596d15488 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -42,7 +42,7 @@ if (! defined('ADODB_DATE_VERSION')) include_once(DOL_DOCUMENT_ROOT."/includes/a
  * 	\param			newstr			String to replace bad chars by
  *	\return         string          String cleaned (a-zA-Z_)
  */
-function sanitizeFileName($str,$newstr='_')
+function dol_sanitizeFileName($str,$newstr='_')
 {
 	return dol_string_nospecial(dol_string_unaccent($str),$newstr);
 }
@@ -1343,7 +1343,7 @@ function info_admin($texte,$infoonimgalt=0)
 function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='',$feature2='',$dbt_socfield='fk_soc',$dbt_select='rowid')
 {
 	global $db, $conf;
-	
+
 	if ($dbt_select != 'rowid') $objectid = "'".$objectid."'";
 
 	//print "user_id=".$user->id.", feature=".$feature.", feature2=".$feature2.", object_id=".$objectid;
@@ -1441,7 +1441,7 @@ function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='',
 
 		// If dbtable not defined, we use same name for table than module name
 		if (!$dbtablename) $dbtablename = $feature;
-	
+
 		// Check permission for object with entity
 		if ($feature == 'user' || $feature == 'usergroup' || $feature == 'produit')
 		{
diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php
index f976e052868..a943cc60d34 100644
--- a/htdocs/livraison/fiche.php
+++ b/htdocs/livraison/fiche.php
@@ -581,7 +581,7 @@ else
 		 	 * Documents generated
 			 */
 
-			$livraisonref = sanitizeFileName($livraison->ref);
+			$livraisonref = dol_sanitizeFileName($livraison->ref);
 			$filedir = $conf->expedition->dir_bon_livraison . '/' . $livraisonref;
 			$urlsource = $_SERVER["PHP_SELF"]."?id=".$livraison->id;
 
diff --git a/htdocs/livraison/livraison.class.php b/htdocs/livraison/livraison.class.php
index 81ba2be0d95..ca12ee380a3 100644
--- a/htdocs/livraison/livraison.class.php
+++ b/htdocs/livraison/livraison.class.php
@@ -416,7 +416,7 @@ class Livraison extends CommonObject
 						}
 
 						// On efface le repertoire de pdf provisoire
-						$livraisonref = sanitizeFileName($this->ref);
+						$livraisonref = dol_sanitizeFileName($this->ref);
 						if ($conf->expedition->dir_output)
 						{
 							$dir = $conf->livraison->dir_output . "/" . $livraisonref ;
@@ -555,7 +555,7 @@ class Livraison extends CommonObject
 				$this->db->commit();
 
 				// On efface le repertoire de pdf provisoire
-				$livref = sanitizeFileName($this->ref);
+				$livref = dol_sanitizeFileName($this->ref);
 				if ($conf->livraison->dir_output)
 				{
 					$dir = $conf->livraison->dir_output . "/" . $livref ;
diff --git a/htdocs/product.class.php b/htdocs/product.class.php
index 16a3b8a7d43..91251457119 100644
--- a/htdocs/product.class.php
+++ b/htdocs/product.class.php
@@ -131,7 +131,7 @@ class Product extends CommonObject
 	 */
 	function check()
 	{
-		$this->ref = sanitizeFileName(stripslashes($this->ref));
+		$this->ref = dol_sanitizeFileName(stripslashes($this->ref));
 
 		$err = 0;
 		if (strlen(trim($this->ref)) == 0)
@@ -940,7 +940,7 @@ class Product extends CommonObject
 			$this->stock_in_propal    = 0;	// TODO
 
 			$this->next_prev_filter = 'entity = '.$conf->entity;
-			
+
 			$this->label_url = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$this->id.'">'.$this->libelle.'</a>';
 
 			$this->db->free();
@@ -1209,7 +1209,7 @@ class Product extends CommonObject
 		if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
 		//$sql.= " AND c.statut != 0";
 		if ($socid > 0)	$sql.= " AND c.fk_soc = ".$socid;
-		
+
 		$result = $this->db->query($sql) ;
 		if ( $result )
 		{
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index d43a22beb2b..f1d4f0bfcee 100755
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -62,7 +62,7 @@ if ($_GET['id'] || $_GET["ref"])
     if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
     if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
 
-    $upload_dir = $conf->produit->dir_output.'/'.sanitizeFileName($product->ref);
+    $upload_dir = $conf->produit->dir_output.'/'.dol_sanitizeFileName($product->ref);
 }
 $modulepart='produit';
 
diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php
index f263a8e30e4..05ec38e762b 100644
--- a/htdocs/propal.class.php
+++ b/htdocs/propal.class.php
@@ -721,7 +721,7 @@ class Propal extends CommonObject
 	function fetch($rowid,$ref='')
 	{
 		global $conf;
-		
+
 		$sql = "SELECT p.rowid,ref,remise,remise_percent,remise_absolue,fk_soc";
 		$sql.= ", total, tva, total_ht";
 		$sql.= ", datec";
@@ -1295,7 +1295,7 @@ class Propal extends CommonObject
 		{
 			if ($user) $sql.= " AND fk_user_author".$user;
 		}
-		
+
 		$sql.= " ORDER BY datep DESC";
 
 		$result=$this->db->query($sql);
@@ -1501,7 +1501,7 @@ class Propal extends CommonObject
 			if ( $this->db->query($sql) )
 			{
 				// We remove directory
-				$propalref = sanitizeFileName($this->ref);
+				$propalref = dol_sanitizeFileName($this->ref);
 				if ($conf->propale->dir_output)
 				{
 					$dir = $conf->propale->dir_output . "/" . $propalref ;
@@ -1897,7 +1897,7 @@ class Propal extends CommonObject
 			$clause = "AND";
 		}
 		$sql.= " ".$clause." p.entity = ".$conf->entity;
-		
+
 		$resql=$this->db->query($sql);
 		if ($resql)
 		{
diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php
index 05daeede7c7..fd97984359a 100644
--- a/htdocs/societe.class.php
+++ b/htdocs/societe.class.php
@@ -242,7 +242,7 @@ class Societe extends CommonObject
 			$this->errors[] = 'ErrorBadThirdPartyName';
 			$result = -2;
 		}
-		
+
 		if ($this->client && $this->codeclient_modifiable())
 		{
 			// On ne verifie le code client que si la societe est un client / prospect et que le code est modifiable
@@ -269,7 +269,7 @@ class Societe extends CommonObject
 				$result = -3;
 			}
 		}
-		
+
 		if ($this->fournisseur && $this->codefournisseur_modifiable())
 		{
 			// On ne verifie le code fournisseur que si la societe est un fournisseur et que le code est modifiable
@@ -296,7 +296,7 @@ class Societe extends CommonObject
 				$result = -3;
 			}
 		}
-		
+
 		return $result;
 	}
 
@@ -312,7 +312,7 @@ class Societe extends CommonObject
 	function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0)
 	{
 		require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
-		
+
 		global $langs,$conf;
 
 		dol_syslog("Societe::Update id=".$id." call_trigger=".$call_triger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur);
@@ -341,7 +341,7 @@ class Societe extends CommonObject
 		$this->prefix_comm=trim($this->prefix_comm);
 
 		$this->tva_assuj=trim($this->tva_assuj);
-		$this->tva_intra=sanitizeFileName($this->tva_intra,'');
+		$this->tva_intra=dol_sanitizeFileName($this->tva_intra,'');
 
 		$this->capital=trim($this->capital);
 		if (strlen($this->capital) == 0) $this->capital = 0;
@@ -875,7 +875,7 @@ class Societe extends CommonObject
 	function attribute_prefix()
 	{
 		global $conf;
-		
+
 		$sql = "SELECT nom FROM ".MAIN_DB_PREFIX."societe WHERE rowid = '".$this->id."'";
 		$resql=$this->db->query( $sql);
 		if ($resql)
@@ -891,7 +891,7 @@ class Societe extends CommonObject
 				$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."societe";
 				$sql.= " WHERE prefix_comm = '".$prefix."'";
 				$sql.= " AND entity = ".$conf->entity;
-				
+
 				$resql=$this->db->query($sql);
 				if ($resql)
 				{
@@ -938,12 +938,12 @@ class Societe extends CommonObject
 		if ($mot < count($tab))
 		{
 			$prefix = strtoupper(substr($tab[$mot],0,$taille));
-			
+
 			// On verifie que ce prefix n'a pas deja ete pris ...
 			$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."societe";
 			$sql.= " WHERE prefix_comm = '".$prefix."'";
 			$sql.= " AND entity = ".$conf->entity;
-			
+
 			$resql=$this->db->query( $sql);
 			if ($resql)
 			{
diff --git a/htdocs/telephonie/client/facture.php b/htdocs/telephonie/client/facture.php
index 296eca45f13..e81afc35b88 100644
--- a/htdocs/telephonie/client/facture.php
+++ b/htdocs/telephonie/client/facture.php
@@ -62,7 +62,7 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance')
     $fac = new Facture($db,"",$_POST["facid"]);
     if ( $fac->fetch($_POST["facid"]) )
     {
-      $facref = sanitizeFileName($fac->ref);
+      $facref = dol_sanitizeFileName($fac->ref);
       $file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
 
       if (is_readable($file))
@@ -169,41 +169,41 @@ $html = new Form($db);
 if ($_GET["facid"] > 0)
 {
   if ($msg) print "$msg<br>";
-  
+
   $fac = New Facture($db);
   if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0)
-    {      
+    {
       $soc = new Societe($db, $fac->socid);
       $soc->fetch($fac->socid, $user);
-            
+
       if (!$soc->perm_read)
 	{
 	  print "Lecture non authoris�e";
 	}
-      
+
       if ($soc->perm_read)
-	{      
+	{
 	  $author = new User($db);
 	  $author->id = $fac->user_author;
 	  $author->fetch();
-	  
+
 	  $h = 0;
-	  
+
 	  $head[$h][0] = DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$soc->id;
 	  $head[$h][1] = $langs->trans("Fiche client");
 	  $h++;
-	  
+
 	  $head[$h][0] = DOL_URL_ROOT.'/telephonie/client/factures.php?id='.$soc->id;
 	  $head[$h][1] = $langs->trans("Factures");
 	  $h++;
-	  
+
 	  $head[$h][0] = DOL_URL_ROOT.'/telephonie/client/facture.php?facid='.$fac->id;
 	  $head[$h][1] = $langs->trans("CardBill");
 	  $hselected = $h;
 	  $h++;
-	  
+
 	  dol_fiche_head($head, $hselected, $langs->trans("Bill")." : $fac->ref");
-	  
+
 	  /*
 	   *   Facture
 	   */
@@ -211,16 +211,16 @@ if ($_GET["facid"] > 0)
 	  print '<tr><td>'.$langs->trans("Company").'</td>';
 	  print '<td colspan="3">';
 	  print '<b><a href="fiche.php?id='.$soc->id.'">'.$soc->nom.'</a></b></td>';
-	  
+
 	  print "<td>Conditions de r�glement</td><td>" . $fac->cond_reglement ."</td></tr>";
-	  
+
 	  print '<tr><td>'.$langs->trans("Date").'</td>';
 	  print "<td colspan=\"3\">".dol_print_date($fac->date,"dayhourtext")."</td>\n";
 	  print '<td>'.$langs->trans("DateMaxPayment").'</td><td>' . dol_print_date($fac->date_lim_reglement,"dayhourtext");
 	  print "</td></tr>";
-	  
+
 	  print '<tr>';
-	  
+
       // Projet
       if ($conf->projet->enabled)
 	{
@@ -244,9 +244,9 @@ if ($_GET["facid"] > 0)
 	} else {
 	  print '<td height=\"10\">&nbsp;</td><td colspan="3">&nbsp;</td>';
 	}
-      
+
       print '<td rowspan="8" colspan="2" valign="top">';
-      
+
       /*
        * Paiements
        */
@@ -256,9 +256,9 @@ if ($_GET["facid"] > 0)
       $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf";
       $sql.= " WHERE pf.fk_facture = ".$fac->id." AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid";
       $sql.= " ORDER BY dp DESC";
-      
+
       $result = $db->query($sql);
-      
+
       if ($result)
 	{
 	  $num = $db->num_rows($result);
@@ -266,7 +266,7 @@ if ($_GET["facid"] > 0)
 	  print '<table class="noborder" width="100%">';
 	  print '<tr class="liste_titre"><td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Type").'</td>';
 	  print '<td align="right">'.$langs->trans("Amount").'</td><td>&nbsp;</td></tr>';
-	  
+
 	  $var=True;
 	  while ($i < $num)
 	    {
@@ -280,14 +280,14 @@ if ($_GET["facid"] > 0)
 	      $totalpaye += $objp->amount;
 	      $i++;
 	    }
-	  
+
 	  if ($fac->paye == 0)
 	    {
 	      print "<tr><td colspan=\"2\" align=\"right\">".$langs->trans("AlreadyPayed")." :</td><td align=\"right\"><b>".price($totalpaye)."</b></td><td>".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n";
 	      print "<tr><td colspan=\"2\" align=\"right\">Factur� :</td><td align=\"right\" style=\"border: 1px solid;\">".price($fac->total_ttc)."</td><td>".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n";
-		  
+
 	      $resteapayer = $fac->total_ttc - $totalpaye;
-		  
+
 	      print "<tr><td colspan=\"2\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
 	      print "<td align=\"right\" style=\"border: 1px solid;\" bgcolor=\"#f0f0f0\"><b>".price($resteapayer)."</b></td><td>".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n";
 	    }
@@ -298,9 +298,9 @@ if ($_GET["facid"] > 0)
 	}
 
       print "</td></tr>";
-      
+
       print "<tr><td height=\"10\">".$langs->trans("Author")."</td><td colspan=\"3\">$author->fullname</td></tr>";
-      
+
       print '<tr><td height=\"10\">'.$langs->trans("GlobalDiscount").'</td>';
       if ($fac->brouillon == 1 && $user->rights->facture->creer)
 	{
@@ -315,18 +315,18 @@ if ($_GET["facid"] > 0)
 	  print '<td colspan="3">'.$fac->remise_percent.'%</td>';
 	}
       print '</tr>';
-      
+
       print '<tr><td height=\"10\">'.$langs->trans("AmountHT").'</td>';
       print '<td align="right" colspan="2"><b>'.price($fac->total_ht).'</b></td>';
       print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
-      
+
       print '<tr><td height=\"10\">'.$langs->trans("VAT").'</td><td align="right" colspan="2">'.price($fac->total_tva).'</td>';
       print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
       print '<tr><td height=\"10\">'.$langs->trans("AmountTTC").'</td><td align="right" colspan="2">'.price($fac->total_ttc).'</td>';
       print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
-      
+
       print '<tr><td height=\"10\">'.$langs->trans("Status").'</td><td align="left" colspan="3">'.($fac->getLibStatut()).'</td></tr>';
-      
+
       if ($fac->note)
 	{
 	  print '<tr><td colspan="4">'.$langs->trans("Note").' : '.nl2br($fac->note)."</td></tr>";
@@ -334,9 +334,9 @@ if ($_GET["facid"] > 0)
       else {
 	print '<tr><td colspan="4">&nbsp;</td></tr>';
       }
-      
+
       print "</table><br>";
-      
+
       /*
        * Lignes de factures
        *
@@ -350,13 +350,13 @@ if ($_GET["facid"] > 0)
       $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON l.fk_product=p.rowid";
       $sql .= " WHERE l.fk_facture = ".$fac->id;
       $sql .= " ORDER BY l.rang ASC, l.rowid";
-      
+
       $resql = $db->query($sql);
       if ($resql)
 	{
 	  $num_lignes = $db->num_rows($resql);
 	  $i = 0; $total = 0;
-	  
+
 	  print '<table class="noborder" width="100%">';
 	  if ($num_lignes)
 	    {
@@ -375,11 +375,11 @@ if ($_GET["facid"] > 0)
 	    {
 	      $objp = $db->fetch_object($resql);
 	      $var=!$var;
-	      
+
 	      // Update ligne de facture
 	      if ($_GET["action"] != 'editline' || $_GET["rowid"] != $objp->rowid)
 		{
-		  
+
 		  print "<tr $bc[$var]>";
 		  if ($objp->fk_product > 0)
 		    {
@@ -400,7 +400,7 @@ if ($_GET["facid"] > 0)
 		      if (! $objp->date_start && $objp->date_end) { print " (Jusqu'au ".dol_print_date($objp->date_end).")"; }
 		      print "</td>\n";
 		    }
-		  
+
 		  print '<td align="right">'.$objp->tva_taux.'%</td>';
 		  print '<td align="right">'.price($objp->subprice)."</td>\n";
 		  print '<td align="right">'.$objp->qty.'</td>';
@@ -497,7 +497,7 @@ if ($_GET["facid"] > 0)
        * REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse
        */
 
-      $facref = sanitizeFileName($fac->ref);
+      $facref = dol_sanitizeFileName($fac->ref);
       $file = $conf->facture->dir_output . "/" . $facref . "/" . $facref . ".pdf";
       $relativepath = "${facref}/${facref}.pdf";
 
@@ -670,7 +670,7 @@ if ($_GET["facid"] > 0)
 		{
 			$formmail->clear_attached_files();
 		}
-				
+
 	  $formmail->show_form();
 
 	  print '<br>';
@@ -711,7 +711,7 @@ if ($_GET["facid"] > 0)
 		{
 			$formmail->clear_attached_files();
 		}
-	  
+
 		$formmail->show_form();
 
 	  print '<br>';
-- 
GitLab