FIX - Logo MYCOMPANY

This commit is contained in:
Anthony Berton 2023-01-26 11:01:44 +01:00
parent 890f9120d7
commit d4f7b3e42f

View File

@ -713,6 +713,9 @@ class pdf_standard extends ModelePDFProduct
{
global $conf, $langs, $hookmanager;
$ltrdirection = 'L';
if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R';
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "propal", "companies", "bills", "orders"));
@ -734,28 +737,41 @@ class pdf_standard extends ModelePDFProduct
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);
$w = 100;
$posy = $this->marge_haute;
$posx = $this->page_largeur - $this->marge_droite - 100;
$pdf->SetXY($this->marge_gauche, $posy);
// Logo
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo) {
if (is_readable($logo)) {
$height = pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_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 (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) {
$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($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 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("ErrorGoToGlobalSetup"), 0, 'L');
$text = $this->emetteur->name;
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
}
} else {
$text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
}
$pdf->SetFont('', 'B', $default_font_size + 3);
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);