';
diff --git a/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php b/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php
index 14f1f1347a7..eb14574658f 100644
--- a/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php
+++ b/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php
@@ -239,11 +239,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$curY = $nexY;
// Description de la ligne produit
- $libelleproduitservice=dol_htmlentities($com->lignes[$i]->libelle);
+ $libelleproduitservice=dol_htmlentitiesbr($com->lignes[$i]->libelle,1);
if ($com->lignes[$i]->desc&&$com->lignes[$i]->desc!=$com->lignes[$i]->libelle)
{
- if ($libelleproduitservice) $libelleproduitservice.="\n";
- $libelleproduitservice.=dol_htmlentities($com->lignes[$i]->desc);
+ if ($libelleproduitservice) $libelleproduitservice.=" ";
+ $libelleproduitservice.=dol_htmlentitiesbr($com->lignes[$i]->desc,1);
}
// Si ligne associée à un code produit
if ($com->lignes[$i]->fk_product)
@@ -253,7 +253,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if ($com->lignes[$i]->date_start && $com->lignes[$i]->date_end)
{
// Affichage durée si il y en a une
- $libelleproduitservice.=dol_htmlentities("\n(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($com->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($com->lignes[$i]->date_end).")");
+ $libelleproduitservice.=" ".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($com->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($com->lignes[$i]->date_end).")",1);
}
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index 294d6ad2506..1b6acd708ec 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -63,59 +63,60 @@ class Form
}
- /**
+ /**
\brief Affiche un texte+picto avec tooltip sur texte ou sur picto
\param text Texte à afficher
\param htmltext Contenu html du tooltip, codé en html
\param tooltipon 1=tooltip sur texte, 2=tooltip sur picto, 3=tooltip sur les 2, 4=tooltip sur les 2 et forcé en Ajax
\param direction -1=Le picto est avant, 0=pas de picto, 1=le picto est après
\param img Code img du picto
- \return string Code html du texte,picto
- */
- function textwithtooltip($text,$htmltext,$tooltipon=1,$direction=0,$img='',$i=1,$width='200',$shiftX='10')
- {
- global $conf;
+ \return string Code html du tooltip (texte+picto)
+ */
+ function textwithtooltip($text,$htmltext,$tooltipon=1,$direction=0,$img='',$i=1,$width='200',$shiftX='10')
+ {
+ global $conf;
if (! $htmltext) return $text;
$paramfortooltiptext ='';
- $paramfortooltippicto ='';
-
- // Sanitize tooltip
- $htmltext=ereg_replace("'","\'",$htmltext);
- $htmltext=ereg_replace("'","\'",$htmltext);
- $htmltext=ereg_replace("\r","",$htmltext);
- $htmltext=ereg_replace("\n"," ",$htmltext);
-
- if ($conf->use_javascript_ajax && $tooltipon == 4)
- {
- $s = '
';
diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php
index 8a870659f3b..aff85ce6c01 100644
--- a/htdocs/includes/modules/commande/pdf_einstein.modules.php
+++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php
@@ -231,19 +231,19 @@ class pdf_einstein extends ModelePDFCommandes
$curY = $nexY;
// Description de la ligne produit
- $libelleproduitservice=dol_htmlentities($com->lignes[$i]->libelle);
+ $libelleproduitservice=dol_htmlentitiesbr($com->lignes[$i]->libelle,1);
if ($com->lignes[$i]->desc && $com->lignes[$i]->desc!=$com->lignes[$i]->libelle)
{
- if ($libelleproduitservice) $libelleproduitservice.="\n";
+ if ($libelleproduitservice) $libelleproduitservice.=" ";
if ($com->lignes[$i]->desc == '(CREDIT_NOTE)' && $com->lignes[$i]->fk_remise_except)
{
$discount=new DiscountAbsolute($this->db);
$discount->fetch($com->lignes[$i]->fk_remise_except);
- $libelleproduitservice=$langs->trans("DiscountFromCreditNote",$discount->ref_facture_source);
+ $libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1);
}
else
{
- $libelleproduitservice.=dol_htmlentities($com->lignes[$i]->desc);
+ $libelleproduitservice.=dol_htmlentitiesbr($com->lignes[$i]->desc,1);
}
}
// Si ligne associée à un code produit
@@ -269,7 +269,7 @@ class pdf_einstein extends ModelePDFCommandes
if ($com->lignes[$i]->date_start && $com->lignes[$i]->date_end)
{
// Affichage durée si il y en a une
- $libelleproduitservice.=dol_htmlentities("\n(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($com->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($com->lignes[$i]->date_end).")");
+ $libelleproduitservice.=" ".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($com->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($com->lignes[$i]->date_end).")",1);
}
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php
index b7ef49f4734..f67dd88b0cd 100644
--- a/htdocs/includes/modules/facture/pdf_crabe.modules.php
+++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2004-2008 Laurent Destailleur
* Copyright (C) 2005-2007 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -16,8 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/
- *
- * $Id$
*/
/**
@@ -25,7 +23,7 @@
\ingroup facture
\brief Fichier de la classe permettant de g�n�rer les factures au mod�le Crabe
\author Laurent Destailleur
- \version $Revision$
+ \version $Id$
*/
require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php");
@@ -206,7 +204,7 @@ class pdf_crabe extends ModelePDFFactures
{
$tab_top = 88;
- $pdf->SetFont('Arial','', 9); // Dans boucle pour g�rer multi-page
+ $pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
$pdf->SetXY ($this->posxdesc-1, $tab_top);
$pdf->MultiCell(190, 3, $fac->note_public, 0, 'J');
$nexY = $pdf->GetY();
@@ -234,31 +232,32 @@ class pdf_crabe extends ModelePDFFactures
$curY = $nexY;
// Description de la ligne produit
- $libelleproduitservice=dol_htmlentities($fac->lignes[$i]->libelle);
+ $libelleproduitservice=dol_htmlentitiesbr($fac->lignes[$i]->libelle,1);
if ($fac->lignes[$i]->desc&&$fac->lignes[$i]->desc!=$fac->lignes[$i]->libelle)
{
- if ($libelleproduitservice) $libelleproduitservice.="\n";
+ if ($libelleproduitservice) $libelleproduitservice.=" ";
if ($fac->lignes[$i]->desc == '(CREDIT_NOTE)' && $fac->lignes[$i]->fk_remise_except)
{
$discount=new DiscountAbsolute($this->db);
$discount->fetch($fac->lignes[$i]->fk_remise_except);
- $libelleproduitservice=$langs->trans("DiscountFromCreditNote",$discount->ref_facture_source);
+ $libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1);
}
else
- {
- if ($fac->lignes[$i]->produit_id)
+ {
+ if ($fac->lignes[$i]->produit_id)
{
- $libelleproduitservice.=dol_htmlentities($fac->lignes[$i]->desc);
+ $libelleproduitservice.=dol_htmlentitiesbr($fac->lignes[$i]->desc,1);
}
else
{
- // On v�rifie si les lignes personnalis�es sont format�es avec fckeditor
- $libelleproduitservice.=dol_htmlentities($fac->lignes[$i]->desc);
+ // On verifie si les lignes personnalisees sont formatees avec fckeditor
+ $libelleproduitservice.=dol_htmlentitiesbr($fac->lignes[$i]->desc,1);
}
}
}
- // Si ligne associ�e � un code produit
+
+ // Si ligne associee a un code produit
if ($fac->lignes[$i]->produit_id)
{
$prodser = new Product($this->db);
@@ -284,8 +283,9 @@ class pdf_crabe extends ModelePDFFactures
if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end)
{
// Affichage duree si il y en a une
- $libelleproduitservice.=dol_htmlentities("\n(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end).")");
+ $libelleproduitservice.=" ".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end).")",1);
}
+ //if ($i==0) { print $libelleproduitservice; exit; }
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
index 1cced0b71b7..b5b59015da5 100644
--- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
+++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
@@ -233,20 +233,20 @@ class pdf_propale_azur extends ModelePDFPropales
$curY = $nexY;
// Description de la ligne produit
- $libelleproduitservice=dol_htmlentities($propale->lignes[$i]->libelle);
+ $libelleproduitservice=dol_htmlentitiesbr($propale->lignes[$i]->libelle,1);
if ($propale->lignes[$i]->desc && $propale->lignes[$i]->desc!=$propale->lignes[$i]->libelle)
{
- if ($libelleproduitservice) $libelleproduitservice.="\n";
+ if ($libelleproduitservice) $libelleproduitservice.=" ";
if ($propale->lignes[$i]->desc == '(CREDIT_NOTE)' && $propale->lignes[$i]->fk_remise_except)
{
$discount=new DiscountAbsolute($this->db);
$discount->fetch($propale->lignes[$i]->fk_remise_except);
- $libelleproduitservice=$langs->trans("DiscountFromCreditNote",$discount->ref_facture_source);
+ $libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1);
}
else
{
- $libelleproduitservice.=dol_htmlentities($propale->lignes[$i]->desc);
+ $libelleproduitservice.=dol_htmlentitiesbr($propale->lignes[$i]->desc,1);
}
}
// Si ligne associée à un code produit
@@ -271,7 +271,7 @@ class pdf_propale_azur extends ModelePDFPropales
if ($propale->lignes[$i]->date_start && $propale->lignes[$i]->date_end)
{
// Affichage durée si il y en a une
- $libelleproduitservice.=dol_htmlentities("\n(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($propale->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($propale->lignes[$i]->date_end).")");
+ $libelleproduitservice.=" ".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($propale->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($propale->lignes[$i]->date_end).")",1);
}
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
diff --git a/htdocs/lib/doleditor.class.php b/htdocs/lib/doleditor.class.php
index 4bbf1a2daa6..b4eefcda2b9 100644
--- a/htdocs/lib/doleditor.class.php
+++ b/htdocs/lib/doleditor.class.php
@@ -56,7 +56,7 @@ class DolEditor
require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php");
- $content=dol_htmlentities($content); // If content is not HTML, we convert to HTML.
+ $content=dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML.
$this->editor = new FCKeditor($htmlname);
$this->editor->BasePath = DOL_URL_ROOT.'/includes/fckeditor/' ;
diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php
index 1e505b8eb15..df5e43cce59 100644
--- a/htdocs/lib/functions.inc.php
+++ b/htdocs/lib/functions.inc.php
@@ -1555,8 +1555,9 @@ function print_liste_field_titre($name, $file, $field, $begin="", $options="", $
// If this is a sort field
if ($field)
{
- print " ";
- if (! $sortorder)
+ //print " ";
+ print '';
+ if (! $sortorder)
{
print ''.img_down("A-Z",0).'';
print ''.img_up("Z-A",0).'';
@@ -2534,24 +2535,51 @@ function hexbin($hexa){
return $bin;
}
-/*
-* \brief Cette fonction est appelée pour coder ou non une chaine en html.
-* \param stringtoencode String to encode
-* \param htmlinfo 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
-* \remarks Selon qu'on compte l'afficher dans le PDF avec:
-* writeHTMLCell -> a besoin d'etre encodé en HTML
-* MultiCell -> ne doit pas etre encodé en HTML
+/**
+* \brief Replace CRLF in string with a HTML BR tag.
+* \param string2encode String to encode
+* \param nl2brmode 0=Adding br before \n, 1=Replacing \n by br
+* \return string String encoded
*/
-function dol_htmlentities($stringtoencode,$htmlinfo=-1)
+function dol_nl2br($stringtoencode,$nl2brmode=0)
{
- if ($htmlinfo == 1) return $stringtoencode;
- if ($htmlinfo == 0) return nl2br(htmlentities($stringtoencode));
- if ($htmlinfo == -1)
+ if (! $nl2brmode) return nl2br($stringtoencode);
+ else
{
- if (dol_textishtml($stringtoencode)) return $stringtoencode;
- else return nl2br(htmlentities($stringtoencode));
+ $ret=ereg_replace("\r","",$stringtoencode);
+ $ret=ereg_replace("\n"," ",$ret);
+ return $ret;
}
- return $stringtoencode;
+}
+
+/**
+* \brief This function is called to encode a string into a HTML string
+* \param stringtoencode String to encode
+* \param nl2brmode 0=Adding br before \n, 1=Replacing \n by br
+* \remarks For PDF usage, you can show text by 2 ways:
+* - writeHTMLCell -> param must be encoded into HTML.
+* - MultiCell -> param must not be encoded into HTML.
+* Because writeHTMLCell convert also \n into , if function
+* is used to build PDF, nl2br must be 1.
+*/
+function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0)
+{
+ if (dol_textishtml($stringtoencode)) return $stringtoencode;
+ else return dol_nl2br(htmlentities($stringtoencode),$nl2brmode);
+}
+
+/*
+* \brief This function is called to decode a HTML string
+* \param stringtodecode String to decode
+*/
+function dol_htmlentitiesbr_decode($stringtodecode)
+{
+ $ret=html_entity_decode($stringtodecode);
+ $ret=eregi_replace("\r\n".' '," ",$ret);
+ $ret=eregi_replace(' '."\r\n","\r\n",$ret);
+ $ret=eregi_replace(' '."\n","\n",$ret);
+ $ret=eregi_replace(' ',"\n",$ret);
+ return $ret;
}
/**
diff --git a/htdocs/livraison/mods/pdf/pdf_typhon.modules.php b/htdocs/livraison/mods/pdf/pdf_typhon.modules.php
index 0fee25d56e9..76a1f47d72b 100644
--- a/htdocs/livraison/mods/pdf/pdf_typhon.modules.php
+++ b/htdocs/livraison/mods/pdf/pdf_typhon.modules.php
@@ -197,11 +197,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$curY = $nexY;
// Description de la ligne produit
- $libelleproduitservice=dol_htmlentities($delivery->lignes[$i]->label);
- if ($delivery->lignes[$i]->description&&$delivery->lignes[$i]->description!=$delivery->lignes[$i]->label)
+ $libelleproduitservice=dol_htmlentitiesbr($delivery->lignes[$i]->label,1);
+ if ($delivery->lignes[$i]->description && $delivery->lignes[$i]->description!=$delivery->lignes[$i]->label)
{
- if ($libelleproduitservice) $libelleproduitservice.="\n";
- $libelleproduitservice.=dol_htmlentities($delivery->lignes[$i]->description);
+ if ($libelleproduitservice) $libelleproduitservice.=" ";
+ $libelleproduitservice.=dol_htmlentitiesbr($delivery->lignes[$i]->description,1);
}
// Si ligne associée à un code produit
if ($delivery->lignes[$i]->fk_product)
@@ -226,7 +226,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if ($delivery->lignes[$i]->date_start && $delivery->lignes[$i]->date_end)
{
// Affichage durée si il y en a une
- $libelleproduitservice.="\n(".$langs->transnoentities("From")." ".dolibarr_print_date($delivery->lignes[$i]->date_start)." ".$langs->transnoentities("to")." ".dolibarr_print_date($delivery->lignes[$i]->date_end).")";
+ $libelleproduitservice.=" ".dol_htmlentitiesbr("(".$langs->transnoentities("From")." ".dolibarr_print_date($delivery->lignes[$i]->date_start)." ".$langs->transnoentities("to")." ".dolibarr_print_date($delivery->lignes[$i]->date_end).")",1);
}
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php
index e76da39f4f9..020d9e2cf89 100644
--- a/htdocs/product/fiche.php
+++ b/htdocs/product/fiche.php
@@ -983,7 +983,7 @@ if ($_GET["id"] || $_GET["ref"])
else
{
print '";
}
print "