From c0852b1a87d45f0cd7be9eceb2b13ff637eba602 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Jun 2008 22:39:45 +0000 Subject: [PATCH] Fix: PDF soleil --- .../modules/fichinter/pdf_soleil.modules.php | 30 ++++++++++++++++-- htdocs/lib/functions.lib.php | 31 +++++++++++-------- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php index 3014b12edf5..93329351361 100644 --- a/htdocs/includes/modules/fichinter/pdf_soleil.modules.php +++ b/htdocs/includes/modules/fichinter/pdf_soleil.modules.php @@ -245,7 +245,7 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetFont('Arial','',12); $tab_top = 100; - $tab_height = 110; + $tab_height = 16; $pdf->SetXY (10, $tab_top); $pdf->MultiCell(190,8,$langs->transnoentities("Description"),0,'L',0); @@ -256,8 +256,34 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetFont('Arial','', 10); $pdf->SetXY (10, $tab_top + 8 ); - $pdf->MultiCell(190, 5, $fichinter->description, 0, 'J', 0); + $pdf->writeHTMLCell(190, 5, 10, $tab_top + 8, dol_htmlentitiesbr($fichinter->description), 0, 'J', 0); + //dolibarr_syslog("desc=".dol_htmlentitiesbr($fichinter->description)); + $fichinter->fetch_lines(); + $num = sizeof($fichinter->lignes); + $i=0; + if ($num) + { + while ($i < $num) + { + $fichinterligne = $fichinter->lignes[$i]; + + $valide = $fichinterligne->fetch($fichinterligne->id); + if ($valide>0) + { + $pdf->SetXY (20, $tab_top + 16 + $i * 20); + $pdf->writeHTMLCell(190, 8, 20, $tab_top + 16 + $i * 20, + dol_htmlentitiesbr("Date : ".dolibarr_print_date($fichinterligne->datei)." - Durée : ".ConvertSecondToTime($fichinterligne->duration)), 0, 'J', 0); + + $pdf->SetXY (20, $tab_top + 22 + $i * 20); + $pdf->writeHTMLCell(170, 8, 20, $tab_top + 22 + $i * 20, + dol_htmlentitiesbr($fichinterligne->desc,1), 0, 'L', 0); + $tab_height+=20; + } + $i++; + } + } + $pdf->Rect(10, $tab_top, 190, $tab_height); $pdf->SetXY (10, $pdf->GetY() + 20 ); $pdf->MultiCell(60, 5, '', 0, 'J', 0); diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index c24a267d79f..d6af443938f 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -2531,7 +2531,12 @@ function dol_nl2br($stringtoencode,$nl2brmode=0) */ function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0) { - if (dol_textishtml($stringtoencode)) return $stringtoencode; + if (dol_textishtml($stringtoencode)) + { + // Replace "
" by "
". It's same and avoid pb with FPDF. + $stringtoencode=eregi_replace('',"
",$ret); - $ret=eregi_replace('
'."\r\n","\r\n",$ret); - $ret=eregi_replace('
'."\n","\n",$ret); - $ret=eregi_replace('
',"\n",$ret); + $ret=eregi_replace("\r\n".'",$ret); + $ret=eregi_replace('