From 67c2a48fc9862f31f215da4f4e0be0d6c3ce7abf Mon Sep 17 00:00:00 2001 From: Eric - CAP-REL <1468823+rycks@users.noreply.github.com> Date: Wed, 13 Nov 2024 12:39:10 +0100 Subject: [PATCH] Add missing extrafields on strato pdf model (#31790) * undef var * add main extrafields on object * remove dev debug sorry ! --------- Co-authored-by: Laurent Destailleur --- .../contract/doc/pdf_strato.modules.php | 18 ++++++++++++++++-- .../core/modules/contract/modules_contract.php | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index fe6f77b9b9ac4..5283418997894 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -7,6 +7,7 @@ * Copyright (C) 2013-2020 Philippe Grand * Copyright (C) 2015 Marcos García * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2024 Éric Seigne * * 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 @@ -300,11 +301,24 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10); // Display notes - if (!empty($object->note_public)) { + $notetoshow = empty($object->note_public) ? '' : $object->note_public; + + // Extrafields in note + $extranote = $this->getExtrafieldsInHtml($object, $outputlangs); + if (!empty($extranote)) { + $notetoshow = dol_concatdesc($notetoshow, $extranote); + } + + if (!empty($notetoshow)) { $tab_top -= 2; + $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); + $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); + $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($object->note_public), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($notetoshow), 0, 1); $nexY = $pdf->GetY(); $height_note = $nexY - $tab_top; diff --git a/htdocs/core/modules/contract/modules_contract.php b/htdocs/core/modules/contract/modules_contract.php index 577ec4be5d961..2089736b5c28c 100644 --- a/htdocs/core/modules/contract/modules_contract.php +++ b/htdocs/core/modules/contract/modules_contract.php @@ -41,6 +41,7 @@ abstract class ModelePDFContract extends CommonDocGenerator * @var string Error code (or message) */ public $error = ''; + public $posxdesc; // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps