From: vincent@cubedesigners.com Date: Wed, 16 Mar 2016 14:29:00 +0000 (+0000) Subject: #extranet fix quote page break bug X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=7ddb64fcc434ac85e4ff4a80a6e8e1c6a0f3893e;p=cubeextranet.git #extranet fix quote page break bug @0:20 --- diff --git a/inc/extranet/Metier/class.extranet.document.php b/inc/extranet/Metier/class.extranet.document.php index 5e7648d86..50395f828 100644 --- a/inc/extranet/Metier/class.extranet.document.php +++ b/inc/extranet/Metier/class.extranet.document.php @@ -130,7 +130,7 @@ abstract class extranetDocument extends cubeMetier { $this->pdf->SetXY(170, $y); $ligne['montant'] = trim($ligne['montant']); if (is_numeric($ligne['montant'])) { - $this->pdf->Cell(33, 4, cubePrices::formatAmount($ligne['montant'], $this->client->lang) .' '. $this->euro, 0, 0, 'R'); + $this->pdf->Cell(33, 4, cubePrices::formatAmount($ligne['montant'], $this->client->lang) . ' ' . $this->euro, 0, 0, 'R'); } else { $this->pdf->Cell(33, 4, self::escape($ligne['montant']), 0, 0, 'R'); } @@ -169,14 +169,14 @@ abstract class extranetDocument extends cubeMetier { $this->pdf->SetXY(170, 218); $space = 9.7; } - $this->pdf->Cell(32, $space, cubePrices::formatAmount($this->total_ht, $this->client->lang) .' '. $this->euro, 0, 1, 'R'); + $this->pdf->Cell(32, $space, cubePrices::formatAmount($this->total_ht, $this->client->lang) . ' ' . $this->euro, 0, 1, 'R'); $this->pdf->SetX(170); $this->pdf->setFont('KlavikaLight', '', 10); // Affichage du taux de tva et du montant des taxes $this->pdf->Cell(32, $space, $tva_text, 0, 1, 'R'); $this->pdf->SetX(170); if ($tva) { - $this->pdf->Cell(32, $space, $taxes . ' '.$this->euro, 0, 1, 'R'); + $this->pdf->Cell(32, $space, $taxes . ' ' . $this->euro, 0, 1, 'R'); } else { $this->pdf->Cell(32, $space, '-', 0, 1, 'R'); } @@ -184,7 +184,7 @@ abstract class extranetDocument extends cubeMetier { $this->pdf->SetTextColor(255, 255, 255); $this->pdf->setFont('KlavikaLight', 'B', 10); - $this->pdf->Cell(32, $space + 1, $ttcf .' '. $this->euro, 0, 1, 'R'); + $this->pdf->Cell(32, $space + 1, $ttcf . ' ' . $this->euro, 0, 1, 'R'); if (isset($notes)) { $this->pdf->setXY(8, 268); @@ -221,7 +221,7 @@ abstract class extranetDocument extends cubeMetier { $pdf->SetXY(170, $y); $ligne['montant'] = trim($ligne['montant']); if (is_numeric($ligne['montant'])) { - $pdf->Cell(33, 4, cubePrices::formatAmount($ligne['montant'], $this->client->lang) .' '. $this->euro, 0, 0, 'R'); + $pdf->Cell(33, 4, cubePrices::formatAmount($ligne['montant'], $this->client->lang) . ' ' . $this->euro, 0, 0, 'R'); } else { $pdf->Cell(33, 4, self::escape($ligne['montant']), 0, 0, 'R'); } @@ -248,6 +248,7 @@ abstract class extranetDocument extends cubeMetier { $pages = 2 + ceil(($h - 355) / 245); } + $lasty = 0; $nb_lines = count($lines); if ($pages > 1) { $i = 0; @@ -262,15 +263,15 @@ abstract class extranetDocument extends cubeMetier { } for (; $i <= $nb_lines; $i++) { $y += $lines[$i]; - if ($y > $limit) { + if (($y - $lasty) > $limit) { $cesures[$page] = $i; $y = $lines[$i]; + $lasty = $y; continue 2; } - } - - if ($i >= $nb_lines) { - break; + if ($i >= $nb_lines) { + break; + } } } } @@ -283,13 +284,13 @@ abstract class extranetDocument extends cubeMetier { $res = array('pages' => $pages, 'cesures' => $cesures); - fb($res); + return $res; } protected function escape($str) { $str = cubeText::removeOddStuff($str); - $str= utf8_decode($str); + $str = utf8_decode($str); $str = str_replace(utf8_decode('€'), $this->euro, $str); return $str; }