pdf logo header mutualization (#39503)
* FIX: Restore PHPUnit 11 compatibility in CommonClassTest onNotSuccessfulTest() overrode PHPUnit\Framework\TestCase's method with an incompatible return type (void vs never), and the assertMatchesRegularExpression back-compat shim for PHPUnit <8 now illegally overrides that method, which PHPUnit 11 declares final. Both faults made every test extending CommonClassTest fatal immediately on this environment's PHPUnit 11.5.55. Pre-existing breakage, unrelated to the PDF mutualization work in this branch — fixed here because Task 1's plan requires a passing BuildDocTest.php baseline before any implementer is dispatched. * NEW: Mutualize PDF header logo block into pdf_writeLogoOrCompanyName() (sponge, einstein, azur, muscadet) * NEW: Mutualize PDF header logo block into pdf_writeLogoOrCompanyName() (cornas, standard, cyan, octopus, strato) * FIX: Resolve $logodir before calling pdf_writeLogoOrCompanyName() in cornas, standard, cyan, octopus, strato * NEW: Mutualize PDF header logo block into pdf_writeLogoOrCompanyName() (eratosthene, eagle_proforma, standard_asset) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * NEW: Mutualize PDF header logo block into pdf_writeLogoOrCompanyName() (aurore, zenith) * FIX: Complete PHPUnit 11 compatibility fix in CommonClassTest::onNotSuccessfulTest The prior compatibility fix (f29129aae43) resolved the two class-load fatals but left onNotSuccessfulTest() calling getName()/getDataSetAsString(), neither of which exists on PHPUnit 11's TestCase (renamed to name() and dataSetAsStringWithData()/dataSetAsString()). The undefined-method error was silently absorbed by PHPUnit's own exception handling, so every test failure across the suite still ran and reported correctly, but the method's entire diagnostic block (log tail, backtrace, DB info dump) never executed. Verified with a throwaway reproduction test before and after: the diagnostic ##[group] output was empty before this fix and complete after it. Found during the final whole-branch review of the PDF logo-block mutualization branch; unrelated to that refactor but touches the same file already modified by the earlier compatibility commit. * FIX: Drop unneeded by-ref $pdf and rename $ltrdirection to $align in pdf_writeLogoOrCompanyName() TCPDF objects are handles, so passing $pdf by reference bought nothing and was inconsistent with every sibling function in this file (pdf_pagehead, pdf_watermark, pdf_bank, pdf_pagefoot, ...), all of which take $pdf by value. $ltrdirection was also a misnomer: three of the 14 callers pass the literal 'L' and one passes 'J' (justify) - none of those is a text direction, it's an alignment. Renaming is call-site-transparent (all 14 callers use positional arguments). Found during the final whole-branch review of the PDF logo-block mutualization branch. * NEW: Document pdf_writeLogoOrCompanyName() helper in ChangeLog Per repo convention (CLAUDE.md: "Always update ChangeLog for significant changes"). Flagged during the final whole-branch review of the PDF logo-block mutualization branch: a new reusable pdf_lib.php function is part of the surface third-party PDF document-model modules build against. * restore commonclasstest * fix --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
b7413ee622
commit
1cafc092df
16 changed files with 100 additions and 336 deletions
|
|
@ -189,6 +189,7 @@ NEW: API get country: load region and load states now an option (#37715)
|
|||
NEW: Add MAIN_FORCE_SYSTEM_MESSAGE Renamed hook "info_admin" into "messageOfTheDay"
|
||||
NEW: Category - API - Add type list (#38207)
|
||||
NEW: Add method calculateVATNumberFromProperties()
|
||||
NEW: Add pdf_writeLogoOrCompanyName() helper in pdf.lib.php to mutualize PDF header logo rendering across document generators
|
||||
NEW: Add method dolOutputDates()
|
||||
FIX: Security permission on payment instead of create to create payment with API (credit Santosh Kumar Puppala) in commit ad8cd7c0e1800636302517e42fcdcafa393524b3
|
||||
|
||||
|
|
|
|||
|
|
@ -330,6 +330,47 @@ function pdf_getHeightForLogo($logo, $url = false)
|
|||
return $height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output company logo on top-left of a PDF page header, or the company name as fallback text if no logo is
|
||||
* set, or an error message if the logo file is missing/unreadable. Shared by the page headers of the various
|
||||
* document generators (invoices, orders, proposals, ...).
|
||||
*
|
||||
* @param TCPDF $pdf PDF object
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param Societe $emetteur Emitting company (the PDF generator's $this->emetteur)
|
||||
* @param string $logodir Directory containing the logos subfolder (already resolved by the caller)
|
||||
* @param float $posx X position to place the logo image
|
||||
* @param float $posy Y position to place the logo image
|
||||
* @param float $w Cell width used for the fallback company name / error message text
|
||||
* @param float $default_font_size Default font size (used to size the error message font)
|
||||
* @param string $align Alignment ('L', 'R', or 'J') for the fallback company name text
|
||||
* @return void
|
||||
*/
|
||||
function pdf_writeLogoOrCompanyName($pdf, $outputlangs, $emetteur, $logodir, $posx, $posy, $w, $default_font_size, $align)
|
||||
{
|
||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($emetteur->logo) {
|
||||
if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) {
|
||||
$logo = $logodir.'/logos/thumbs/'.$emetteur->logo_small;
|
||||
} else {
|
||||
$logo = $logodir.'/logos/'.$emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo)) {
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, $posx, $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 {
|
||||
$text = (string) $emetteur->name;
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $align);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to try to calculate height of a HTML Content.
|
||||
* WARNING: Do not use this function inside a TCPDF transaction.
|
||||
|
|
|
|||
|
|
@ -818,31 +818,11 @@ class pdf_standard_asset extends ModelePDFAsset
|
|||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->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 {
|
||||
$text = (string) $this->emetteur->name;
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
}
|
||||
}
|
||||
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, $w, $default_font_size, 'L');
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
$pdf->SetXY($posx, $posy);
|
||||
|
|
|
|||
|
|
@ -1374,31 +1374,11 @@ class pdf_einstein extends ModelePDFCommandes
|
|||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->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 {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
|
||||
}
|
||||
}
|
||||
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, $w, $default_font_size, $ltrdirection);
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
$pdf->SetXY($posx, $posy);
|
||||
|
|
|
|||
|
|
@ -1641,31 +1641,12 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty(getMultidirOutput($mysoc, 'mycompany'))) {
|
||||
$logodir = getMultidirOutput($mysoc, 'mycompany');
|
||||
}
|
||||
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 {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
}
|
||||
$multidiroutput = getMultidirOutput($mysoc, 'mycompany');
|
||||
if (!empty($multidiroutput)) {
|
||||
$logodir = $multidiroutput;
|
||||
}
|
||||
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, $w, $default_font_size, 'L');
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
$pdf->SetXY($posx, $posy);
|
||||
|
|
|
|||
|
|
@ -674,31 +674,12 @@ class pdf_strato extends ModelePDFContract
|
|||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
if (!getDolGlobalString('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (getMultidirOutput($object, 'mycompany')) {
|
||||
$logodir = getMultidirOutput($object, 'mycompany');
|
||||
}
|
||||
if (!getDolGlobalString('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 {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
|
||||
}
|
||||
$multidiroutput = getMultidirOutput($object, 'mycompany');
|
||||
if (!empty($multidiroutput)) {
|
||||
$logodir = $multidiroutput;
|
||||
}
|
||||
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, $w, $default_font_size, $ltrdirection);
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
$pdf->SetXY($posx, $posy);
|
||||
|
|
|
|||
|
|
@ -2026,31 +2026,11 @@ class pdf_octopus extends ModelePDFFactures
|
|||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->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 {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
|
||||
}
|
||||
}
|
||||
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, $w, $default_font_size, $ltrdirection);
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
$pdf->SetXY($posx, $posy);
|
||||
|
|
|
|||
|
|
@ -2231,31 +2231,11 @@ class pdf_sponge extends ModelePDFFactures
|
|||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->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 {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
|
||||
}
|
||||
}
|
||||
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, $w, $default_font_size, $ltrdirection);
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
$pdf->SetXY($posx, $posy);
|
||||
|
|
|
|||
|
|
@ -756,31 +756,11 @@ class pdf_standard extends ModelePDFProduct
|
|||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->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 {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
|
||||
}
|
||||
}
|
||||
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, $w, $default_font_size, $ltrdirection);
|
||||
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
|
|
|
|||
|
|
@ -1582,31 +1582,11 @@ class pdf_azur extends ModelePDFPropales
|
|||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->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 {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
|
||||
}
|
||||
}
|
||||
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, $w, $default_font_size, $ltrdirection);
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
$pdf->SetXY($posx, $posy);
|
||||
|
|
|
|||
|
|
@ -1726,31 +1726,11 @@ class pdf_cyan extends ModelePDFPropales
|
|||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->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 {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
|
||||
}
|
||||
}
|
||||
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, $w, $default_font_size, $ltrdirection);
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
$pdf->SetXY($posx, $posy);
|
||||
|
|
|
|||
|
|
@ -1225,31 +1225,11 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer
|
|||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->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 {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
}
|
||||
}
|
||||
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, $w, $default_font_size, 'L');
|
||||
|
||||
$pdf->SetDrawColor(128, 128, 128);
|
||||
|
||||
|
|
|
|||
|
|
@ -1265,31 +1265,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
|||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->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 {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
|
||||
}
|
||||
}
|
||||
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, $w, $default_font_size, $ltrdirection);
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
$pdf->SetXY($posx, $posy);
|
||||
|
|
|
|||
|
|
@ -1133,31 +1133,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
|||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->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 {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
|
||||
}
|
||||
}
|
||||
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, $w, $default_font_size, $ltrdirection);
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
$pdf->SetXY($posx, $posy);
|
||||
|
|
|
|||
|
|
@ -1228,31 +1228,11 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->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(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);
|
||||
}
|
||||
}
|
||||
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, 100, $default_font_size, 'J');
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
$pdf->SetXY($posx, $posy);
|
||||
|
|
|
|||
|
|
@ -1244,31 +1244,11 @@ class pdf_zenith extends ModelePDFSupplierProposal
|
|||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->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(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, $ltrdirection);
|
||||
}
|
||||
}
|
||||
pdf_writeLogoOrCompanyName($pdf, $outputlangs, $this->emetteur, $logodir, $this->marge_gauche, $posy, 100, $default_font_size, $ltrdirection);
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
$pdf->SetXY($posx, $posy);
|
||||
|
|
|
|||
Loading…
Reference in a new issue