NEW Add option PDF_DISABLE_MYCOMPANY_LOGO to disable logo on PDF

This commit is contained in:
Laurent Destailleur 2018-10-22 20:06:03 +02:00
parent 2816bdf747
commit f65df9e541
6 changed files with 390 additions and 372 deletions

View File

@ -1261,27 +1261,30 @@ class pdf_einstein extends ModelePDFCommandes
$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 (is_readable($logo)) $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{ {
$height=pdf_getHeightForLogo($logo); if (is_readable($logo))
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) {
$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("ErrorGoToGlobalSetup"), 0, 'L');
}
} }
else else
{ {
$pdf->SetTextColor(200,0,0); $text=$this->emetteur->name;
$pdf->SetFont('','B', $default_font_size -2); $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 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);
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);

View File

@ -1281,27 +1281,30 @@ class pdf_eratosthene extends ModelePDFCommandes
$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 (is_readable($logo)) $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{ {
$height=pdf_getHeightForLogo($logo); if (is_readable($logo))
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) {
$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("ErrorGoToGlobalSetup"), 0, 'L');
}
} }
else else
{ {
$pdf->SetTextColor(200,0,0); $text=$this->emetteur->name;
$pdf->SetFont('','B', $default_font_size -2); $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 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);
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);

View File

@ -1598,27 +1598,30 @@ class pdf_crabe extends ModelePDFFactures
$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 (is_readable($logo)) $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{ {
$height=pdf_getHeightForLogo($logo); if (is_readable($logo))
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) {
$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 else
{ {
$pdf->SetTextColor(200,0,0); $text=$this->emetteur->name;
$pdf->SetFont('','B',$default_font_size - 2); $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
} }
} }
else
{
$text=$this->emetteur->name;
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
}
$pdf->SetFont('','B', $default_font_size + 3); $pdf->SetFont('','B', $default_font_size + 3);
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);

View File

@ -1573,27 +1573,30 @@ class pdf_sponge extends ModelePDFFactures
$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 (is_readable($logo)) $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{ {
$height=pdf_getHeightForLogo($logo); if (is_readable($logo))
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) {
$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 else
{ {
$pdf->SetTextColor(200,0,0); $text=$this->emetteur->name;
$pdf->SetFont('','B',$default_font_size - 2); $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
} }
} }
else
{
$text=$this->emetteur->name;
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
}
$pdf->SetFont('','B', $default_font_size + 3); $pdf->SetFont('','B', $default_font_size + 3);
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);

View File

@ -1463,27 +1463,30 @@ class pdf_azur extends ModelePDFPropales
$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 (is_readable($logo)) $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{ {
$height=pdf_getHeightForLogo($logo); if (is_readable($logo))
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) {
$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("ErrorGoToGlobalSetup"), 0, 'L');
}
} }
else else
{ {
$pdf->SetTextColor(200,0,0); $text=$this->emetteur->name;
$pdf->SetFont('','B',$default_font_size - 2); $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 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);
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);

View File

@ -1451,27 +1451,30 @@ class pdf_cyan extends ModelePDFPropales
$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 (is_readable($logo)) $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{ {
$height=pdf_getHeightForLogo($logo); if (is_readable($logo))
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) {
$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("ErrorGoToGlobalSetup"), 0, 'L');
}
} }
else else
{ {
$pdf->SetTextColor(200,0,0); $text=$this->emetteur->name;
$pdf->SetFont('','B',$default_font_size - 2); $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 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);
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);