From dabd857cdc88d95860938a2b5d431d11b41ca784 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Wed, 4 Jun 2025 19:15:15 +0200 Subject: [PATCH] Debug v22 --- .../doc/doc_generic_proposal_odt.modules.php | 38 +++++++++++++------ .../user/doc/doc_generic_user_odt.modules.php | 26 +++++++------ .../doc/doc_generic_usergroup_odt.modules.php | 20 +++++----- .../doc/doc_generic_myobject_odt.modules.php | 30 ++++++++------- ...ric_recruitmentjobposition_odt.modules.php | 26 ++++++------- 5 files changed, 80 insertions(+), 60 deletions(-) diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 6f786f9c36d..a61e3e5bfb8 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -40,6 +40,18 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; */ class doc_generic_proposal_odt extends ModelePDFPropales { + /** + * Issuer + * @var Societe + */ + public $emetteur; + + /** + * @var array{0:int,1:int} Minimum version of PHP required by module. + * e.g.: PHP ≥ 7.0 = array(7, 0) + */ + public $phpmin = array(7, 0); + /** * @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document */ @@ -155,15 +167,6 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texthelp .= '
'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'
'; $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it - $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name); - $texte .= '
'; - $texte .= ''; - $texte .= '
'; - $texte .= ''; - $texte .= '
'; - // Scan directories $nbofiles = count($listoffiles); if (!empty($odtPath)) { @@ -210,6 +213,17 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= ''; } } + + $texte .= '

'; + $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name); + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate"); $maxfilesizearray = getMaxFileSizeArray(); @@ -445,13 +459,15 @@ class doc_generic_proposal_odt extends ModelePDFPropales foreach ($tmparray as $key => $value) { try { - if (preg_match('/logo$/', $key)) { // Image + if (preg_match('/logo$/', $key)) { + // Image if (file_exists($value)) { $odfHandler->setImage($key, $value, $ratio); } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else { // Text + } else { + // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 3b800610b2c..d5ad2917d4c 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -103,7 +103,7 @@ class doc_generic_user_odt extends ModelePDFUser */ public function info($langs) { - global $conf, $langs; + global $langs; // Load translation files required by the page $langs->loadLangs(array('companies', 'errors')); @@ -124,7 +124,7 @@ class doc_generic_user_odt extends ModelePDFUser $texte .= ''; $texte .= ''; } - $texte .= ''; + $texte .= '
'; // List of directories area $texte .= ''; - $texte .= ''; $texte .= ''; $texte .= '
'; @@ -153,15 +153,6 @@ class doc_generic_user_odt extends ModelePDFUser $texthelp .= '
'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'
'; $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it - $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name); - $texte .= '
'; - $texte .= ''; - $texte .= '
'; - $texte .= ''; - $texte .= '
'; - // Scan directories if (count($listofdir)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; @@ -198,6 +189,17 @@ class doc_generic_user_odt extends ModelePDFUser } $texte .= ''; } + + $texte .= '

'; + $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name); + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate"); $maxfilesizearray = getMaxFileSizeArray(); @@ -235,7 +237,7 @@ class doc_generic_user_odt extends ModelePDFUser public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable - global $user, $langs, $conf, $mysoc, $hookmanager; + global $langs, $conf, $mysoc, $hookmanager; if (empty($srctemplatepath)) { dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING); diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 2e43e1f408c..e82a231108e 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -154,15 +154,6 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $texthelp .= '
'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'
'; $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it - $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name); - $texte .= '
'; - $texte .= ''; - $texte .= '
'; - $texte .= ''; - $texte .= '
'; - // Scan directories if (count($listofdir)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; @@ -199,6 +190,17 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup } $texte .= '
'; } + + $texte .= '
'; + $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name); + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate"); $maxfilesizearray = getMaxFileSizeArray(); diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index c4aa5ee61d8..ed27d6a34d6 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -160,20 +160,6 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $texthelp .= '
'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'
'; $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it - if (!getDolGlobalString('MAIN_NO_MULTIDIR_FOR_ODT')) { - $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name); - $texte .= '
'; - $texte .= ''; - $texte .= '
'; - $texte .= ''; - $texte .= '
'; - } else { - $texte .= '
'; - $texte .= ''; - } - // Scan directories $nbofiles = count($listoffiles); if (getDolGlobalString('MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH')) { @@ -195,6 +181,21 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $texte .= '
'; } + if (!getDolGlobalString('MAIN_NO_MULTIDIR_FOR_ODT')) { + $texte .= '

'; + $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name); + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + } else { + $texte .= '
'; + $texte .= ''; + } + // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate"); $maxfilesizearray = getMaxFileSizeArray(); @@ -386,6 +387,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject //print html_entity_decode($odfHandler->__toString()); //print exit; + $object->fetch_optionals(); // Make substitutions into odt of freetext try { diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index 57c238c2cc3..9a8f89d21b4 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -155,19 +155,11 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi } } $texthelp = $langs->trans("ListOfDirectoriesForModelGenODT"); + $texthelp .= '

'.$langs->trans("ExampleOfDirectoriesForModelGen").''; // Add list of substitution keys $texthelp .= '
'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'
'; $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it - $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); - $texte .= '
'; - $texte .= ''; - $texte .= '
'; - $texte .= ''; - $texte .= '
'; - // Scan directories $nbofiles = count($listoffiles); if (getDolGlobalString('RECRUITMENT_RECRUITMENTJOBPOSITION_ADDON_PDF_ODT_PATH')) { @@ -188,6 +180,17 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi } $texte .= '
'; } + + $texte .= '

'; + $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate"); $maxfilesizearray = getMaxFileSizeArray(); @@ -201,11 +204,6 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi $texte .= '
'; $texte .= '
'; - $texte .= ''; - $texte .= $langs->trans("ExampleOfDirectoriesForModelGen"); - $texte .= ''; - $texte .= '
';