Qual: Some changes to use more efficiently bottom of page when there is
several pages (we don't keep space for total on all pages, but only last one)
This commit is contained in:
parent
54852e29e7
commit
08724f5ec0
@ -279,7 +279,40 @@ class pdf_azur extends ModelePDFPropales
|
||||
|
||||
// Description of product line
|
||||
$curX = $this->posxdesc-1;
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
|
||||
|
||||
$showpricebeforepagebreak=1;
|
||||
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
|
||||
$pageposafter=$pdf->getPage();
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter=$pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
|
||||
$pageposafter=$pdf->getPage();
|
||||
if ($pageposafter == $pageposbefore) // There is no pagebreak after second try with small margin
|
||||
{
|
||||
if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page
|
||||
{
|
||||
$pdf->AddPage('','',true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
|
||||
$pdf->setPage($pagenb+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We found a page break
|
||||
$showpricebeforepagebreak=0;
|
||||
}
|
||||
}
|
||||
else // No pagebreak
|
||||
{
|
||||
$pdf->commitTransaction();
|
||||
}
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
$pageposafter=$pdf->getPage();
|
||||
@ -288,7 +321,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
|
||||
// We suppose that a too long description is moved completely on next page
|
||||
if ($pageposafter > $pageposbefore) {
|
||||
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
|
||||
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user