Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions htdocs/core/modules/propale/doc/pdf_cyan.modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down Expand Up @@ -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();
Expand All @@ -636,6 +627,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede
}

$nexY = $pdf->GetY();
$nexYAfterDesc = $nexY;
$pageposafter = $pdf->getPage();

$pdf->setPage($pageposbefore);
Expand Down Expand Up @@ -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,
Expand Down
Loading