Fix: Les modeles n'affiche plus les donnes de diffrentes manieres selon que le module fckeditor est actif ou non.

This commit is contained in:
Laurent Destailleur 2007-11-12 23:25:44 +00:00
parent 938b179ae2
commit efafaace28
6 changed files with 61 additions and 89 deletions

View File

@ -215,11 +215,11 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
}
// Description de la ligne produit
$libelleproduitservice=_dol_htmlentities($this->expe->lignes[$i]->description,0);
$libelleproduitservice=dol_htmlentities($this->expe->lignes[$i]->description);
if ($this->expe->lignes[$i]->description&&$this->expe->lignes[$i]->description!=$com->lignes[$i]->libelle)
{
if ($libelleproduitservice) $libelleproduitservice.="\n";
$libelleproduitservice.=_dol_htmlentities($this->expe->lignes[$i]->description,$conf->global->FCKEDITOR_ENABLE_DETAILS);
$libelleproduitservice.=dol_htmlentities($this->expe->lignes[$i]->description);
}
// Si ligne associée à un code produit
if ($this->expe->lignes[$i]->fk_product)
@ -243,17 +243,8 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
if ($conf->fckeditor->enabled)
{
$pdf->writeHTMLCell(150, 3, $this->posxdesc, $curY, $libelleproduitservice, 0, 1);
// $pdf->SetXY ($this->posxdesc, $curY);
// $pdf->MultiCell(150, 3, "zzzz g dg fdgdfgfgfgfdg dfg dfgdfgfdggggggggggggggggggg f g fd g fdgfdgggggggggggggggggggggggggggg fg df g ff hf hz", 0, 'J');
}
else
{
$pdf->SetXY ($this->posxdesc, $curY);
$pdf->MultiCell(150, 3, $libelleproduitservice, 0, 'J');
}
$pdf->writeHTMLCell(150, 3, $this->posxdesc, $curY, $libelleproduitservice, 0, 1);
$pdf->SetXY (160, $curY);
$pdf->MultiCell(30, 3, $this->expe->lignes[$i]->qty_commande);

View File

