Merge pull request #15422 from frederic34/patch-10

add optional tag which list all other tags in odt substitutions
This commit is contained in:
Laurent Destailleur 2020-11-18 12:44:25 +01:00 committed by GitHub
commit 95460e6372
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -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));
}
}
/**

View File

@ -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);
}
}