FIX Company logo not found in some cases on some templates

This commit is contained in:
Laurent Destailleur 2022-01-22 13:19:29 +01:00
parent 22a3b5ea78
commit 284fcf3ad5
3 changed files with 66 additions and 36 deletions

View File

@ -1245,8 +1245,17 @@ 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 (!empty($conf->mycompany->multidir_output[$object->entity])) {
$logodir = $conf->mycompany->multidir_output[$object->entity];
}
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
} else {
$logo = $logodir.'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo)) { if (is_readable($logo)) {
$height = pdf_getHeightForLogo($logo); $height = pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
@ -1254,12 +1263,13 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->SetTextColor(200, 0, 0); $pdf->SetTextColor(200, 0, 0);
$pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
} }
} else { } else {
$text = $this->emetteur->name; $text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection); $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
} }
}
$pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetFont('', 'B', $default_font_size + 3);
$pdf->SetXY($posx, $posy); $pdf->SetXY($posx, $posy);

View File

@ -1153,8 +1153,17 @@ 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 (!empty($conf->mycompany->multidir_output[$object->entity])) {
$logodir = $conf->mycompany->multidir_output[$object->entity];
}
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
} else {
$logo = $logodir.'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo)) { if (is_readable($logo)) {
$height = pdf_getHeightForLogo($logo); $height = pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
@ -1162,12 +1171,13 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetTextColor(200, 0, 0); $pdf->SetTextColor(200, 0, 0);
$pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
} }
} else { } else {
$text = $this->emetteur->name; $text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection); $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
} }
}
$pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetFont('', 'B', $default_font_size + 3);
$pdf->SetXY($posx, $posy); $pdf->SetXY($posx, $posy);

View File

@ -1290,8 +1290,17 @@ class pdf_aurore extends ModelePDFSupplierProposal
$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 (!empty($conf->mycompany->multidir_output[$object->entity])) {
$logodir = $conf->mycompany->multidir_output[$object->entity];
}
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
} else {
$logo = $logodir.'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo)) { if (is_readable($logo)) {
$height = pdf_getHeightForLogo($logo); $height = pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
@ -1303,7 +1312,8 @@ class pdf_aurore extends ModelePDFSupplierProposal
} }
} else { } else {
$text = $this->emetteur->name; $text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
}
} }
$pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetFont('', 'B', $default_font_size + 3);