Fix: Bad detection of space left

This commit is contained in:
Laurent Destailleur
2012-10-31 15:21:21 +01:00
parent 34eae83bcc
commit 18e5f8dea6
3 changed files with 8 additions and 5 deletions

View File

@@ -280,7 +280,7 @@ class pdf_einstein extends ModelePDFCommandes
// Description of product line // Description of product line
$curX = $this->posxdesc-1; $curX = $this->posxdesc-1;
$showpricebeforepagebreak=1; $showpricebeforepagebreak=1;
$pdf->startTransaction(); $pdf->startTransaction();
@@ -293,8 +293,8 @@ class pdf_einstein extends ModelePDFCommandes
//print $pageposafter.'-'.$pageposbefore;exit; //print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $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); pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
$pageposafter=$pdf->getPage(); $posyafter=$pdf->GetY();
if ($pageposafter == $pageposbefore) // There is no pagebreak after second try with small margin if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
{ {
if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page
{ {

View File

@@ -294,7 +294,9 @@ class pdf_crabe extends ModelePDFFactures
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $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); pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
if ($pageposafter == $pageposbefore) // There is no pagebreak after second try with small margin $posyafter=$pdf->GetY();
//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
{ {
if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page
{ {

View File

@@ -292,7 +292,8 @@ class pdf_azur extends ModelePDFPropales
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $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); pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
if ($pageposafter == $pageposbefore) // There is no pagebreak after second try with small margin $posyafter=$pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
{ {
if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page
{ {