Merge pull request #20064 from ATM-Consulting/FIX_uniformize_pdf_logo_behaviour

Fix uniformize pdf logo behaviour for supplier orders
This commit is contained in:
Laurent Destailleur 2022-02-16 21:09:45 +01:00 committed by GitHub
commit 92cb95a184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 38 deletions

View File

@ -1235,26 +1235,30 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->SetXY($this->marge_gauche, $posy); $pdf->SetXY($this->marge_gauche, $posy);
// Logo // Logo
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) {
if ($this->emetteur->logo) if ($this->emetteur->logo) {
{ $logodir = $conf->mycompany->dir_output;
if (is_readable($logo)) if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
{ if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
$height = pdf_getHeightForLogo($logo); {
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
}
else {
$logo = $logodir.'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo)) {
$height = pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
} else {
$pdf->SetTextColor(200, 0, 0);
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
}
} else {
$text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
} }
else
{
$pdf->SetTextColor(200, 0, 0);
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
}
}
else
{
$text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
} }
$pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetFont('', 'B', $default_font_size + 3);

View File

@ -1151,26 +1151,28 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetXY($this->marge_gauche, $posy); $pdf->SetXY($this->marge_gauche, $posy);
// Logo // Logo
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) {
if ($this->emetteur->logo) if ($this->emetteur->logo) {
{ $logodir = $conf->mycompany->dir_output;
if (is_readable($logo)) if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
{ if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
$height = pdf_getHeightForLogo($logo); $logo = $logodir . '/logos/thumbs/' . $this->emetteur->logo_small;
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } else {
$logo = $logodir . '/logos/' . $this->emetteur->logo;
}
if (is_readable($logo)) {
$height = pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
} else {
$pdf->SetTextColor(200, 0, 0);
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
}
} else {
$text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
} }
else
{
$pdf->SetTextColor(200, 0, 0);
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
}
}
else
{
$text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
} }
$pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetFont('', 'B', $default_font_size + 3);