From 266e14aeb1e7678656c51c07d2d8c50caca3f049 Mon Sep 17 00:00:00 2001 From: atm-jonathan Date: Thu, 28 May 2026 16:11:01 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20prix=20align=C3=A9s=20sur=20la=20premi?= =?UTF-8?q?=C3=A8re=20ligne=20de=20la=20d=C3=A9signation=20dans=20le=20mod?= =?UTF-8?q?=C3=A8le=20cyan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quand la description d'une ligne enjambe deux pages, les prix (TVA, P.U. HT, Qté, Total HT) apparaissaient en face de la fin de la description au lieu du début. Correction du calcul de $nexY inter-pages et du seuil de détection de zone de pied de page. Co-Authored-By: Claude Sonnet 4.6 --- .../modules/propale/doc/pdf_cyan.modules.php | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 9001cb900c080..c5b6e245d17d4 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -579,12 +579,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $curY = $tab_top_newpage; - // Allows data in the first page if description is long enough to break in multiples pages - if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { - $showpricebeforepagebreak = 1; - } else { - $showpricebeforepagebreak = 0; - } + $showpricebeforepagebreak = 1; } @@ -622,12 +617,8 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } } else { // We found a page break that was done automatically and there is ow enough space for total+free text+footer. - // Allows data in the first page if description is long enough to break in multiples pages - if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { - $showpricebeforepagebreak = 1; - } else { - $showpricebeforepagebreak = 0; - } + // Keep prices on starting page unless curY is too close to the physical footer boundary + $showpricebeforepagebreak = ($curY < ($this->page_hauteur - $heightforfooter - 5)) ? 1 : 0; } } else { // No pagebreak $pdf->commitTransaction(); @@ -636,6 +627,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } $nexY = $pdf->GetY(); + $nexYAfterDesc = $nexY; $pageposafter = $pdf->getPage(); $pdf->setPage($pageposbefore); @@ -717,6 +709,12 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } } + // Restore nexY from the correct page when prices were printed on a previous page + if ($pageposafter > $pageposbefore && !empty($showpricebeforepagebreak)) { + $nexY = $nexYAfterDesc; + $pdf->setPage($pageposafter); + } + $parameters = array( 'object' => $object, 'i' => $i,