forked from Wavyzz/dolibarr
Fix: Bad calculation of nb of line. Fix: Bad position of lines into pdf_soleil
This commit is contained in:
@@ -3249,7 +3249,7 @@ function dol_nboflines($s,$maxchar=0)
|
||||
|
||||
|
||||
/**
|
||||
* Return nb of lines of a formated text with \n and <br>
|
||||
* Return nb of lines of a formated text with \n and <br> (we can't have both \n and br)
|
||||
*
|
||||
* @param string $text Text
|
||||
* @param int $maxlinesize Largeur de ligne en caracteres (ou 0 si pas de limite - defaut)
|
||||
@@ -3258,8 +3258,9 @@ function dol_nboflines($s,$maxchar=0)
|
||||
*/
|
||||
function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8')
|
||||
{
|
||||
//print $text;
|
||||
$repTable = array("\t" => " ", "\n" => "<br>", "\r" => " ", "\0" => " ", "\x0B" => " ");
|
||||
if (dol_textishtml($text)) $repTable = array("\t" => " ", "\n" => " ", "\r" => " ", "\0" => " ", "\x0B" => " ");
|
||||
|
||||
$text = strtr($text, $repTable);
|
||||
if ($charset == 'UTF-8') { $pattern = '/(<[^>]+>)/Uu'; } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support
|
||||
else $pattern = '/(<[^>]+>)/U'; // /U is to have UNGREEDY regex to limit to one html tag.
|
||||
|
||||
@@ -227,7 +227,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
|
||||
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY);
|
||||
|
||||
$pdf->MultiCell(0, 3, ''); // Set interline to 3. Then writeMultiCell must use 3 also.
|
||||
$pdf->MultiCell(0, 2, ''); // Set interline to 3. Then writeMultiCell must use 3 also.
|
||||
|
||||
$nblines = count($object->lines);
|
||||
|
||||
@@ -244,14 +244,27 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
$pdf->SetFont('','B', $default_font_size - 1);
|
||||
$pdf->SetXY($this->marge_gauche, $curY);
|
||||
$txt=dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output);
|
||||
|
||||
$curYold=$nexYold=$nexY;
|
||||
$pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY, $txt, 0, 1, 0);
|
||||
$curY = $pdf->GetY();
|
||||
$nexY+=3;
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
|
||||
$pdf->SetXY($this->marge_gauche, $curY + 3);
|
||||
$pdf->SetXY($this->marge_gauche, $nexY);
|
||||
$desc = dol_htmlentitiesbr($objectligne->desc,1);
|
||||
$pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY + 3, $desc, 0, 1, 0);
|
||||
$nexY+=dol_nboflines_bis($objectligne->desc,52,$outputlangs->charset_output)*3;
|
||||
|
||||
$curYold = $pdf->GetY();
|
||||
$nexYold = $curYold;
|
||||
|
||||
$pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY, $desc, 0, 1, 0);
|
||||
|
||||
$stringheight=$pdf->getStringHeight('A', $txt);
|
||||
$curY = $pdf->GetY();
|
||||
|
||||
$nexY+=(dol_nboflines_bis($objectligne->desc,0,$outputlangs->charset_output)*$stringheight);
|
||||
//print $curYold."-".$nexYold." +".dol_nboflines_bis($objectligne->desc,52,$outputlangs->charset_output)."*".$stringheight."= ".$curY."-".$nexY."<br>";
|
||||
|
||||
$nexY+=2; // Passe espace entre les lignes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user