From d114c5667267abd7a5350bf8864178bbd61d8ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 15 Nov 2020 23:49:16 +0100 Subject: [PATCH 1/5] add a tag which list all other tags in odt user --- .../core/modules/user/doc/doc_generic_user_odt.modules.php | 6 ++++++ 1 file changed, 6 insertions(+) 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 771231e6041..a6aac58182a 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 @@ -364,6 +364,12 @@ class doc_generic_user_odt extends ModelePDFUser $tmparray = array_merge($array_user, $array_soc, $array_thirdparty, $array_other, $array_thirdparty_contact); complete_substitutions_array($tmparray, $outputlangs, $object); + // to list all tags in odt template + $tags = ''; + foreach ($tmparray as $key => $value) { + $tags .= '{' . $key . '} => ' . $value ."\n"; + } + $tmparray = array_merge($tmparray, array('__ALL_TAGS__' => $tags)); $object->fetch_optionals(); // Call the ODTSubstitution hook $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); From fb5385180f39b9370acf8f94a39f177fa102fe62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 17 Nov 2020 11:54:18 +0100 Subject: [PATCH 2/5] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 18d98ffd8a0..e6a854405fd 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6660,6 +6660,14 @@ function complete_substitutions_array(&$substitutionarray, $outputlangs, $object } } } + if (!empty($conf->global->ODT_ENABLE_ALL_TAGS_IN_SUBSTITUTIONS) { + // to list all tags in odt template + $tags = ''; + foreach ($substitutionarray as $key => $value) { + $tags .= '{' . $key . '} => ' . $value ."\n"; + } + $substitutionarray = array_merge($substitutionarray, array('__ALL_TAGS__' => $tags)); + } } /** From fcfd630f8455a2a947285c1848ebaccc281fc310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 17 Nov 2020 11:55:05 +0100 Subject: [PATCH 3/5] Update doc_generic_user_odt.modules.php --- .../core/modules/user/doc/doc_generic_user_odt.modules.php | 6 ------ 1 file changed, 6 deletions(-) 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 a6aac58182a..771231e6041 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 @@ -364,12 +364,6 @@ class doc_generic_user_odt extends ModelePDFUser $tmparray = array_merge($array_user, $array_soc, $array_thirdparty, $array_other, $array_thirdparty_contact); complete_substitutions_array($tmparray, $outputlangs, $object); - // to list all tags in odt template - $tags = ''; - foreach ($tmparray as $key => $value) { - $tags .= '{' . $key . '} => ' . $value ."\n"; - } - $tmparray = array_merge($tmparray, array('__ALL_TAGS__' => $tags)); $object->fetch_optionals(); // Call the ODTSubstitution hook $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); From bf390ceb4d1e3701d242151d4f4152ac10fd925c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 17 Nov 2020 11:56:11 +0100 Subject: [PATCH 4/5] Update doc_generic_member_odt.class.php --- .../member/doc/doc_generic_member_odt.class.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index cfa8c75ec11..6d2f2772610 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -322,11 +322,6 @@ class doc_generic_member_odt extends ModelePDFMember $tmparray = array_merge($array_member, $array_soc, $array_thirdparty, $array_other, $array_thirdparty_contact); complete_substitutions_array($tmparray, $outputlangs, $object); - $tags = ''; - foreach ($tmparray as $key => $value) { - $tags .= '{' . $key . '} => ' . $value ."\n"; - } - $tmparray = array_merge($tmparray, array('__ALL_TAGS__' => $tags)); // Call the ODTSubstitution hook $parameters = array( 'file'=>$file, @@ -352,12 +347,10 @@ class doc_generic_member_odt extends ModelePDFMember // Replace labels translated $tmparray = $outputlangs->get_translations_for_substitutions(); - foreach ($tmparray as $key=>$value) - { + foreach ($tmparray as $key=>$value) { try { $odfHandler->setVars($key, $value, true, 'UTF-8'); - } catch (OdfException $e) - { + } catch (OdfException $e) { dol_syslog($e->getMessage(), LOG_WARNING); } } From 3b1f50d5fc742113faa469fe505cef51095826b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 17 Nov 2020 11:58:11 +0100 Subject: [PATCH 5/5] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e6a854405fd..08c137c1b4a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6660,7 +6660,7 @@ function complete_substitutions_array(&$substitutionarray, $outputlangs, $object } } } - if (!empty($conf->global->ODT_ENABLE_ALL_TAGS_IN_SUBSTITUTIONS) { + if (!empty($conf->global->ODT_ENABLE_ALL_TAGS_IN_SUBSTITUTIONS)) { // to list all tags in odt template $tags = ''; foreach ($substitutionarray as $key => $value) {