Merge pull request #20206 from fappels/15_fix_product_photo_on_cornas_model

FIX: Show product photo on Supplier order Cornas model.
This commit is contained in:
Laurent Destailleur 2022-02-28 21:03:20 +01:00 committed by GitHub
commit 253622acf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -546,14 +546,13 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$posYAfterDescription = 0; $posYAfterDescription = 0;
// We start with Photo of product line // We start with Photo of product line
if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page 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 + $heightforinfotot))) { // If photo too high, we moved completely on new page
$pdf->AddPage('', '', true); $pdf->AddPage('', '', true);
if (!empty($tplidx)) { if (!empty($tplidx)) {
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
$pdf->setPage($pageposbefore + 1); $pdf->setPage($pageposbefore + 1);
$curY = $tab_top_newpage; $curY = $tab_top_newpage;
@ -566,12 +565,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders
} }
} }
if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) { if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) {
$curX = $this->posxpicture - 1; $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
$pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
// $pdf->Image does not increase value return by getY, so we save it manually // $pdf->Image does not increase value return by getY, so we save it manually
$posYAfterImage = $curY + $imglinesize['height']; $posYAfterImage = $curY + $imglinesize['height'];
} }
}
// Description of product line // Description of product line
$curX = $this->posxdesc - 1; $curX = $this->posxdesc - 1;
$showpricebeforepagebreak = 1; $showpricebeforepagebreak = 1;