--- /tmp/dsg/dolibarr/htdocs/core/modules/contract/doc/github_doc_generic_contract_odt.modules.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/contract/doc/client_doc_generic_contract_odt.modules.php
@@ -45,15 +45,15 @@
public $emetteur;
/**
- * @var array Minimum version of PHP required by module.
- * e.g.: PHP ≥ 5.6 = array(5, 6)
- */
- public $phpmin = array(5, 6);
+ * @var array Minimum version of PHP required by module.
+ * e.g.: PHP ≥ 5.5 = array(5, 5)
+ */
+ public $phpmin = array(5, 5);
/**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr';
@@ -67,7 +67,7 @@
global $conf, $langs, $mysoc;
// Load translation files required by the page
- $langs->loadLangs(array("main", "companies"));
+ $langs->loadLangs(array("main", "companies"));
$this->db = $db;
$this->name = "ODT templates";
@@ -112,7 +112,7 @@
global $conf, $langs;
// Load translation files required by the page
- $langs->loadLangs(array('companies', 'errors'));
+ $langs->loadLangs(array('companies', 'errors'));
$form = new Form($this->db);
@@ -136,7 +136,8 @@
unset($listofdir[$key]); continue;
}
if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
- else {
+ else
+ {
$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles);
}
@@ -165,7 +166,7 @@
$texte .= '
'.$langs->trans("UploadNewTemplate").' ';
$texte .= '';
$texte .= '';
- $texte .= '
';
+ $texte .= '';
$texte .= '';
@@ -180,7 +181,7 @@
return $texte;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@@ -194,7 +195,7 @@
*/
public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
- // phpcs:enable
+ // phpcs:enable
global $user, $langs, $conf, $mysoc, $hookmanager;
if (empty($srctemplatepath))
@@ -219,7 +220,7 @@
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
- if ($conf->contrat->multidir_output[$object->entity])
+ if ($conf->contrat->dir_output)
{
// If $object is id instead of object
if (!is_object($object))
@@ -234,9 +235,7 @@
}
}
- $object->fetch_thirdparty();
-
- $dir = $conf->contrat->multidir_output[$object->entity];
+ $dir = $conf->contrat->dir_output;
$objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
$file = $dir."/".$objectref.".odt";
@@ -264,10 +263,12 @@
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (!empty($conf->global->MAIN_DOC_USE_TIMING))
{
- $format = $conf->global->MAIN_DOC_USE_TIMING;
- if ($format == '1') $format = '%Y%m%d%H%M%S';
+ $format = $conf->global->MAIN_DOC_USE_TIMING;
+ if ($format == '1') $format = '%Y%m%d%H%M%S';
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
- } else {
+ }
+ else
+ {
$filename = $newfiletmp.'.'.$newfileformat;
}
$file = $dir.'/'.$filename;
@@ -290,15 +291,18 @@
// Recipient name
$contactobject = null;
- if (!empty($usecontact)) {
- if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
- $socobject = $object->contact;
- } else {
- $socobject = $object->thirdparty;
- // if we have a CUSTOMER contact and we dont use as recipient we store the contact object for later use
- $contactobject = $object->contact;
- }
- } else {
+ if (!empty($usecontact)) {
+ // On peut utiliser le nom de la societe du contact
+ if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
+ $socobject = $object->contact;
+ } else {
+ $socobject = $object->thirdparty;
+ // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
+ $contactobject = $object->contact;
+ }
+ }
+ else
+ {
$socobject = $object->thirdparty;
}
@@ -338,7 +342,7 @@
// Open and load template
require_once ODTPHP_PATH.'odf.php';
try {
- $odfHandler = new odf(
+ $odfHandler = new odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->contrat->dir_temp,
@@ -347,7 +351,8 @@
'DELIMITER_RIGHT' => '}'
)
);
- } catch (Exception $e)
+ }
+ catch (Exception $e)
{
$this->error = $e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
@@ -363,7 +368,8 @@
// Make substitutions into odt of freetext
try {
$odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
- } catch (OdfException $e)
+ }
+ catch (OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
@@ -375,22 +381,26 @@
{
if (file_exists($value)) $odfHandler->setImage($key, $value);
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
- } else // Text
+ }
+ else // Text
{
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
- } catch (OdfException $e)
+ }
+ catch (OdfException $e)
{
- dol_syslog($e->getMessage(), LOG_INFO);
+ dol_syslog($e->getMessage(), LOG_INFO);
}
}
// Replace tags of lines
- try {
+ try
+ {
$foundtagforlines = 1;
try {
$listlines = $odfHandler->setSegment('lines');
- } catch (OdfException $e)
+ }
+ catch (OdfException $e)
{
// We may arrive here if tags for lines not present into template
$foundtagforlines = 0;
@@ -409,12 +419,15 @@
$reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
foreach ($tmparray as $key => $val)
{
- try {
+ try
+ {
$listlines->setVars($key, $val, true, 'UTF-8');
- } catch (OdfException $e)
+ }
+ catch (OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
- } catch (SegmentException $e)
+ }
+ catch (SegmentException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
@@ -423,7 +436,8 @@
}
$odfHandler->mergeSegment($listlines);
}
- } catch (OdfException $e)
+ }
+ catch (OdfException $e)
{
$this->error = $e->getMessage();
dol_syslog($this->error, LOG_WARNING);
@@ -436,9 +450,10 @@
{
try {
$odfHandler->setVars($key, $value, true, 'UTF-8');
- } catch (OdfException $e)
+ }
+ catch (OdfException $e)
{
- dol_syslog($e->getMessage(), LOG_INFO);
+ dol_syslog($e->getMessage(), LOG_INFO);
}
}
@@ -454,9 +469,10 @@
$this->error = $e->getMessage();
return -1;
}
- } else {
+ }
+ else {
try {
- $odfHandler->saveToDisk($file);
+ $odfHandler->saveToDisk($file);
} catch (Exception $e) {
$this->error = $e->getMessage();
return -1;
@@ -473,7 +489,9 @@
$this->result = array('fullpath'=>$file);
return 1; // Success
- } else {
+ }
+ else
+ {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return -1;
}
--- /tmp/dsg/dolibarr/htdocs/core/modules/contract/doc/github_pdf_strato.modules.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/contract/doc/client_pdf_strato.modules.php
@@ -4,9 +4,9 @@
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2008 Raphael Bertrand (Resultic)
* Copyright (C) 2011 Fabrice CHERRIER
- * Copyright (C) 2013-2020 Philippe Grand
+ * Copyright (C) 2013-2019 Philippe Grand
* Copyright (C) 2015 Marcos García
- * Copyright (C) 2018-2020 Frédéric France
+ * Copyright (C) 2018 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -41,70 +41,70 @@
class pdf_strato extends ModelePDFContract
{
/**
- * @var DoliDb Database handler
- */
- public $db;
-
- /**
- * @var string model name
- */
- public $name;
-
- /**
- * @var string model description (short text)
- */
- public $description;
-
- /**
- * @var string document type
- */
- public $type;
-
- /**
- * @var array Minimum version of PHP required by module.
- * e.g.: PHP ≥ 5.6 = array(5, 6)
- */
- public $phpmin = array(5, 6);
-
- /**
- * Dolibarr version of the loaded document
- * @var string
- */
+ * @var DoliDb Database handler
+ */
+ public $db;
+
+ /**
+ * @var string model name
+ */
+ public $name;
+
+ /**
+ * @var string model description (short text)
+ */
+ public $description;
+
+ /**
+ * @var string document type
+ */
+ public $type;
+
+ /**
+ * @var array Minimum version of PHP required by module.
+ * e.g.: PHP ≥ 5.5 = array(5, 5)
+ */
+ public $phpmin = array(5, 5);
+
+ /**
+ * Dolibarr version of the loaded document
+ * @var string
+ */
public $version = 'dolibarr';
/**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
+ * @var int page_largeur
+ */
+ public $page_largeur;
+
+ /**
+ * @var int page_hauteur
+ */
+ public $page_hauteur;
+
+ /**
+ * @var array format
+ */
+ public $format;
+
+ /**
+ * @var int marge_gauche
+ */
public $marge_gauche;
/**
- * @var int marge_droite
- */
+ * @var int marge_droite
+ */
public $marge_droite;
/**
- * @var int marge_haute
- */
+ * @var int marge_haute
+ */
public $marge_haute;
/**
- * @var int marge_basse
- */
+ * @var int marge_basse
+ */
public $marge_basse;
/**
@@ -160,21 +160,21 @@
$this->posxdesc = $this->marge_gauche + 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
- /**
- * Function to build pdf onto disk
- *
- * @param Contrat $object Object to generate
- * @param Translate $outputlangs Lang output object
- * @param string $srctemplatepath Full path of source filename for generator using a template file
- * @param int $hidedetails Do not show line details
- * @param int $hidedesc Do not show desc
- * @param int $hideref Do not show ref
- * @return int 1=OK, 0=KO
- */
- public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
- {
- // phpcs:enable
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Function to build pdf onto disk
+ *
+ * @param CommonObject $object Id of object to generate
+ * @param object $outputlangs Lang output object
+ * @param string $srctemplatepath Full path of source filename for generator using a template file
+ * @param int $hidedetails Do not show line details
+ * @param int $hidedesc Do not show desc
+ * @param int $hideref Do not show ref
+ * @return int 1=OK, 0=KO
+ */
+ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ {
+ // phpcs:enable
global $user, $langs, $conf, $hookmanager, $mysoc;
if (!is_object($outputlangs)) $outputlangs = $langs;
@@ -186,16 +186,18 @@
if ($conf->contrat->dir_output)
{
- $object->fetch_thirdparty();
+ $object->fetch_thirdparty();
// Definition of $dir and $file
if ($object->specimen)
{
$dir = $conf->contrat->dir_output;
$file = $dir."/SPECIMEN.pdf";
- } else {
+ }
+ else
+ {
$objectref = dol_sanitizeFileName($object->ref);
- $dir = $conf->contrat->multidir_output[$object->entity]."/".$objectref;
+ $dir = $conf->contrat->dir_output."/".$objectref;
$file = $dir."/".$objectref.".pdf";
}
@@ -221,26 +223,26 @@
global $action;
$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
- $pdf = pdf_getInstance($this->format);
- $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
- $heightforinfotot = 50; // Height reserved to output the info and total part
- $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
- $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
- if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
- $pdf->SetAutoPageBreak(1, 0);
-
- if (class_exists('TCPDF'))
- {
- $pdf->setPrintHeader(false);
- $pdf->setPrintFooter(false);
- }
- $pdf->SetFont(pdf_getPDFFont($outputlangs));
- // Set path to the background PDF File
- if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
- {
- $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
- $tplidx = $pdf->importPage(1);
- }
+ $pdf = pdf_getInstance($this->format);
+ $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
+ $heightforinfotot = 50; // Height reserved to output the info and total part
+ $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
+ $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
+ if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
+ $pdf->SetAutoPageBreak(1, 0);
+
+ if (class_exists('TCPDF'))
+ {
+ $pdf->setPrintHeader(false);
+ $pdf->setPrintFooter(false);
+ }
+ $pdf->SetFont(pdf_getPDFFont($outputlangs));
+ // Set path to the background PDF File
+ if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
+ {
+ $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
+ $tplidx = $pdf->importPage(1);
+ }
$pdf->Open();
$pagenb = 0;
@@ -340,7 +342,8 @@
$datere = $langs->trans("Unknown");
}
- $txtpredefinedservice = $objectligne->product_ref;
+ $txtpredefinedservice = '';
+ $txtpredefinedservice = $objectligne->product_label;
if ($objectligne->product_label)
{
$txtpredefinedservice .= ' - ';
@@ -358,7 +361,7 @@
if (empty($conf->global->CONTRACT_HIDE_REAL_DATE_ON_PDF))
{
$txt .= '
';
- $txt .= $outputlangs->transnoentities("DateStartRealShort")." : ".$daters.'';
+ $txt .= $outputlangs->transnoentities("DateStartRealShort")." : ".$daters.'';
if ($objectligne->date_cloture) $txt .= " - ".$outputlangs->transnoentities("DateEndRealShort")." : ''".$datere.'';
}
@@ -384,15 +387,19 @@
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter + 1);
}
- } else {
+ }
+ else
+ {
// We found a page break
// Allows data in the first page if description is long enough to break in multiples pages
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
$showpricebeforepagebreak = 1;
- else $showpricebeforepagebreak = 0;
+ else
+ $showpricebeforepagebreak = 0;
}
- } else // No pagebreak
+ }
+ else // No pagebreak
{
$pdf->commitTransaction();
}
@@ -418,7 +425,9 @@
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext, 0, $outputlangs, 0, 1);
- } else {
+ }
+ else
+ {
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforfreetext, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf, $object, $outputlangs, 1);
@@ -432,7 +441,9 @@
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext, 0, $outputlangs, 0, 1);
- } else {
+ }
+ else
+ {
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforfreetext, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf, $object, $outputlangs, 1);
@@ -450,7 +461,9 @@
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$this->tabSignature($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, $outputlangs);
$bottomlasttab = $this->page_hauteur - $heightforfooter - $heightforfooter + 1;
- } else {
+ }
+ else
+ {
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$this->tabSignature($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, $outputlangs);
$bottomlasttab = $this->page_hauteur - $heightforfooter - $heightforfooter + 1;
@@ -475,8 +488,8 @@
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
- $this->error = $hookmanager->error;
- $this->errors = $hookmanager->errors;
+ $this->error = $hookmanager->error;
+ $this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK))
@@ -485,11 +498,15 @@
$this->result = array('fullpath'=>$file);
return 1;
- } else {
+ }
+ else
+ {
$this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
return 0;
}
- } else {
+ }
+ else
+ {
$this->error = $langs->trans("ErrorConstantNotDefined", "CONTRACT_OUTPUTDIR");
return 0;
}
@@ -499,7 +516,7 @@
/**
* Show table for lines
*
- * @param TCPDF $pdf Object PDF
+ * @param PDF $pdf Object PDF
* @param string $tab_top Top position of table
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
@@ -517,7 +534,7 @@
if ($hidetop) $hidetop = -1;
$default_font_size = pdf_getPDFFontSize($outputlangs);
- /*
+ /*
$pdf->SetXY($this->marge_gauche, $tab_top);
$pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0);
$pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8);
@@ -547,16 +564,16 @@
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height + 3); // Rect takes a length in 3rd parameter and 4th parameter
}
- /**
- * Show footer signature of page
- * @param TCPDF $pdf Object PDF
- * @param int $tab_top tab height position
- * @param int $tab_height tab height
- * @param Translate $outputlangs Object language for output
- * @return void
- */
+ /**
+ * Show footer signature of page
+ * @param PDF $pdf Object PDF
+ * @param int $tab_top tab height position
+ * @param int $tab_height tab height
+ * @param Translate $outputlangs Object language for output
+ * @return void
+ */
protected function tabSignature(&$pdf, $tab_top, $tab_height, $outputlangs)
- {
+ {
$pdf->SetDrawColor(128, 128, 128);
$posmiddle = $this->marge_gauche + round(($this->page_largeur - $this->marge_gauche - $this->marge_droite) / 2);
$posy = $tab_top + $tab_height + 3 + 3;
@@ -572,20 +589,20 @@
$pdf->SetXY($posmiddle + 5, $posy + 5);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $posmiddle - 5, 20, '', 1);
- }
+ }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
- /**
- * Show top header of page.
- *
- * @param TCPDF $pdf Object PDF
- * @param Contrat $object Object to show
- * @param int $showaddress 0=no, 1=yes
- * @param Translate $outputlangs Object lang for output
- * @return void
- */
+ /**
+ * Show top header of page.
+ *
+ * @param PDF $pdf Object PDF
+ * @param CommonObject $object Object to show
+ * @param int $showaddress 0=no, 1=yes
+ * @param Translate $outputlangs Object lang for output
+ * @return void
+ */
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
- {
+ {
global $conf, $langs;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -616,15 +633,19 @@
{
if (is_readable($logo))
{
- $height = pdf_getHeightForLogo($logo);
- $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
- } else {
+ $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
+ {
$text = $this->emetteur->name;
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
}
@@ -710,8 +731,9 @@
$this->recipient = $object->thirdparty;
- // Recipient name
- if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
+ //Recipient name
+ // You can use the name of the contact company
+ if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
$thirdparty = $object->thirdparty;
@@ -752,9 +774,9 @@
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
- *
+ *
* @param PDF $pdf PDF
- * @param Contrat $object Object to show
+ * @param CommonObject $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return integer
@@ -762,7 +784,7 @@
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
- $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
+ $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'CONTRACT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}