]> _ Git - cubeextranet.git/commitdiff
#extranet fix quote page break bug
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 16 Mar 2016 14:29:00 +0000 (14:29 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 16 Mar 2016 14:29:00 +0000 (14:29 +0000)
@0:20

inc/extranet/Metier/class.extranet.document.php

index 5e7648d86f1f7c6aec0bd53d51770c268871a5de..50395f8287178d72f880617d0e07e3be2bac7475 100644 (file)
@@ -130,7 +130,7 @@ abstract class extranetDocument extends cubeMetier {
                        $this->pdf->SetXY(170, $y);\r
                        $ligne['montant'] = trim($ligne['montant']);\r
                        if (is_numeric($ligne['montant'])) {\r
-                               $this->pdf->Cell(33, 4, cubePrices::formatAmount($ligne['montant'], $this->client->lang) .' '. $this->euro, 0, 0, 'R');\r
+                               $this->pdf->Cell(33, 4, cubePrices::formatAmount($ligne['montant'], $this->client->lang) . ' ' . $this->euro, 0, 0, 'R');\r
                        } else {\r
                                $this->pdf->Cell(33, 4, self::escape($ligne['montant']), 0, 0, 'R');\r
                        }\r
@@ -169,14 +169,14 @@ abstract class extranetDocument extends cubeMetier {
                        $this->pdf->SetXY(170, 218);\r
                        $space = 9.7;\r
                }\r
-               $this->pdf->Cell(32, $space, cubePrices::formatAmount($this->total_ht, $this->client->lang) .' '. $this->euro, 0, 1, 'R');\r
+               $this->pdf->Cell(32, $space, cubePrices::formatAmount($this->total_ht, $this->client->lang) . ' ' . $this->euro, 0, 1, 'R');\r
                $this->pdf->SetX(170);\r
                $this->pdf->setFont('KlavikaLight', '', 10);\r
                // Affichage du taux de tva et du montant des taxes\r
                $this->pdf->Cell(32, $space, $tva_text, 0, 1, 'R');\r
                $this->pdf->SetX(170);\r
                if ($tva) {\r
-                       $this->pdf->Cell(32, $space, $taxes . ' '.$this->euro, 0, 1, 'R');\r
+                       $this->pdf->Cell(32, $space, $taxes . ' ' . $this->euro, 0, 1, 'R');\r
                } else {\r
                        $this->pdf->Cell(32, $space, '-', 0, 1, 'R');\r
                }\r
@@ -184,7 +184,7 @@ abstract class extranetDocument extends cubeMetier {
 \r
                $this->pdf->SetTextColor(255, 255, 255);\r
                $this->pdf->setFont('KlavikaLight', 'B', 10);\r
-               $this->pdf->Cell(32, $space + 1, $ttcf .' '. $this->euro, 0, 1, 'R');\r
+               $this->pdf->Cell(32, $space + 1, $ttcf . ' ' . $this->euro, 0, 1, 'R');\r
 \r
                if (isset($notes)) {\r
                        $this->pdf->setXY(8, 268);\r
@@ -221,7 +221,7 @@ abstract class extranetDocument extends cubeMetier {
                        $pdf->SetXY(170, $y);\r
                        $ligne['montant'] = trim($ligne['montant']);\r
                        if (is_numeric($ligne['montant'])) {\r
-                               $pdf->Cell(33, 4, cubePrices::formatAmount($ligne['montant'], $this->client->lang) .' '. $this->euro, 0, 0, 'R');\r
+                               $pdf->Cell(33, 4, cubePrices::formatAmount($ligne['montant'], $this->client->lang) . ' ' . $this->euro, 0, 0, 'R');\r
                        } else {\r
                                $pdf->Cell(33, 4, self::escape($ligne['montant']), 0, 0, 'R');\r
                        }\r
@@ -248,6 +248,7 @@ abstract class extranetDocument extends cubeMetier {
                        $pages = 2 + ceil(($h - 355) / 245);\r
                }\r
 \r
+               $lasty = 0;\r
                $nb_lines = count($lines);\r
                if ($pages > 1) {\r
                        $i = 0;\r
@@ -262,15 +263,15 @@ abstract class extranetDocument extends cubeMetier {
                                }\r
                                for (; $i <= $nb_lines; $i++) {\r
                                        $y += $lines[$i];\r
-                                       if ($y > $limit) {\r
+                                       if (($y - $lasty) > $limit) {\r
                                                $cesures[$page] = $i;\r
                                                $y = $lines[$i];\r
+                                               $lasty = $y;\r
                                                continue 2;\r
                                        }\r
-                               }\r
-\r
-                               if ($i >= $nb_lines) {\r
-                                       break;\r
+                                       if ($i >= $nb_lines) {\r
+                                               break;\r
+                                       }\r
                                }\r
                        }\r
                }\r
@@ -283,13 +284,13 @@ abstract class extranetDocument extends cubeMetier {
 \r
 \r
                $res = array('pages' => $pages, 'cesures' => $cesures);\r
-               fb($res);\r
+\r
                return $res;\r
        }\r
 \r
        protected function escape($str) {\r
                $str = cubeText::removeOddStuff($str);\r
-               $str= utf8_decode($str);\r
+               $str = utf8_decode($str);\r
                $str = str_replace(utf8_decode('€'), $this->euro, $str);\r
                return $str;\r
        }\r