@ -232,7 +232,7 @@ class pdf_einstein extends ModelePDFCommandes
$curY = $nexY;
// Description de la ligne produit
$libelleproduitservice=_dol_htmlentities($com->lignes[$i]->libelle,0);
$libelleproduitservice=dol_htmlentities($com->lignes[$i]->libelle);
if ($com->lignes[$i]->desc&&$com->lignes[$i]->desc!=$com->lignes[$i]->libelle)
{
if ($libelleproduitservice) $libelleproduitservice.="\n";
@ -244,7 +244,7 @@ class pdf_einstein extends ModelePDFCommandes
}
else
{
$libelleproduitservice.=_dol_htmlentities($com->lignes[$i]->desc,$conf->global->FCKEDITOR_ENABLE_DETAILS);
$libelleproduitservice.=dol_htmlentities($com->lignes[$i]->desc);
}
}
// Si ligne associée à un code produit
@ -265,34 +265,17 @@ class pdf_einstein extends ModelePDFCommandes
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
}
// Ajoute description du produit
if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC)
{
if ($com->lignes[$i]->product_desc&&$com->lignes[$i]->product_desc!=$com->lignes[$i]->libelle&&$com->lignes[$i]->product_desc!=$com->lignes[$i]->desc)
{
if ($libelleproduitservice) $libelleproduitservice.="\n";
$libelleproduitservice.=$com->lignes[$i]->product_desc;
}
}
}
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).")",0);
$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).")");
}
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
{
$pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
}
else
{
$pdf->SetXY ($this->posxdesc-1, $curY);
$pdf->MultiCell(108, 4, dol_entity_decode($libelleproduitservice), 0, 'J');
}
$pdf->writeHTMLCell(112, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
$pdf->SetFont('Arial','', 9); // On repositionne la police par défaut

View File

@ -230,7 +230,7 @@ class pdf_crabe extends ModelePDFFactures
$curY = $nexY;
// Description de la ligne produit
$libelleproduitservice=_dol_htmlentities($fac->lignes[$i]->libelle,0);
$libelleproduitservice=dol_htmlentities($fac->lignes[$i]->libelle);
if ($fac->lignes[$i]->desc&&$fac->lignes[$i]->desc!=$fac->lignes[$i]->libelle)
{
if ($libelleproduitservice) $libelleproduitservice.="\n";
@ -245,12 +245,12 @@ class pdf_crabe extends ModelePDFFactures
{
if ($fac->lignes[$i]->produit_id)
{
$libelleproduitservice.=_dol_htmlentities($fac->lignes[$i]->desc,$conf->global->FCKEDITOR_ENABLE_DETAILS);
$libelleproduitservice.=dol_htmlentities($fac->lignes[$i]->desc);
}
else
{
// On vérifie si les lignes personnalisées sont formatées avec fckeditor
$libelleproduitservice.=_dol_htmlentities($fac->lignes[$i]->desc,$conf->global->FCKEDITOR_ENABLE_DETAILS_PERSO);
$libelleproduitservice.=dol_htmlentities($fac->lignes[$i]->desc);
}
}
}
@ -275,34 +275,17 @@ class pdf_crabe extends ModelePDFFactures
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
}
// Ajoute description du produit
if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC)
{
if ($fac->lignes[$i]->product_desc&&$fac->lignes[$i]->product_desc!=$fac->lignes[$i]->libelle&&$fac->lignes[$i]->product_desc!=$fac->lignes[$i]->desc)
{
if ($libelleproduitservice) $libelleproduitservice.="\n";
$libelleproduitservice.=$fac->lignes[$i]->product_desc;
}
}
}
if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end)
{
// Affichage durée 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).")",0);
$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).")");
}
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
{
$pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
}
else
{
$pdf->SetXY ($this->posxdesc-1, $curY);
$pdf->MultiCell(108, 4, dol_entity_decode($libelleproduitservice), 0, 'J');
}
$pdf->writeHTMLCell(112, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
$pdf->SetFont('Arial','', 9); // On repositionne la police par défaut
$nexY = $pdf->GetY();

View File

@ -229,7 +229,7 @@ class pdf_propale_azur extends ModelePDFPropales
$curY = $nexY;
// Description de la ligne produit
$libelleproduitservice=_dol_htmlentities($propale->lignes[$i]->libelle,0);
$libelleproduitservice=dol_htmlentities($propale->lignes[$i]->libelle);
if ($propale->lignes[$i]->desc && $propale->lignes[$i]->desc!=$propale->lignes[$i]->libelle)
{
if ($libelleproduitservice) $libelleproduitservice.="\n";
@ -242,7 +242,7 @@ class pdf_propale_azur extends ModelePDFPropales
}
else
{
$libelleproduitservice.=_dol_htmlentities($propale->lignes[$i]->desc,$conf->global->FCKEDITOR_ENABLE_DETAILS);
$libelleproduitservice.=dol_htmlentities($propale->lignes[$i]->desc);
}
}
// Si ligne associée à un code produit
@ -263,33 +263,16 @@ class pdf_propale_azur extends ModelePDFPropales
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
}
// Ajoute description complète du produit
if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC)
{
if ($propale->lignes[$i]->product_desc && $propale->lignes[$i]->product_desc!=$propale->lignes[$i]->libelle && $propale->lignes[$i]->product_desc!=$propale->lignes[$i]->desc)
{
if ($libelleproduitservice) $libelleproduitservice.="\n";
$libelleproduitservice.=$propale->lignes[$i]->product_desc;
}
}
}
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).")",0);
$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).")");
}
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
{
$pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
}
else
{
$pdf->SetXY ($this->posxdesc-1, $curY);
$pdf->MultiCell(108, 4, dol_entity_decode($libelleproduitservice), 0, 'J');
}
$pdf->writeHTMLCell(112, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
$pdf->SetFont('Arial','', 9); // On repositionne la police par défaut
$nexY = $pdf->GetY();

View File

@ -102,9 +102,7 @@ class CMailFile
if ($msgishtml == 2)
{
$this->msgishtml = 0;
if (eregi('<html',$msg)) $this->msgishtml = 1;
elseif (eregi('<body',$msg)) $this->msgishtml = 1;
elseif (eregi('<br',$msg)) $this->msgishtml = 1;
if (dol_textishtml($msg,1)) $this->msgishtml = 1;
}
else
{

View File

@ -2820,16 +2820,23 @@ function hexbin($hexa){
return $bin;
}
// Cette fonction est appelée pour coder ou non une chaine en html
// 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
function _dol_htmlentities($stringtoencode,$isstringalreadyhtml)
/*
* \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
*/
function dol_htmlentities($stringtoencode,$htmlinfo=-1)
{
global $conf;
if ($isstringalreadyhtml) return $stringtoencode;
if ($conf->fckeditor->enabled) return htmlentities($stringtoencode);
if ($htmlinfo == 1) return $stringtoencode;
if ($htmlinfo == 0) return htmlentities($stringtoencode);
if ($htmlinfo == -1)
{
if (dol_textishtml($stringtoencode)) return $stringtoencode;
else return htmlentities($stringtoencode);
}
return $stringtoencode;
}
@ -3188,6 +3195,33 @@ function dol_microtime_float()
return ((float)$usec + (float)$sec);
}
/*
* \brief Return if a text is a html content
* \param msg Content to check
* \param option 0=Full detection, 1=Fast check
* \return boolean true/false
*/
function dol_textishtml($msg,$option=0)
{
if ($option == 1)
{
if (eregi('<html',$msg)) return true;
elseif (eregi('<body',$msg)) return true;
elseif (eregi('<br',$msg)) return true;
return false;
}
else
{
if (eregi('<html',$msg)) return true;
elseif (eregi('<body',$msg)) return true;
elseif (eregi('<br',$msg)) return true;
elseif (eregi('<table',$msg)) return true;
elseif (eregi('<font',$msg)) return true;
elseif (eregi('<strong',$msg)) return true;
elseif (eregi('<img',$msg)) return true;
return false;
}
}
/*
* \brief Effectue les substitutions des mots clés par les données en fonction du tableau