FIX When PDF_ADD_POSITION is on, the number was doing pagebreak before
the pagebreak done by the addition of description.
This commit is contained in:
parent
6c98c52d85
commit
3eebba6116
1 changed files with 11 additions and 10 deletions
|
|
@ -568,10 +568,6 @@ class pdf_cyan extends ModelePDFPropales
|
|||
$posYAfterImage = 0;
|
||||
$posYAfterDescription = 0;
|
||||
|
||||
if ($this->getColumnStatus('position')) {
|
||||
$this->printStdColumnContent($pdf, $curY, 'position', $i + 1);
|
||||
}
|
||||
|
||||
if ($this->getColumnStatus('photo')) {
|
||||
// We start with Photo of product line
|
||||
if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // If photo too high, we moved completely on new page
|
||||
|
|
@ -606,18 +602,18 @@ class pdf_cyan extends ModelePDFPropales
|
|||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
$pageposafter = $pdf->getPage();
|
||||
|
||||
if ($pageposafter > $pageposbefore) { // There is a pagebreak
|
||||
if ($pageposafter > $pageposbefore) { // There is a pagebreak (not enough space for total+free text+footer)
|
||||
$pdf->rollbackTransaction(true);
|
||||
|
||||
$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 to simple footer, so we can retry as if we have just the simple footer.
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // There is no space left for total+free text
|
||||
if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // There is no space left for total+free text but no page break.
|
||||
if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page manually because no break page was done automatically for the last part.
|
||||
$pdf->AddPage('', '', true);
|
||||
if (!empty($tplidx)) {
|
||||
$pdf->useTemplate($tplidx);
|
||||
|
|
@ -625,7 +621,7 @@ class pdf_cyan extends ModelePDFPropales
|
|||
$pdf->setPage($pageposafter + 1);
|
||||
}
|
||||
} else {
|
||||
// We found a page break
|
||||
// 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;
|
||||
|
|
@ -646,7 +642,7 @@ class pdf_cyan extends ModelePDFPropales
|
|||
$pdf->setTopMargin($this->marge_haute);
|
||||
$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 or photo were moved completely on next page
|
||||
// We suppose that a too long description or photo were moved completely on next page, so we set the value for $curY and current page that will be used by the following output.
|
||||
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
|
||||
$pdf->setPage($pageposafter);
|
||||
$curY = $tab_top_newpage;
|
||||
|
|
@ -654,6 +650,11 @@ class pdf_cyan extends ModelePDFPropales
|
|||
|
||||
$pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font
|
||||
|
||||
// Position
|
||||
if ($this->getColumnStatus('position')) {
|
||||
$this->printStdColumnContent($pdf, $curY, 'position', $i + 1);
|
||||
}
|
||||
|
||||
// VAT Rate
|
||||
if ($this->getColumnStatus('vat')) {
|
||||
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
|
||||
|
|
|
|||
Loading…
Reference in a new issue