]> _ Git - cubeextranet.git/commitdiff
wait #5615 @0.25
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 17 Oct 2023 13:16:32 +0000 (13:16 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 17 Oct 2023 13:16:32 +0000 (13:16 +0000)
inc/extranet/Metier/class.extranet.document.php

index 4934bca74348aea9ef14b8d440b8cdb9853ee8f2..3a7aa0c26ad27ac3b599f583632fc7f3989e87b4 100644 (file)
 <?php\r
 \r
-abstract class extranetDocument extends cubeMetier {\r
-\r
-       protected $lignes;\r
-       protected $nom;\r
-       protected $total_ht;\r
-       protected $createur_id;\r
-       protected $date_creation;\r
-       protected $status;\r
-       protected $client_id;\r
-       protected $fond;\r
-       protected $fond1;\r
-       protected $fond2;\r
-       protected $fond3;\r
-       protected $adresse;\r
-       // Attributs composés\r
-       protected $createur;\r
-       protected $client;\r
-       protected $pdf;\r
-       protected $euro;\r
-\r
-       public function saveAsPDF() {\r
-               $pdf = $this->testPDF();\r
-               $pages = $pdf['pages'];\r
-               $cesures = $pdf['cesures'];\r
-               if ($this->isFacture() && $pages > 1) {\r
-                       $pages = 1;\r
-                       $displayDescription = false;\r
-               } else {\r
-                       $displayDescription = true;\r
-               }\r
-\r
-               $template = ROOT . '/images/extranet/docs/';\r
-\r
-\r
-               $this->euro = chr(128);\r
-\r
-               $this->pdf = new FPDI();\r
-               $this->pdf->SetAutoPageBreak(false);\r
-               $this->pdf->setSourceFile($template . 'template.pdf');\r
-\r
-               $this->pdf->AddFont('KlavikaLight', '', 'klavika-light.php');\r
-               $this->pdf->AddFont('KlavikaLight', 'B', 'klavika-medium.php');\r
-               $this->pdf->AddFont('Klavika', '', 'klavika-regular.php');\r
-               $this->pdf->AddFont('Klavika', 'B', 'klavika-bold.php');\r
-\r
-               $this->getBackground();\r
-\r
-               $page = 1;\r
-\r
-               if ($pages == 1) {\r
-                       $this->addPage($this->fond);\r
-               } else {\r
-                       $this->addPage($this->fond1);\r
-               }\r
-\r
-               $this->pdf->SetTextColor(0, 0, 0);\r
-\r
-               // Bloc adresse\r
-               if (trim($this->adresse) == '') {\r
-                       $client = self::escape($this->client->rs);\r
-                       $adresse = self::escape(trim($this->client->adresse) . "\n" . $this->client->code_postal . " " . $this->client->ville . "\n" . cubeCountry::getCountry($this->client->pays));\r
-               } else {\r
-                       $l = explode("\n", trim($this->adresse));\r
-                       $l0 = array_shift($l);\r
-\r
-                       $client = self::escape($l0);\r
-                       $adresse = self::escape(implode("\n", $l));\r
-               }\r
-               $this->pdf->SetXY(114, 45);\r
-               $this->pdf->SetFont('KlavikaLight', 'B', 12);\r
-               $this->pdf->MultiCell(80, 8, $client, 0, 2);\r
-               $this->pdf->SetX(114);\r
-               $this->pdf->SetFont('KlavikaLight', '', 12);\r
-               $this->pdf->MultiCell(80, 6, $adresse);\r
-               // Bloc TVA Intra\r
-               if ($this instanceof extranetFacture) {\r
-                       $texte_tva = '';\r
-                       if ($this->client->tva_intra != '' && cubeCountry::inUE($this->client->pays)) {\r
-                               $texte_tva .= __('N° de TVA Intracommunautaire') . ' : ' . $this->client->tva_intra . "\n";\r
-                       }\r
-                       if ($this->texte_complementaire != '') {\r
-                               $texte_tva .= $this->texte_complementaire;\r
-                       }\r
-                       if ($texte_tva != '') {\r
-                               $this->pdf->SetFont('KlavikaLight', '', 8);\r
-                               $this->pdf->setXY(114, 90);\r
-                               $this->pdf->MultiCell(80, 4, self::escape(trim($texte_tva)));\r
-                       }\r
-               }\r
-               // Bloc titre\r
-               $this->pdf->SetXY(6, 60);\r
-               $titre = $this->documentTitre($this->client->lang);\r
-               $this->pdf->SetFont('KlavikaLight', 'B', 15);\r
-               $this->pdf->MultiCell(73, 4, self::escape($titre), 0, 'L');\r
-\r
-               $this->pdf->SetXY(6, $this->pdf->GetY() + 3);\r
-               $this->pdf->SetFont('KlavikaLight', '', 11);\r
-               $titre = '';\r
-               if ($this->client->lang == 'fr') {\r
-                       $titre .= strftime('%d %B %Y', $this->date_creation);\r
-               } else {\r
-                       $titre .= date('F jS Y');\r
-               }\r
-               $titre .= "\n\n" . $this->nom;\r
-               $this->pdf->MultiCell(73, 4, self::escape($titre), 0, 'L');\r
-\r
-               // blocs\r
-               $this->pdf->setY(115);\r
-               foreach ($this->lignes as $i => $ligne) {\r
-                       if ($pages > 1 && $i == $cesures[$page]) {\r
-                               $page++;\r
-\r
-                               if ($page == $pages) {\r
-                                       $tpl = $this->fond3;\r
-                               } else {\r
-                                       $tpl = $this->fond2;\r
-                               }\r
-\r
-                               $this->addPage($tpl);\r
-                               $this->pdf->setY(25);\r
-                       }\r
-\r
-                       $y = $this->pdf->getY() + 4;\r
-\r
-                       $this->pdf->SetFont('Klavika', '', 10);\r
-                       // Prix\r
-                       $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
-                       } else {\r
-                               $this->pdf->Cell(33, 4, self::escape($ligne['montant']), 0, 0, 'R');\r
-                       }\r
-                       // Titre\r
-            $size=10;\r
-            if(strpos($ligne['titre'],'__')===0){\r
-                $size=13;\r
+abstract class extranetDocument extends cubeMetier\r
+{\r
+\r
+    protected $lignes;\r
+    protected $nom;\r
+    protected $total_ht;\r
+    protected $createur_id;\r
+    protected $date_creation;\r
+    protected $status;\r
+    protected $client_id;\r
+    protected $fond;\r
+    protected $fond1;\r
+    protected $fond2;\r
+    protected $fond3;\r
+    protected $adresse;\r
+    // Attributs composés\r
+    protected $createur;\r
+    protected $client;\r
+    protected $pdf;\r
+    protected $euro;\r
+\r
+    public function saveAsPDF()\r
+    {\r
+        $pdf = $this->testPDF();\r
+        $pages = $pdf['pages'];\r
+        $cesures = $pdf['cesures'];\r
+        if ($this->isFacture() && $pages > 1) {\r
+            $pages = 1;\r
+            $displayDescription = false;\r
+        } else {\r
+            $displayDescription = true;\r
+        }\r
+\r
+        $template = ROOT . '/images/extranet/docs/';\r
+\r
+\r
+        $this->euro = chr(128);\r
+\r
+        $this->pdf = new FPDI();\r
+        $this->pdf->SetAutoPageBreak(false);\r
+        $this->pdf->setSourceFile($template . 'template.pdf');\r
+\r
+        $this->pdf->AddFont('KlavikaLight', '', 'klavika-light.php');\r
+        $this->pdf->AddFont('KlavikaLight', 'B', 'klavika-medium.php');\r
+        $this->pdf->AddFont('Klavika', '', 'klavika-regular.php');\r
+        $this->pdf->AddFont('Klavika', 'B', 'klavika-bold.php');\r
+\r
+        $this->getBackground();\r
+\r
+        $page = 1;\r
+\r
+        if ($pages == 1) {\r
+            $this->addPage($this->fond);\r
+        } else {\r
+            $this->addPage($this->fond1);\r
+        }\r
+\r
+        $this->pdf->SetTextColor(0, 0, 0);\r
+\r
+        // Bloc adresse\r
+        if (trim($this->adresse) == '') {\r
+            $client = self::escape($this->client->rs);\r
+            $adresse = self::escape(trim($this->client->adresse) . "\n" . $this->client->code_postal . " " . $this->client->ville . "\n" . cubeCountry::getCountry($this->client->pays));\r
+        } else {\r
+            $l = explode("\n", trim($this->adresse));\r
+            $l0 = array_shift($l);\r
+\r
+            $client = self::escape($l0);\r
+            $adresse = self::escape(implode("\n", $l));\r
+        }\r
+        $this->pdf->SetXY(114, 45);\r
+        $this->pdf->SetFont('KlavikaLight', 'B', 12);\r
+        $this->pdf->MultiCell(80, 8, $client, 0, 2);\r
+        $this->pdf->SetX(114);\r
+        $this->pdf->SetFont('KlavikaLight', '', 12);\r
+        $this->pdf->MultiCell(80, 6, $adresse);\r
+        // Bloc TVA Intra\r
+        if ($this instanceof extranetFacture) {\r
+            $texte_tva = '';\r
+            if ($this->client->tva_intra != '' && cubeCountry::inUE($this->client->pays)) {\r
+                $texte_tva .= __('N° de TVA Intracommunautaire') . ' : ' . $this->client->tva_intra . "\n";\r
             }\r
+            if ($this->texte_complementaire != '') {\r
+                $texte_tva .= $this->texte_complementaire;\r
+            }\r
+            if ($texte_tva != '') {\r
+                $this->pdf->SetFont('KlavikaLight', '', 8);\r
+                $this->pdf->setXY(114, 90);\r
+                $this->pdf->MultiCell(80, 4, self::escape(trim($texte_tva)));\r
+            }\r
+        }\r
+        // Bloc titre\r
+        $this->pdf->SetXY(6, 60);\r
+        $titre = $this->documentTitre($this->client->lang);\r
+        $this->pdf->SetFont('KlavikaLight', 'B', 15);\r
+        $this->pdf->MultiCell(73, 4, self::escape($titre), 0, 'L');\r
+\r
+        $this->pdf->SetXY(6, $this->pdf->GetY() + 3);\r
+        $this->pdf->SetFont('KlavikaLight', '', 11);\r
+        $titre = '';\r
+        if ($this->client->lang == 'fr') {\r
+            $titre .= date('d/m/Y', $this->date_creation);\r
+        } else {\r
+            $titre .= date('F jS Y');\r
+        }\r
+        $titre .= "\n\n" . $this->nom;\r
+        $this->pdf->MultiCell(73, 4, self::escape($titre), 0, 'L');\r
+\r
+        // blocs\r
+        $this->pdf->setY(115);\r
+        foreach ($this->lignes as $i => $ligne) {\r
+            if ($pages > 1 && $i == $cesures[$page]) {\r
+                $page++;\r
+\r
+                if ($page == $pages) {\r
+                    $tpl = $this->fond3;\r
+                } else {\r
+                    $tpl = $this->fond2;\r
+                }\r
+\r
+                $this->addPage($tpl);\r
+                $this->pdf->setY(25);\r
+            }\r
+\r
+            $y = $this->pdf->getY() + 4;\r
+\r
+            $this->pdf->SetFont('Klavika', '', 10);\r
+            // Prix\r
+            $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
+            } else {\r
+                $this->pdf->Cell(33, 4, self::escape($ligne['montant']), 0, 0, 'R');\r
+            }\r
+            // Titre\r
+            $size = 10;\r
+            if (strpos($ligne['titre'], '__') === 0) {\r
+                $size = 13;\r
+            }\r
+\r
+            $this->pdf->SetFont('Klavika', 'B', $size);\r
+            $this->pdf->setXY(6, $y);\r
+            $this->pdf->Cell(171, 4, self::escape(trim($ligne['titre'], " \t\n\r\0\x0B_")), 0, 1);\r
+            // Contenu\r
+            if ($displayDescription) {\r
+                $this->pdf->SetXY(6, $this->pdf->getY() + 1);\r
+                $this->pdf->SetFont('Klavika', '', 10);\r
+                $this->pdf->MultiCell(171, 4, self::escape($ligne['description']));\r
+            }\r
+        }\r
+        // Prix\r
+        $tva = cubeTaxes::tva($this->client->pays, $this->date_creation);\r
+        if (!$tva) {\r
+            $tva_text = 'EXPORT';\r
+        } elseif ($tva == 'UE') {\r
+            $tva = 0;\r
+            $tva_text = 'EXPORT * ';\r
+            $notes = ' * ' . __("Conformément à l'article 242 du Code Général des Impôts");\r
+        } else {\r
+            $tva_text = cubePrices::formatAmount($tva * 100, $this->client->lang, 1) . ' %';\r
+        }\r
+        $ttc = cubePrices::HTtoTTC($this->total_ht, $tva, 2);\r
+        $ttcf = cubePrices::formatAmount($ttc, $this->client->lang);\r
+        $taxes = ($tva > 0) ? cubePrices::formatAmount($ttc - $this->total_ht, $this->client->lang, 2) : '';\r
+        // Affichage du montant hors taxes\r
+        $this->pdf->setFont('KlavikaLight', 'B', 10);\r
+        if ($pages == 1) {\r
+            //$this->pdf->SetXY(170, 210);\r
+            $this->pdf->SetXY(170, 218.5);\r
+            $space = 9.5;\r
+        } else {\r
+            $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->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
+        } else {\r
+            $this->pdf->Cell(32, $space, '-', 0, 1, 'R');\r
+        }\r
+        $this->pdf->SetX(170);\r
+\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
+\r
+        if (isset($notes)) {\r
+            $this->pdf->setXY(8, 268);\r
+            $this->pdf->setTextColor(0, 0, 0);\r
+            $this->pdf->setFont('Klavika', '', 8);\r
+            $this->pdf->Cell(195, 0, self::escape($notes), 0, 1, 'R');\r
+        }\r
+        return $this->pdf;\r
+    }\r
+\r
+    public function addPage($page)\r
+    {\r
+        $templateIndex = $this->pdf->importPage($page);\r
+        $this->pdf->AddPage();\r
+        $this->pdf->useTemplate($templateIndex);\r
+    }\r
+\r
+    protected function testPDF()\r
+    {\r
+        $pdf = new FPDF('P', 'mm', array(210, 2000));\r
+        $pdf->AddFont('KlavikaLight', '', 'klavika-light.php');\r
+        $pdf->AddFont('KlavikaLight', 'B', 'klavika-medium.php');\r
+        $pdf->AddFont('Klavika', '', 'klavika-regular.php');\r
+        $pdf->AddFont('Klavika', 'B', 'klavika-bold.php');\r
+        $pdf->AddPage();\r
+        $pdf->SetAutoPageBreak(false);\r
+\r
+        $lines = array();\r
+\r
+        $lastY = -5;\r
+        foreach ($this->lignes as $i => $ligne) {\r
+            $y = $pdf->getY() + 5;\r
+\r
+            $pdf->SetFont('Klavika', 'B', 10);\r
+            // Prix\r
+            $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
+            } else {\r
+                $pdf->Cell(33, 4, self::escape($ligne['montant']), 0, 0, 'R');\r
+            }\r
+            // Titre\r
+            $pdf->setXY(13, $y);\r
+            $pdf->Cell(151, 4, self::escape(trim($ligne['titre'])), 0, 1);\r
+            // Contenu\r
+            $pdf->SetX(13);\r
+            $pdf->SetFont('Klavika', '', 10);\r
+            $pdf->MultiCell(171, 4, self::escape(trim($ligne['description'])));\r
+\r
+            $y = $pdf->getY();\r
+            $lines[] = $y - $lastY;\r
+            $lastY = $y;\r
+        }\r
+\r
+        $cesures = array();\r
+        $h = $pdf->getY();\r
+        if ($h <= 105) {\r
+            $pages = 1;\r
+        } elseif ($h <= 355) {\r
+            $pages = 2;\r
+        } else {\r
+            $pages = 2 + ceil(($h - 355) / 245);\r
+        }\r
+\r
+        $lasty = 0;\r
+        $nb_lines = count($lines);\r
+        if ($pages > 1) {\r
+            $i = 0;\r
+            $y = 0;\r
+            for ($page = 1; $page <= $pages; $page++) {\r
+                if ($page == 1) {\r
+                    $limit = 170;\r
+                } else if ($page == $pages) {\r
+                    $limit = 10000;\r
+                } else {\r
+                    $limit = 245;\r
+                }\r
+                for (; $i <= $nb_lines; $i++) {\r
+                    $y += $lines[$i];\r
+                    if (($y - $lasty) > $limit) {\r
+                        $cesures[$page] = $i;\r
+                        $y = $lines[$i];\r
+                        $lasty = $y;\r
+                        continue 2;\r
+                    }\r
+                    if ($i >= $nb_lines) {\r
+                        break;\r
+                    }\r
+                }\r
+            }\r
+        }\r
+\r
+        $pages = max(count($cesures), $pages);\r
+\r
+        if (!isset($cesures[$pages - 1])) {\r
+            $cesures[$pages - 1] = $nb_lines - 1;\r
+        }\r
+\r
+\r
+        $res = array('pages' => $pages, 'cesures' => $cesures);\r
+\r
+        return $res;\r
+    }\r
+\r
+    protected function escape($str)\r
+    {\r
+        $str = cubeText::removeOddStuff($str);\r
+        $str = utf8_decode($str);\r
+        $str = str_replace(utf8_decode('€'), $this->euro, $str);\r
+        return $str;\r
+    }\r
 \r
-                       $this->pdf->SetFont('Klavika', 'B', $size);\r
-                       $this->pdf->setXY(6, $y);\r
-                       $this->pdf->Cell(171, 4, self::escape(trim($ligne['titre']," \t\n\r\0\x0B_")), 0, 1);\r
-                       // Contenu\r
-                       if ($displayDescription) {\r
-                               $this->pdf->SetXY(6, $this->pdf->getY() + 1);\r
-                               $this->pdf->SetFont('Klavika', '', 10);\r
-                               $this->pdf->MultiCell(171, 4, self::escape($ligne['description']));\r
-                       }\r
-               }\r
-               // Prix\r
-               $tva = cubeTaxes::tva($this->client->pays, $this->date_creation);\r
-               if (!$tva) {\r
-                       $tva_text = 'EXPORT';\r
-               } elseif ($tva == 'UE') {\r
-                       $tva = 0;\r
-                       $tva_text = 'EXPORT *';\r
-                       $notes = '* ' . __("Conformément à l'article 242 du Code Général des Impôts");\r
-               } else {\r
-                       $tva_text = cubePrices::formatAmount($tva * 100, $this->client->lang, 1) . ' %';\r
-               }\r
-               $ttc = cubePrices::HTtoTTC($this->total_ht, $tva, 2);\r
-               $ttcf = cubePrices::formatAmount($ttc, $this->client->lang);\r
-               $taxes = ($tva > 0) ? cubePrices::formatAmount($ttc - $this->total_ht, $this->client->lang, 2) : '';\r
-               // Affichage du montant hors taxes\r
-               $this->pdf->setFont('KlavikaLight', 'B', 10);\r
-               if ($pages == 1) {\r
-                       //$this->pdf->SetXY(170, 210);\r
-                       $this->pdf->SetXY(170, 218.5);\r
-                       $space = 9.5;\r
-               } else {\r
-                       $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->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
-               } else {\r
-                       $this->pdf->Cell(32, $space, '-', 0, 1, 'R');\r
-               }\r
-               $this->pdf->SetX(170);\r
-\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
-\r
-               if (isset($notes)) {\r
-                       $this->pdf->setXY(8, 268);\r
-                       $this->pdf->setTextColor(0, 0, 0);\r
-                       $this->pdf->setFont('Klavika', '', 8);\r
-                       $this->pdf->Cell(195, 0, self::escape($notes), 0, 1, 'R');\r
-               }\r
-               return $this->pdf;\r
-       }\r
-\r
-       public function addPage($page) {\r
-               $templateIndex = $this->pdf->importPage($page);\r
-               $this->pdf->AddPage();\r
-               $this->pdf->useTemplate($templateIndex);\r
-       }\r
-\r
-       protected function testPDF() {\r
-               $pdf = new FPDF('P', 'mm', array(210, 2000));\r
-               $pdf->AddFont('KlavikaLight', '', 'klavika-light.php');\r
-               $pdf->AddFont('KlavikaLight', 'B', 'klavika-medium.php');\r
-               $pdf->AddFont('Klavika', '', 'klavika-regular.php');\r
-               $pdf->AddFont('Klavika', 'B', 'klavika-bold.php');\r
-               $pdf->AddPage();\r
-               $pdf->SetAutoPageBreak(false);\r
-\r
-               $lines = array();\r
-\r
-               $lastY = -5;\r
-               foreach ($this->lignes as $i => $ligne) {\r
-                       $y = $pdf->getY() + 5;\r
-\r
-                       $pdf->SetFont('Klavika', 'B', 10);\r
-                       // Prix\r
-                       $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
-                       } else {\r
-                               $pdf->Cell(33, 4, self::escape($ligne['montant']), 0, 0, 'R');\r
-                       }\r
-                       // Titre\r
-                       $pdf->setXY(13, $y);\r
-                       $pdf->Cell(151, 4, self::escape(trim($ligne['titre'])), 0, 1);\r
-                       // Contenu\r
-                       $pdf->SetX(13);\r
-                       $pdf->SetFont('Klavika', '', 10);\r
-                       $pdf->MultiCell(171, 4, self::escape(trim($ligne['description'])));\r
-\r
-                       $y = $pdf->getY();\r
-                       $lines[] = $y - $lastY;\r
-                       $lastY = $y;\r
-               }\r
-\r
-               $cesures = array();\r
-               $h = $pdf->getY();\r
-               if ($h <= 105) {\r
-                       $pages = 1;\r
-               } elseif ($h <= 355) {\r
-                       $pages = 2;\r
-               } else {\r
-                       $pages = 2 + ceil(($h - 355) / 245);\r
-               }\r
-\r
-               $lasty = 0;\r
-               $nb_lines = count($lines);\r
-               if ($pages > 1) {\r
-                       $i = 0;\r
-                       $y = 0;\r
-                       for ($page = 1; $page <= $pages; $page++) {\r
-                               if ($page == 1) {\r
-                                       $limit = 170;\r
-                               } else if ($page == $pages) {\r
-                                       $limit = 10000;\r
-                               } else {\r
-                                       $limit = 245;\r
-                               }\r
-                               for (; $i <= $nb_lines; $i++) {\r
-                                       $y += $lines[$i];\r
-                                       if (($y - $lasty) > $limit) {\r
-                                               $cesures[$page] = $i;\r
-                                               $y = $lines[$i];\r
-                                               $lasty = $y;\r
-                                               continue 2;\r
-                                       }\r
-                                       if ($i >= $nb_lines) {\r
-                                               break;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               $pages = max(count($cesures), $pages);\r
-\r
-               if (!isset($cesures[$pages - 1])) {\r
-                       $cesures[$pages - 1] = $nb_lines - 1;\r
-               }\r
-\r
-\r
-               $res = array('pages' => $pages, 'cesures' => $cesures);\r
-\r
-               return $res;\r
-       }\r
-\r
-       protected function escape($str) {\r
-               $str = cubeText::removeOddStuff($str);\r
-               $str = utf8_decode($str);\r
-               $str = str_replace(utf8_decode('€'), $this->euro, $str);\r
-               return $str;\r
-       }\r
-\r
-       abstract protected function documentTitre();\r
+    abstract protected function documentTitre();\r
 }\r