--- /tmp/dsg/dolibarr/htdocs/core/modules/contract/doc/github_19.0.3_doc_generic_contract_odt.modules.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/contract/doc/client_doc_generic_contract_odt.modules.php
@@ -42 +42,2 @@
- * @var string Dolibarr version of the loaded document
+ * Issuer
+ * @var Societe
@@ -43,0 +45,12 @@
+ public $emetteur;
+
+ /**
+ * @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
+ */
@@ -57 +70 @@
- $langs->loadLangs(array("main", "companies"));
+ $langs->loadLangs(array("main", "companies"));
@@ -74,6 +87,7 @@
- $this->option_logo = 1; // Display logo
- $this->option_tva = 0; // Manage the vat CONTRACT_TVAOPTION
- $this->option_modereg = 0; // Display payment mode
- $this->option_condreg = 0; // Display payment terms
- $this->option_multilang = 1; // Available in several languages
- $this->option_escompte = 0; // Displays if there has been a discount
+ $this->option_logo = 1; // Affiche logo
+ $this->option_tva = 0; // Gere option tva CONTRACT_TVAOPTION
+ $this->option_modereg = 0; // Affiche mode reglement
+ $this->option_condreg = 0; // Affiche conditions reglement
+ $this->option_codeproduitservice = 0; // Affiche code produit-service
+ $this->option_multilang = 1; // Dispo en plusieurs langues
+ $this->option_escompte = 0; // Affiche si il y a eu escompte
@@ -84 +98 @@
- // Get source company
+ // Recupere emetteur
@@ -86,3 +100 @@
- if (!$this->emetteur->country_code) {
- $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
- }
+ if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
@@ -103 +115 @@
- $langs->loadLangs(array('companies', 'errors'));
+ $langs->loadLangs(array('companies', 'errors'));
@@ -110 +121,0 @@
- $texte .= '';
@@ -113 +124 @@
- $texte .= '
';
+ $texte .= '';
@@ -120 +131,2 @@
- foreach ($listofdir as $key => $tmpdir) {
+ foreach ($listofdir as $key=>$tmpdir)
+ {
@@ -124,2 +136 @@
- unset($listofdir[$key]);
- continue;
+ unset($listofdir[$key]); continue;
@@ -127,3 +138,3 @@
- if (!is_dir($tmpdir)) {
- $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
- } else {
+ if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
+ else
+ {
@@ -131,3 +142 @@
- if (count($tmpfiles)) {
- $listoffiles = array_merge($listoffiles, $tmpfiles);
- }
+ if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles);
@@ -137 +145,0 @@
- $texthelp .= '
'.$langs->trans("ExampleOfDirectoriesForModelGen").'';
@@ -142 +150 @@
- $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
+ $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
@@ -145 +153 @@
- $texte .= getDolGlobalString('CONTRACT_ADDON_PDF_ODT_PATH');
+ $texte .= $conf->global->CONTRACT_ADDON_PDF_ODT_PATH;
@@ -148 +156 @@
- $texte .= '';
+ $texte .= '';
@@ -152,7 +160,3 @@
- $nbofiles = count($listoffiles);
- if (getDolGlobalString('CONTRACT_ADDON_PDF_ODT_PATH')) {
- $texte .= $langs->trans("NumberOfModelFilesFound").': ';
- //$texte.=$nbofiles?'':'';
- $texte .= count($listoffiles);
- //$texte.=$nbofiles?'':'';
- $texte .= '';
+ if (count($listofdir))
+ {
+ $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).'';
@@ -161,10 +164,0 @@
- if ($nbofiles) {
- $texte .= '';
- }
@@ -172,7 +166 @@
- $texte .= '';
@@ -184,0 +173,3 @@
+ $texte .= '';
+ $texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
+ $texte .= ' | ';
@@ -193 +184 @@
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -207 +198 @@
- // phpcs:enable
+ // phpcs:enable
@@ -210 +201,2 @@
- if (empty($srctemplatepath)) {
+ if (empty($srctemplatepath))
+ {
@@ -216 +208,2 @@
- if (!is_object($hookmanager)) {
+ if (!is_object($hookmanager))
+ {
@@ -223,3 +216 @@
- if (!is_object($outputlangs)) {
- $outputlangs = $langs;
- }
+ if (!is_object($outputlangs)) $outputlangs = $langs;
@@ -229 +220 @@
- // Load translation files required by page
+ // Load traductions files required by page
@@ -232 +223,2 @@
- if ($conf->contrat->multidir_output[$object->entity]) {
+ if ($conf->contrat->dir_output)
+ {
@@ -234 +226,2 @@
- if (!is_object($object)) {
+ if (!is_object($object))
+ {
@@ -238 +231,2 @@
- if ($result < 0) {
+ if ($result < 0)
+ {
@@ -244,3 +238 @@
- $object->fetch_thirdparty();
-
- $dir = $conf->contrat->multidir_output[$object->entity];
+ $dir = $conf->contrat->dir_output;
@@ -248,3 +240 @@
- if (!preg_match('/specimen/i', $objectref)) {
- $dir .= "/".$objectref;
- }
+ if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
@@ -253,2 +243,4 @@
- if (!file_exists($dir)) {
- if (dol_mkdir($dir) < 0) {
+ if (!file_exists($dir))
+ {
+ if (dol_mkdir($dir) < 0)
+ {
@@ -260 +252,2 @@
- if (file_exists($dir)) {
+ if (file_exists($dir))
+ {
@@ -263 +256 @@
- $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile);
+ $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
@@ -267 +260 @@
- $newfiletmp = $objectref . '_' . $newfiletmp;
+ $newfiletmp = $objectref.'_'.$newfiletmp;
@@ -271,10 +264,11 @@
- if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
- $format = getDolGlobalString('MAIN_DOC_USE_TIMING');
- if ($format == '1') {
- $format = '%Y%m%d%H%M%S';
- }
- $filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
- } else {
- $filename = $newfiletmp . '.' . $newfileformat;
- }
- $file = $dir . '/' . $filename;
+ 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';
+ $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
+ }
+ else
+ {
+ $filename = $newfiletmp.'.'.$newfileformat;
+ }
+ $file = $dir.'/'.$filename;
@@ -287,5 +281 @@
- if (!is_writable($conf->contrat->dir_temp)) {
- $this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->contrat->dir_temp);
- dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
- return -1;
- }
+
@@ -296 +286,2 @@
- if (count($arrayidcontact) > 0) {
+ if (count($arrayidcontact) > 0)
+ {
@@ -303,12 +294,12 @@
- if (!empty($usecontact)) {
- // We can use the company of contact instead of thirdparty company
- if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('MAIN_USE_COMPANY_NAME_OF_CONTACT'))) {
- $object->contact->fetch_thirdparty();
- $socobject = $object->contact->thirdparty;
- $contactobject = $object->contact;
- } else {
- $socobject = $object->thirdparty;
- // if we have a CUSTOMER contact and we dont use it as thirdparty 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
+ {
@@ -331,3 +322 @@
- if ($usecontact && is_object($contactobject)) {
- $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
- }
+ if ($usecontact && is_object($contactobject)) $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
@@ -347,2 +336,3 @@
- if (!empty($conf->global->$paramfreetext)) {
- $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $tmparray);
+ if (!empty($conf->global->$paramfreetext))
+ {
+ $newfreetext = make_substitutions($conf->global->$paramfreetext, $tmparray);
@@ -355 +345 @@
- $odfHandler = new Odf(
+ $odfHandler = new odf(
@@ -364 +354,3 @@
- } catch (Exception $e) {
+ }
+ catch (Exception $e)
+ {
@@ -379 +371,3 @@
- } catch (OdfException $e) {
+ }
+ catch (OdfException $e)
+ {
@@ -383,5 +377,2 @@
- // Call the ODTSubstitution hook
- $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
- $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
-
- foreach ($tmparray as $key => $value) {
+ foreach ($tmparray as $key=>$value)
+ {
@@ -389,9 +380,7 @@
- if (preg_match('/logo$/', $key)) {
- // Image
- if (file_exists($value)) {
- $odfHandler->setImage($key, $value);
- } else {
- $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
- }
- } else {
- // Text
+ if (preg_match('/logo$/', $key)) // Image
+ {
+ if (file_exists($value)) $odfHandler->setImage($key, $value);
+ else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
+ }
+ else // Text
+ {
@@ -400,2 +389,4 @@
- } catch (OdfException $e) {
- dol_syslog($e->getMessage(), LOG_INFO);
+ }
+ catch (OdfException $e)
+ {
+ dol_syslog($e->getMessage(), LOG_INFO);
@@ -406 +397,2 @@
- try {
+ try
+ {
@@ -410 +402,3 @@
- } catch (OdfExceptionSegmentNotFound $e) {
+ }
+ catch (OdfException $e)
+ {
@@ -414,5 +408,3 @@
- } catch (OdfException $e) {
- $foundtagforlines = 0;
- dol_syslog($e->getMessage(), LOG_INFO);
- }
- if ($foundtagforlines) {
+ }
+ if ($foundtagforlines)
+ {
@@ -420 +412,2 @@
- foreach ($object->lines as $line) {
+ foreach ($object->lines as $line)
+ {
@@ -427,2 +420,4 @@
- foreach ($tmparray as $key => $val) {
- try {
+ foreach ($tmparray as $key => $val)
+ {
+ try
+ {
@@ -430 +425,3 @@
- } catch (OdfException $e) {
+ }
+ catch (OdfException $e)
+ {
@@ -432 +429,3 @@
- } catch (SegmentException $e) {
+ }
+ catch (SegmentException $e)
+ {
@@ -440 +439,3 @@
- } catch (OdfException $e) {
+ }
+ catch (OdfException $e)
+ {
@@ -448 +449,2 @@
- foreach ($tmparray as $key => $value) {
+ foreach ($tmparray as $key=>$value)
+ {
@@ -451,2 +453,4 @@
- } catch (OdfException $e) {
- dol_syslog($e->getMessage(), LOG_INFO);
+ }
+ catch (OdfException $e)
+ {
+ dol_syslog($e->getMessage(), LOG_INFO);
@@ -457 +461 @@
- $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
+ $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
@@ -461 +465 @@
- if (getDolGlobalString('MAIN_ODT_AS_PDF')) {
+ if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
@@ -466 +469,0 @@
- dol_syslog($e->getMessage(), LOG_INFO);
@@ -469 +472,2 @@
- } else {
+ }
+ else {
@@ -471 +475 @@
- $odfHandler->saveToDisk($file);
+ $odfHandler->saveToDisk($file);
@@ -474 +477,0 @@
- dol_syslog($e->getMessage(), LOG_INFO);
@@ -479 +481,0 @@
- $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
@@ -482 +484,2 @@
- dolChmod($file);
+ if (!empty($conf->global->MAIN_UMASK))
+ @chmod($file, octdec($conf->global->MAIN_UMASK));
@@ -489 +492,3 @@
- } else {
+ }
+ else
+ {
--- /tmp/dsg/dolibarr/htdocs/core/modules/contract/doc/github_19.0.3_pdf_strato.modules.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/contract/doc/client_pdf_strato.modules.php
@@ -7 +7 @@
- * Copyright (C) 2013-2020 Philippe Grand
+ * Copyright (C) 2013-2019 Philippe Grand
@@ -9 +9 @@
- * Copyright (C) 2018-2020 Frédéric France
+ * Copyright (C) 2018 Frédéric France
@@ -44 +44,69 @@
- * @var DoliDb Database handler
+ * @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
+ */
+ public $marge_gauche;
+
+ /**
+ * @var int marge_droite
+ */
+ public $marge_droite;
+
+ /**
+ * @var int marge_haute
+ */
+ public $marge_haute;
+
+ /**
+ * @var int marge_basse
+ */
+ public $marge_basse;
+
+ /**
+ * Issuer
+ * @var Societe
@@ -46,32 +114 @@
- public $db;
-
- /**
- * @var int The environment ID when using a multicompany module
- */
- public $entity;
-
- /**
- * @var string model name
- */
- public $name;
-
- /**
- * @var string model description (short text)
- */
- public $description;
-
- /**
- * @var int Save the name of generated file as the main doc when generating a doc with this template
- */
- public $update_main_doc_field;
-
- /**
- * @var string document type
- */
- public $type;
-
- /**
- * Dolibarr version of the loaded document
- * @var string
- */
- public $version = 'dolibarr';
+ public $emetteur;
@@ -92 +129 @@
- global $langs, $mysoc;
+ global $conf, $langs, $mysoc;
@@ -97,3 +134,2 @@
- $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
-
- // Dimension page
+
+ // Page size for A4 format
@@ -106,4 +142,4 @@
- $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10);
- $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10);
- $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10);
- $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10);
+ $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
+ $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
+ $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
+ $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
@@ -114,0 +151 @@
+ $this->option_codeproduitservice = 0; // Display product-service code
@@ -120,3 +157 @@
- if (empty($this->emetteur->country_code)) {
- $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
- }
+ if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if not defined
@@ -128,20 +163,18 @@
- // 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
- global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
-
- if (!is_object($outputlangs)) {
- $outputlangs = $langs;
- }
+ // 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;
@@ -149,5 +182,3 @@
- if (getDolGlobalString('MAIN_USE_FPDF')) {
- $outputlangs->charset_output = 'ISO-8859-1';
- }
-
- // Load translation files required by page
+ if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1';
+
+ // Load traductions files required by page
@@ -156,17 +187,3 @@
- // Show Draft Watermark
- if ($object->statut == $object::STATUS_DRAFT && (getDolGlobalString('CONTRACT_DRAFT_WATERMARK'))) {
- $this->watermark = $conf->global->CONTRACT_DRAFT_WATERMARK;
- }
-
- global $outputlangsbis;
- $outputlangsbis = null;
- if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
- $outputlangsbis = new Translate('', $conf);
- $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
- $outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries"));
- }
-
- $nblines = count($object->lines);
-
- if ($conf->contract->multidir_output[$conf->entity]) {
- $object->fetch_thirdparty();
+ if ($conf->contrat->dir_output)
+ {
+ $object->fetch_thirdparty();
@@ -175,2 +192,3 @@
- if ($object->specimen) {
- $dir = $conf->contract->multidir_output[$conf->entity];
+ if ($object->specimen)
+ {
+ $dir = $conf->contrat->dir_output;
@@ -178 +196,3 @@
- } else {
+ }
+ else
+ {
@@ -180 +200 @@
- $dir = $conf->contrat->multidir_output[$object->entity]."/".$objectref;
+ $dir = $conf->contrat->dir_output."/".$objectref;
@@ -184,3 +204,5 @@
- if (!file_exists($dir)) {
- if (dol_mkdir($dir) < 0) {
- $this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
+ if (!file_exists($dir))
+ {
+ if (dol_mkdir($dir) < 0)
+ {
+ $this->error = $outputlangs->trans("ErrorCanNotCreateDir", $dir);
@@ -191 +213,2 @@
- if (file_exists($dir)) {
+ if (file_exists($dir))
+ {
@@ -193 +216,2 @@
- if (!is_object($hookmanager)) {
+ if (!is_object($hookmanager))
+ {
@@ -202,29 +226,20 @@
- // Set nblines with the new command lines content after hook
- $nblines = count($object->lines);
-
- // Create pdf instance
- $pdf = pdf_getInstance($this->format);
- $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
- $pdf->SetAutoPageBreak(1, 0);
-
- $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 + 9; // Height reserved to output the footer (value include bottom margin)
- if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) {
- $heightforfooter += 6;
- }
-
- if (class_exists('TCPDF')) {
- $pdf->setPrintHeader(false);
- $pdf->setPrintFooter(false);
- }
- $pdf->SetFont(pdf_getPDFFont($outputlangs));
- // Set path to the background PDF File
- if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) {
- $logodir = $conf->mycompany->dir_output;
- if (!empty($conf->mycompany->multidir_output[$object->entity])) {
- $logodir = $conf->mycompany->multidir_output[$object->entity];
- }
- $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('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);
+ }
@@ -237 +252 @@
- $pdf->SetSubject($outputlangs->transnoentities("Contract"));
+ $pdf->SetSubject($outputlangs->transnoentities("ContractCard"));
@@ -240,4 +255,2 @@
- $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Contract")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
- if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
- $pdf->SetCompression(false);
- }
+ $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("ContractCard")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
+ if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
@@ -249,3 +262 @@
- if (!empty($tplidx)) {
- $pdf->useTemplate($tplidx);
- }
+ if (!empty($tplidx)) $pdf->useTemplate($tplidx);
@@ -253 +264 @@
- $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs, (is_object($outputlangsbis) ? $outputlangsbis : null));
+ $this->_pagehead($pdf, $object, 1, $outputlangs);
@@ -259 +270 @@
- $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
+ $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10);
@@ -262 +273,2 @@
- if (!empty($object->note_public)) {
+ if (!empty($object->note_public))
+ {
@@ -288 +300,2 @@
- for ($i = 0; $i < $nblines; $i++) {
+ for ($i = 0; $i < $nblines; $i++)
+ {
@@ -293 +306,2 @@
- if ($valide > 0 || $object->specimen) {
+ if ($valide > 0 || $object->specimen)
+ {
@@ -305,2 +319,2 @@
- if (!empty($objectligne->date_start)) {
- $datei = dol_print_date((int) $objectligne->date_start, 'day', false, $outputlangs, true);
+ if ($objectligne->date_ouverture_prevue) {
+ $datei = dol_print_date($objectligne->date_ouverture_prevue, 'day', false, $outputlangs, true);
@@ -311,3 +325,3 @@
- if (!empty($objectligne->date_end)) {
- $durationi = convertSecondToTime((int) $objectligne->date_end - (int) $objectligne->date_start, 'allwithouthour');
- $datee = dol_print_date($objectligne->date_end, 'day', false, $outputlangs, true);
+ if ($objectligne->date_fin_validite) {
+ $durationi = convertSecondToTime($objectligne->date_fin_validite - $objectligne->date_ouverture_prevue, 'allwithouthour');
+ $datee = dol_print_date($objectligne->date_fin_validite, 'day', false, $outputlangs, true);
@@ -319,2 +333,2 @@
- if (!empty($objectligne->date_start_real)) {
- $daters = dol_print_date((int) $objectligne->date_start_real, 'day', false, $outputlangs, true);
+ if ($objectligne->date_ouverture) {
+ $daters = dol_print_date($objectligne->date_ouverture, 'day', false, $outputlangs, true);
@@ -325,2 +339,2 @@
- if (!empty($objectligne->date_end_real)) {
- $datere = dol_print_date((int) $objectligne->date_end_real, 'day', false, $outputlangs, true);
+ if ($objectligne->date_cloture) {
+ $datere = dol_print_date($objectligne->date_cloture, 'day', false, $outputlangs, true);
@@ -331,5 +345,7 @@
- $txtpredefinedservice = $objectligne->product_ref;
- if ($objectligne->product_label) {
- $txtpredefinedservice .= ' - ';
- $txtpredefinedservice .= $objectligne->product_label;
- }
+ $txtpredefinedservice = '';
+ $txtpredefinedservice = $objectligne->product_label;
+ if ($objectligne->product_label)
+ {
+ $txtpredefinedservice .= ' - ';
+ $txtpredefinedservice .= $objectligne->product_label;
+ }
@@ -339,7 +355,3 @@
- if (!getDolGlobalString('CONTRACT_HIDE_QTY_ON_PDF')) {
- $txt .= $outputlangs->transnoentities("Quantity") . ' : ' . $objectligne->qty . '';
- }
- if (!getDolGlobalString('CONTRACT_HIDE_PRICE_ON_PDF')) {
- $txt .= ' - ' . $outputlangs->transnoentities("UnitPrice") . ' : ' . price($objectligne->subprice) . '';
- }
- if (!getDolGlobalString('CONTRACT_HIDE_PLANNED_DATE_ON_PDF')) {
+ $txt .= $outputlangs->transnoentities("Quantity").' : '.$objectligne->qty.' - '.$outputlangs->transnoentities("UnitPrice").' : '.price($objectligne->subprice).''; // Desc (not empty for free lines)
+ if (empty($conf->global->CONTRACT_HIDE_PLANNED_DATE_ON_PDF))
+ {
@@ -349 +361,2 @@
- if (!getDolGlobalString('CONTRACT_HIDE_REAL_DATE_ON_PDF')) {
+ if (empty($conf->global->CONTRACT_HIDE_REAL_DATE_ON_PDF))
+ {
@@ -351,4 +364,2 @@
- $txt .= $outputlangs->transnoentities("DateStartRealShort")." : ".$daters.'';
- if (!empty($objectligne->date_end_real)) {
- $txt .= " - ".$outputlangs->transnoentities("DateEndRealShort")." : ''".$datere.'';
- }
+ $txt .= $outputlangs->transnoentities("DateStartRealShort")." : ".$daters.'';
+ if ($objectligne->date_cloture) $txt .= " - ".$outputlangs->transnoentities("DateEndRealShort")." : ''".$datere.'';
@@ -360 +371,2 @@
- if ($pageposafter > $pageposbefore) { // There is a pagebreak
+ if ($pageposafter > $pageposbefore) // There is a pagebreak
+ {
@@ -368,2 +380,5 @@
- if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
- if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
+
+ if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text
+ {
+ if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page
+ {
@@ -371,6 +386,2 @@
- if (!empty($tplidx)) {
- $pdf->useTemplate($tplidx);
- }
- if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
- $this->_pagehead($pdf, $object, 0, $outputlangs);
- }
+ if (!empty($tplidx)) $pdf->useTemplate($tplidx);
+ if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
@@ -379 +390,3 @@
- } else {
+ }
+ else
+ {
@@ -383 +396 @@
- if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
+ if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
@@ -385 +398 @@
- } else {
+ else
@@ -387 +399,0 @@
- }
@@ -389 +401,3 @@
- } else { // No pagebreak
+ }
+ else // No pagebreak
+ {
@@ -392 +405,0 @@
- $posYAfterDescription = $pdf->GetY();
@@ -402,3 +415,2 @@
- if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
- $pdf->setPage($pageposafter);
- $curY = $tab_top_newpage;
+ if ($pageposafter > $pageposbefore) {
+ $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
@@ -410 +422,2 @@
- while ($pagenb < $pageposafter) {
+ while ($pagenb < $pageposafter)
+ {
@@ -412 +425,2 @@
- if ($pagenb == 1) {
+ if ($pagenb == 1)
+ {
@@ -414 +428,3 @@
- } else {
+ }
+ else
+ {
@@ -421,2 +437,7 @@
- if (!getDolGlobalString('MAIN_PDF_DONOTREPEAT_HEAD')) {
- $this->_pagehead($pdf, $object, 0, $outputlangs);
+ }
+
+ if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext, 0, $outputlangs, 0, 1);
@@ -424,9 +445,2 @@
- if (!empty($tplidx)) {
- $pdf->useTemplate($tplidx);
- }
- }
-
- if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
- if ($pagenb == 1) {
- $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext, 0, $outputlangs, 0, 1);
- } else {
+ else
+ {
@@ -438,3 +452 @@
- if (!empty($tplidx)) {
- $pdf->useTemplate($tplidx);
- }
+ if (!empty($tplidx)) $pdf->useTemplate($tplidx);
@@ -446 +457,0 @@
-
@@ -448 +459,2 @@
- if ($pagenb == 1) {
+ if ($pagenb == 1)
+ {
@@ -452 +464,3 @@
- } else {
+ }
+ else
+ {
@@ -459,2 +473,11 @@
- if (method_exists($pdf, 'AliasNbPages')) {
- $pdf->AliasNbPages();
+ if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
+
+ $pdf->Close();
+
+ $pdf->Output($file, 'F');
+
+ // Add pdfgeneration hook
+ if (!is_object($hookmanager))
+ {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
+ $hookmanager = new HookManager($this->db);
@@ -462,6 +484,0 @@
-
- $pdf->Close();
-
- $pdf->Output($file, 'F');
-
- // Add pdfgeneration hook
@@ -472,3 +489,4 @@
- if ($reshook < 0) {
- $this->error = $hookmanager->error;
- $this->errors = $hookmanager->errors;
+ if ($reshook < 0)
+ {
+ $this->error = $hookmanager->error;
+ $this->errors = $hookmanager->errors;
@@ -477 +495,2 @@
- dolChmod($file);
+ if (!empty($conf->global->MAIN_UMASK))
+ @chmod($file, octdec($conf->global->MAIN_UMASK));
@@ -481,3 +500,5 @@
- return 1; // No error
- } else {
- $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
+ return 1;
+ }
+ else
+ {
+ $this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
@@ -486,2 +507,4 @@
- } else {
- $this->error = $langs->transnoentities("ErrorConstantNotDefined", "CONTRACT_OUTPUTDIR");
+ }
+ else
+ {
+ $this->error = $langs->trans("ErrorConstantNotDefined", "CONTRACT_OUTPUTDIR");
@@ -496 +519 @@
- * @param TCPDF $pdf Object PDF
+ * @param PDF $pdf Object PDF
@@ -511,7 +534,4 @@
- if ($hidetop) {
- $hidetop = -1;
- }
-
- //$default_font_size = pdf_getPDFFontSize($outputlangs);
-
- /*
+ if ($hidetop) $hidetop = -1;
+
+ $default_font_size = pdf_getPDFFontSize($outputlangs);
+ /*
@@ -541 +561 @@
- */
+ */
@@ -547,8 +567,8 @@
- /**
- * 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
+ */
@@ -556 +576 @@
- {
+ {
@@ -572 +592 @@
- }
+ }
@@ -575,22 +595,14 @@
- /**
- * 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
- * @param Translate $outputlangsbis Object lang for output bis
- * @param string $titlekey Translation key to show as title of document
- * @return int Return topshift value
- */
- protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null, $titlekey = "Contract")
- {
- // phpcs:enable
- global $conf;
-
- $top_shift = 0;
-
- $ltrdirection = 'L';
- if ($outputlangs->trans("DIRECTION") == 'rtl') {
- $ltrdirection = 'R';
- }
+ /**
+ * 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);
@@ -601,2 +612,0 @@
- $default_font_size = pdf_getPDFFontSize($outputlangs);
-
@@ -604,0 +615,7 @@
+ //Affiche le filigrane brouillon - Print Draft Watermark
+ if ($object->statut == 0 && (!empty($conf->global->CONTRACT_DRAFT_WATERMARK)))
+ {
+ pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->CONTRACT_DRAFT_WATERMARK);
+ }
+
+ //Prepare next
@@ -608,2 +625 @@
- $w = 100;
-
+ $posx = $this->page_largeur - $this->marge_droite - 100;
@@ -611 +626,0 @@
- $posx = $this->page_largeur - $this->marge_droite - $w;
@@ -616,24 +631,20 @@
- if (!getDolGlobalString('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 (!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);
- }
+ $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)
+ }
+ 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, 'L');
@@ -645,11 +656,5 @@
- $title = $outputlangs->transnoentities($titlekey);
- $title .= ' '.$outputlangs->convToOutputCharset($object->ref);
- if ($object->statut == $object::STATUS_DRAFT) {
- $pdf->SetTextColor(128, 0, 0);
- $title .= ' - '.$outputlangs->transnoentities("NotValidated");
- }
- $pdf->MultiCell($w, 3, $title, '', 'R');
-
- $pdf->SetFont('', 'B', $default_font_size);
-
- /*
+ $title = $outputlangs->transnoentities("ContractCard");
+ $pdf->MultiCell(100, 4, $title, '', 'R');
+
+ $pdf->SetFont('', 'B', $default_font_size + 2);
+
@@ -660,4 +665,3 @@
- */
-
- $posy += 3;
- $pdf->SetFont('', '', $default_font_size - 1);
+
+ $posy += 1;
+ $pdf->SetFont('', '', $default_font_size);
@@ -668,3 +672,4 @@
- $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date_contrat, "day", false, $outputlangs, true), '', 'R');
-
- if (!getDolGlobalString('MAIN_PDF_HIDE_CUSTOMER_CODE') && $object->thirdparty->code_client) {
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date_contrat, "day", false, $outputlangs, true), '', 'R');
+
+ if ($object->thirdparty->code_client)
+ {
@@ -674 +679 @@
- $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
@@ -677 +682,2 @@
- if ($showaddress) {
+ if ($showaddress)
+ {
@@ -680 +686 @@
- // Add internal contact of object if defined
+ // Add internal contact of proposal if defined
@@ -682 +688,2 @@
- if (count($arrayidcontact) > 0) {
+ if (count($arrayidcontact) > 0)
+ {
@@ -684,8 +691 @@
- $labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
- $carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
- $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
- $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
- $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
- $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
- $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
- $carac_emetteur .= "\n";
+ $carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
@@ -699,3 +699 @@
- if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) {
- $posx = $this->page_largeur - $this->marge_droite - 80;
- }
+ if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
@@ -705,9 +703,6 @@
- if (!getDolGlobalString('MAIN_PDF_NO_SENDER_FRAME')) {
- $pdf->SetTextColor(0, 0, 0);
- $pdf->SetFont('', '', $default_font_size - 2);
- $pdf->SetXY($posx, $posy - 5);
- $pdf->SetXY($posx, $posy);
- $pdf->SetFillColor(230, 230, 230);
- $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
- $pdf->SetTextColor(0, 0, 60);
- }
+ $pdf->SetTextColor(0, 0, 0);
+ $pdf->SetFont('', '', $default_font_size - 2);
+ $pdf->SetXY($posx, $posy - 5);
+ $pdf->SetXY($posx, $posy);
+ $pdf->SetFillColor(230, 230, 230);
+ $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
@@ -716,7 +711,5 @@
- if (!getDolGlobalString('MAIN_PDF_HIDE_SENDER_NAME')) {
- $pdf->SetXY($posx + 2, $posy + 3);
- $pdf->SetTextColor(0, 0, 60);
- $pdf->SetFont('', 'B', $default_font_size);
- $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
- $posy = $pdf->getY();
- }
+ $pdf->SetXY($posx + 2, $posy + 3);
+ $pdf->SetTextColor(0, 0, 60);
+ $pdf->SetFont('', 'B', $default_font_size);
+ $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
+ $posy = $pdf->getY();
@@ -724,0 +718 @@
+ $pdf->SetFont('', '', $default_font_size - 1);
@@ -726 +719,0 @@
- $pdf->SetFont('', '', $default_font_size - 1);
@@ -733 +726,2 @@
- if (count($arrayidcontact) > 0) {
+ if (count($arrayidcontact) > 0)
+ {
@@ -740,2 +734,3 @@
- // Recipient name
- if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('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)) {
@@ -749,2 +744 @@
- $mode = 'target';
- $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (isset($object->contact) ? $object->contact : ''), $usecontact, $mode, $object);
+ $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (isset($object->contact) ? $object->contact : ''), $usecontact, 'target', $object);
@@ -753,6 +747,3 @@
- $widthrecbox = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 92 : 100;
- if ($this->page_largeur < 210) {
- $widthrecbox = 84; // To work with US executive format
- }
- $posy = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 40 : 42;
- $posy += $top_shift;
+ $widthrecbox = 100;
+ if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format
+ $posy = 42;
@@ -760,3 +751 @@
- if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) {
- $posx = $this->marge_gauche;
- }
+ if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
@@ -765,7 +754,5 @@
- if (!getDolGlobalString('MAIN_PDF_NO_RECIPENT_FRAME')) {
- $pdf->SetTextColor(0, 0, 0);
- $pdf->SetFont('', '', $default_font_size - 2);
- $pdf->SetXY($posx + 2, $posy - 5);
- $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
- $pdf->SetTextColor(0, 0, 0);
- }
+ $pdf->SetTextColor(0, 0, 0);
+ $pdf->SetFont('', '', $default_font_size - 2);
+ $pdf->SetXY($posx + 2, $posy - 5);
+ $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
+ $pdf->SetTextColor(0, 0, 0);
@@ -776 +763 @@
- $pdf->MultiCell($widthrecbox, 4, $this->recipient->name, 0, $ltrdirection);
+ $pdf->MultiCell($widthrecbox, 4, $this->recipient->name, 0, 'L');
@@ -783 +770 @@
- $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
+ $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
@@ -785,3 +771,0 @@
-
- $pdf->SetTextColor(0, 0, 0);
- return $top_shift;
@@ -793 +777 @@
- *
+ *
@@ -795 +779 @@
- * @param Contrat $object Object to show
+ * @param CommonObject $object Object to show
@@ -802,2 +786,3 @@
- $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
- return pdf_pagefoot($pdf, $outputlangs, 'CONTRACT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
+ global $conf;
+ $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);