Fix: Detection auto des champs text/html.
Fix: Dans les PDF, il ne faut pas faire le nl2br standard de PHP lors de la conversion text en HTML car ce dernier ne remplace pas le \n mais ajoute le br hors le writeHTMLCell transforme aussi les \n en br.
This commit is contained in:
parent
75e490845b
commit
af274668a3
@ -162,7 +162,7 @@ class Adherent extends CommonObject
|
||||
$infos.= $langs->trans("Birthday").": $this->naiss\n";
|
||||
$infos.= $langs->trans("Photo").": $this->photo\n";
|
||||
$infos.= $langs->trans("Public").": ".yn($this->public)."\n";
|
||||
if ($msgishtml) $infos = dol_htmlentities($infos);
|
||||
if ($msgishtml) $infos = dol_htmlentitiesbr($infos);
|
||||
|
||||
// Substitutions
|
||||
$patterns = array (
|
||||
|
||||
@ -118,7 +118,7 @@ if ($id)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="note" cols="80" rows="10">'.$adh->note.'</textarea>';
|
||||
print '<textarea name="note" cols="80" rows="10">'.dol_htmlentitiesbr_decode($adh->note).'</textarea>';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -224,7 +224,7 @@ if ($_GET["action"] == 'create')
|
||||
else
|
||||
{
|
||||
print '<textarea class="flat" name="mail_valid" rows="15" cols="90">';
|
||||
print $adht->mail_valid;
|
||||
print dol_htmlentitiesbr_decode($adht->mail_valid);
|
||||
print '</textarea>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
@ -361,7 +361,7 @@ if ($rowid > 0)
|
||||
else
|
||||
{
|
||||
print '<textarea class="flat" name="mail_valid" rows="15" cols="90">';
|
||||
print $adht->mail_valid;
|
||||
print dol_htmlentitiesbr_decode($adht->mail_valid);
|
||||
print '</textarea>';
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
@ -208,7 +208,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="main_motd" cols="90" rows="'.ROWS_5.'">'.$conf->global->MAIN_MOTD.'</textarea>';
|
||||
print '<textarea name="main_motd" cols="90" rows="'.ROWS_5.'">'.dol_htmlentitiesbr_decode($conf->global->MAIN_MOTD).'</textarea>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@ -225,7 +225,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="main_home" cols="90" rows="'.ROWS_5.'">'.$conf->global->MAIN_HOME.'</textarea>';
|
||||
print '<textarea name="main_home" cols="90" rows="'.ROWS_5.'">'.dol_htmlentitiesbr_decode($conf->global->MAIN_HOME).'</textarea>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -126,7 +126,7 @@ if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
||||
else
|
||||
{
|
||||
print '<textarea name="description" rows="'.ROWS_6.'" cols="50">';
|
||||
print $categorie->description;
|
||||
print dol_htmlentitiesbr_decode($categorie->description);
|
||||
print '</textarea>';
|
||||
}
|
||||
|
||||
|
||||
@ -180,7 +180,7 @@ if ($user->rights->categorie->creer)
|
||||
else
|
||||
{
|
||||
print '<textarea name="description" rows="'.ROWS_6.'" cols="50">';
|
||||
print $categorie->description;
|
||||
print dol_htmlentitiesbr_decode($categorie->description);
|
||||
print '</textarea>';
|
||||
}
|
||||
|
||||
|
||||
@ -711,7 +711,7 @@ if ($_GET["id"])
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="note" cols="90" rows="'.ROWS_8.'">'.$act->note.'</textarea>';
|
||||
print '<textarea name="note" cols="90" rows="'.ROWS_8.'">'.dol_htmlentitiesbr_decode($act->note).'</textarea>';
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
@ -794,7 +794,7 @@ if ($_GET["id"])
|
||||
|
||||
// Note
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">';
|
||||
print dol_htmlentities($act->note);
|
||||
print dol_htmlentitiesbr($act->note);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -260,7 +260,7 @@ if ($resql)
|
||||
print $actionstatic->getNomUrl(1,4);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left" nowrap="nowrap">';
|
||||
print '<td align="center" nowrap="nowrap">';
|
||||
print dolibarr_print_date($obj->dp,"day");
|
||||
$late=0;
|
||||
if ($obj->percent == 0 && $obj->dp && date("U",$obj->dp) < time()) $late=1;
|
||||
@ -270,13 +270,13 @@ if ($resql)
|
||||
if ($late) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left" nowrap="nowrap">';
|
||||
print '<td align="center" nowrap="nowrap">';
|
||||
print dolibarr_print_date($obj->da2,"day");
|
||||
print '</td>';
|
||||
|
||||
// Titre
|
||||
print '<td>';
|
||||
print dolibarr_trunc($obj->label,12);
|
||||
print dolibarr_trunc($obj->label,10);
|
||||
print '</td>';
|
||||
|
||||
// Société
|
||||
@ -284,7 +284,7 @@ if ($resql)
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->client=$obj->client;
|
||||
$societestatic->nom=$obj->societe;
|
||||
print $societestatic->getNomUrl(1,'',8);
|
||||
print $societestatic->getNomUrl(1,'',6);
|
||||
print '</td>';
|
||||
|
||||
// Contact
|
||||
@ -294,7 +294,7 @@ if ($resql)
|
||||
$contactstatic->name=$obj->name;
|
||||
$contactstatic->firstname=$obj->firstname;
|
||||
$contactstatic->id=$obj->fk_contact;
|
||||
print $contactstatic->getNomUrl(1,'',8);
|
||||
print $contactstatic->getNomUrl(1,'',6);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -661,7 +661,7 @@ else
|
||||
else
|
||||
{
|
||||
print '<textarea class="flat" name="body" cols="70" rows="20">';
|
||||
print $mil->body.'</textarea>';
|
||||
print dol_htmlentitiesbr_decode($mil->body).'</textarea>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -1133,12 +1133,12 @@ if ($_GET['propalid'] > 0)
|
||||
else $text.= img_object($langs->trans('ShowProduct'),'product');
|
||||
$text.= ' '.$objp->ref.'</a>';
|
||||
$text.= ' - '.$objp->product;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':$objp->description);
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description));
|
||||
print $html->textwithtooltip($text,$description,3,'','',$i);
|
||||
print_date_range($objp->date_start,$objp->date_end);
|
||||
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
||||
{
|
||||
print ($objp->description && $objp->description!=$objp->product)?'<br>'.stripslashes(nl2br($objp->description)):'';
|
||||
print ($objp->description && $objp->description!=$objp->product)?'<br>'.dol_htmlentitiesbr($objp->description):'';
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
@ -1353,7 +1353,7 @@ if ($_GET['propalid'] > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="desc" cols="70" class="flat" rows="'.ROWS_2.'">'.$objp->description.'</textarea>';
|
||||
print '<textarea name="desc" cols="70" class="flat" rows="'.ROWS_2.'">'.dol_htmlentitiesbr_decode($objp->description).'</textarea>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -1364,13 +1364,13 @@ else
|
||||
else $text.= img_object($langs->trans('ShowProduct'),'product');
|
||||
$text.= ' '.$objp->ref.'</a>';
|
||||
$text.= ' - '.$objp->product;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':$objp->description);
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description));
|
||||
print $html->textwithtooltip($text,$description,3,'','',$i);
|
||||
// Todo: voir si on insert ou pas en option les dates de debut et de fin de service
|
||||
//print_date_range($objp->date_start,$objp->date_end);
|
||||
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
||||
{
|
||||
print ($objp->description && $objp->description!=$objp->product)?'<br>'.stripslashes(nl2br($objp->description)):'';
|
||||
print ($objp->description && $objp->description!=$objp->product)?'<br>'.dol_htmlentitiesbr($objp->description):'';
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
@ -1512,7 +1512,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="eldesc" class="flat" cols="70" rows="1">'.$objp->description.'</textarea>';
|
||||
print '<textarea name="eldesc" class="flat" cols="70" rows="1">'.dol_htmlentitiesbr_decode($objp->description).'</textarea>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
|
||||
@ -225,7 +225,7 @@ if ($_GET["action"] == 'create')
|
||||
else
|
||||
{
|
||||
print '<textarea class="flat" name="account_comment" cols="70" rows="10">';
|
||||
print $account->comment.'</textarea>';
|
||||
print dol_htmlentitiesbr_decode($account->comment).'</textarea>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@ -464,7 +464,7 @@ else
|
||||
else
|
||||
{
|
||||
print '<textarea class="flat" name="account_comment" cols="70" rows="10">';
|
||||
print $account->comment.'</textarea>';
|
||||
print dol_htmlentitiesbr_decode($account->comment).'</textarea>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -2363,13 +2363,13 @@ else
|
||||
else $text.= img_object($langs->trans('ShowProduct'),'product');
|
||||
$text.= ' '.$objp->ref.'</a>';
|
||||
$text.= ' - '.$objp->product;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':$objp->description);
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description));
|
||||
//print $description;
|
||||
print $html->textwithtooltip($text,$description,3,'','',$i);
|
||||
print_date_range($objp->date_start,$objp->date_end);
|
||||
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
||||
{
|
||||
print ($objp->description && $objp->description!=$objp->product)?'<br>'.stripslashes(nl2br($objp->description)):'';
|
||||
print ($objp->description && $objp->description!=$objp->product)?'<br>'.dol_htmlentitiesbr($objp->description):'';
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
@ -2505,7 +2505,10 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="desc" class="flat" cols="70" rows="'.ROWS_2.'">'.$objp->description.'</textarea>';
|
||||
print '<textarea name="desc" class="flat" cols="70" rows="'.ROWS_2.'">';
|
||||
//print $objp->description;
|
||||
print dol_htmlentitiesbr_decode($objp->description);
|
||||
print '</textarea>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
|
||||
@ -215,11 +215,11 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
||||
}
|
||||
|
||||
// Description de la ligne produit
|
||||
$libelleproduitservice=dol_htmlentities($this->expe->lignes[$i]->description);
|
||||
$libelleproduitservice=dol_htmlentitiesbr($this->expe->lignes[$i]->description,1);
|
||||
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);
|
||||
if ($libelleproduitservice) $libelleproduitservice.="<br>";
|
||||
$libelleproduitservice.=dol_htmlentitiesbr($this->expe->lignes[$i]->description,1);
|
||||
}
|
||||
// Si ligne associée à un code produit
|
||||
if ($this->expe->lignes[$i]->fk_product)
|
||||
|
||||
@ -621,7 +621,7 @@ elseif ($_GET["id"] > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="description" wrap="soft" cols="70" rows="12">'.$fichinter->description.'</textarea>';
|
||||
print '<textarea name="description" wrap="soft" cols="70" rows="12">'.dol_htmlentitiesbr_decode($fichinter->description).'</textarea>';
|
||||
}
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
@ -758,7 +758,7 @@ elseif ($_GET["id"] > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="desc" cols="70" class="flat" rows="'.ROWS_2.'">'.$objp->description.'</textarea>';
|
||||
print '<textarea name="desc" cols="70" class="flat" rows="'.ROWS_2.'">'.dol_htmlentitiesbr_decode($objp->description).'</textarea>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -707,11 +707,11 @@ else
|
||||
$text.= ' '.$objp->ref_fourn.'</a>';
|
||||
$text.= ' ('.$objp->ref.')';
|
||||
$text.= ' - '.$objp->product;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':$objp->description);
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description));
|
||||
print $html->textwithtooltip($text,$description,3,'','',$i);
|
||||
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
||||
{
|
||||
print ($objp->description && $objp->description!=$objp->product)?'<br>'.stripslashes(nl2br($objp->description)):'';
|
||||
print ($objp->description && $objp->description!=$objp->product)?'<br>'.dol_htmlentitiesbr($objp->description):'';
|
||||
}
|
||||
|
||||
print "</td>";
|
||||
@ -781,7 +781,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="eldesc" class="flat" cols="70" rows="1">'.$objp->description.'</textarea>';
|
||||
print '<textarea name="eldesc" class="flat" cols="70" rows="1">'.dol_htmlentitiesbr_decode($objp->description).'</textarea>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
|
||||
@ -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.="<br>";
|
||||
$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.="<br>".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
|
||||
|
||||
@ -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","<br>",$htmltext);
|
||||
|
||||
if ($conf->use_javascript_ajax && $tooltipon == 4)
|
||||
{
|
||||
$s = '<div id="tip'.$i.'">'."\n";
|
||||
$s.= $text;
|
||||
$s.= '</div>'."\n";
|
||||
$s.= '<div id="tooltip_content" style="display:none">'."\n";
|
||||
$s.= $htmltext."\n";
|
||||
$s.= '</div>'."\n";
|
||||
$s.= '<script type=\'text/javascript\'>'."\n";
|
||||
$s.= 'TooltipManager.init("","",{width:'.$width.', shiftX:'.$shiftX.'});'."\n";
|
||||
$s.= 'TooltipManager.addHTML("tip'.$i.'", "tooltip_content");'."\n";
|
||||
$s.= '</script>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
$htmltext=eregi_replace('"',"\'",$htmltext);
|
||||
if ($tooltipon==1 || $tooltipon==3)
|
||||
{
|
||||
$paramfortooltiptext.=' onmouseover="showtip(\''.$htmltext.'\')"';
|
||||
$paramfortooltiptext.=' onMouseout="hidetip()"';
|
||||
}
|
||||
if ($tooltipon==2 || $tooltipon==3)
|
||||
{
|
||||
$paramfortooltippicto.=' onmouseover="showtip(\''.$htmltext.'\')"';
|
||||
$paramfortooltippicto.=' onMouseout="hidetip()"';
|
||||
}
|
||||
}
|
||||
$paramfortooltippicto ='';
|
||||
|
||||
// Sanitize tooltip
|
||||
$htmltext=ereg_replace("'","\'",$htmltext);
|
||||
$htmltext=ereg_replace("'","\'",$htmltext);
|
||||
$htmltext=ereg_replace("\r","",$htmltext);
|
||||
$htmltext=ereg_replace("<br>\n","<br>",$htmltext);
|
||||
$htmltext=ereg_replace("\n","",$htmltext);
|
||||
|
||||
if ($conf->use_javascript_ajax && $tooltipon == 4)
|
||||
{
|
||||
$s = '<div id="tip'.$i.'">'."\n";
|
||||
$s.= $text;
|
||||
$s.= '</div>'."\n";
|
||||
$s.= '<div id="tooltip_content" style="display:none">'."\n";
|
||||
$s.= $htmltext."\n";
|
||||
$s.= '</div>'."\n";
|
||||
$s.= '<script type=\'text/javascript\'>'."\n";
|
||||
$s.= 'TooltipManager.init("","",{width:'.$width.', shiftX:'.$shiftX.'});'."\n";
|
||||
$s.= 'TooltipManager.addHTML("tip'.$i.'", "tooltip_content");'."\n";
|
||||
$s.= '</script>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
$htmltext=eregi_replace('"',"\'",$htmltext);
|
||||
if ($tooltipon==1 || $tooltipon==3)
|
||||
{
|
||||
$paramfortooltiptext.=' onmouseover="showtip(\''.$htmltext.'\')"';
|
||||
$paramfortooltiptext.=' onMouseout="hidetip()"';
|
||||
}
|
||||
if ($tooltipon==2 || $tooltipon==3)
|
||||
{
|
||||
$paramfortooltippicto.=' onmouseover="showtip(\''.$htmltext.'\')"';
|
||||
$paramfortooltippicto.=' onMouseout="hidetip()"';
|
||||
}
|
||||
}
|
||||
|
||||
$s="";
|
||||
$s.='<table class="nobordernopadding"><tr>';
|
||||
|
||||
@ -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.="<br>";
|
||||
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.="<br>".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
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@dolibarr.fr>
|
||||
*
|
||||
* 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<EFBFBD>n<EFBFBD>rer les factures au mod<EFBFBD>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<EFBFBD>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.="<br>";
|
||||
|
||||
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<EFBFBD>rifie si les lignes personnalis<69>es sont format<61>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<63>e <20> 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.="<br>".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
|
||||
|
||||
|
||||
@ -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.="<br>";
|
||||
|
||||
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.="<br>".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
|
||||
|
||||
@ -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/' ;
|
||||
|
||||
@ -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 '<img width="2px" src="/theme/common/transparent.png">';
|
||||
if (! $sortorder)
|
||||
{
|
||||
print '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",0).'</a>';
|
||||
print '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'.img_up("Z-A",0).'</a>';
|
||||
@ -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","<br>",$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 <br>, 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".'<br ?/?>',"<br>",$ret);
|
||||
$ret=eregi_replace('<br ?/?>'."\r\n","\r\n",$ret);
|
||||
$ret=eregi_replace('<br ?/?>'."\n","\n",$ret);
|
||||
$ret=eregi_replace('<br ?/?>',"\n",$ret);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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.="<br>";
|
||||
$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.="<br>".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
|
||||
|
||||
@ -983,7 +983,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
else
|
||||
{
|
||||
print '<textarea name="desc" rows="4" cols="90">';
|
||||
print $product->description;
|
||||
print dol_htmlentitiesbr_decode($product->description);
|
||||
print "</textarea>";
|
||||
}
|
||||
print "</td></tr>";
|
||||
@ -1029,7 +1029,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
else
|
||||
{
|
||||
print '<textarea name="note" rows="8" cols="70">';
|
||||
print $product->note;
|
||||
print dol_htmlentitiesbr_decode($product->note);
|
||||
print "</textarea>";
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
@ -161,7 +161,7 @@ if ($_GET["action"] == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="desc" cols="70" rows="5">'.$entrepot->description.'</textarea>';
|
||||
print '<textarea name="desc" cols="70" rows="5">'.dol_htmlentitiesbr_decode($entrepot->description).'</textarea>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@ -414,7 +414,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="desc" cols="70" rows="5">'.$entrepot->description.'</textarea>';
|
||||
print '<textarea name="desc" cols="70" rows="5">'.dol_htmlentitiesbr_decode($entrepot->description).'</textarea>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -168,7 +168,7 @@ if ($_GET["action"] == 'edit')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="desc-'.$key.'" rows="3" cols="80">'.$product->multilangs[$key]["description"].'</textarea>';
|
||||
print '<textarea name="desc-'.$key.'" rows="3" cols="80">'.dol_htmlentitiesbr_decode($product->multilangs[$key]["description"]).'</textarea>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '<tr><td valign="top" width="15%">'.$langs->trans('Note').'</td><td>';
|
||||
@ -180,7 +180,7 @@ if ($_GET["action"] == 'edit')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="note-'.$key.'" rows="3" cols="80">'.$product->multilangs[$key]["note"].'</textarea>';
|
||||
print '<textarea name="note-'.$key.'" rows="3" cols="80">'.dol_htmlentitiesbr_decode($product->multilangs[$key]["note"]).'</textarea>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '</tr>';
|
||||
|
||||
@ -106,7 +106,7 @@ if ($socid > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="note" cols="70" rows="10">'.$societe->note.'</textarea>';
|
||||
print '<textarea name="note" cols="70" rows="10">'.dol_htmlentitiesbr_decode($societe->note).'</textarea>';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -411,7 +411,7 @@ else
|
||||
else
|
||||
{
|
||||
print '<textarea class="flat" name="note" rows="'.ROWS_8.'" cols="90">';
|
||||
print $group->note;
|
||||
print dol_htmlentitiesbr_decode($group->note);
|
||||
print '</textarea>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -122,7 +122,7 @@ if ($id)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<textarea name="note" cols="80" rows="10">'.$fuser->note.'</textarea>';
|
||||
print '<textarea name="note" cols="80" rows="10">'.dol_htmlentitiesbr_decode($fuser->note).'</textarea>';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user