From 7fc6917cfdd6145de58da055f00cfc7ad2d49461 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 May 2020 21:59:33 +0200 Subject: [PATCH] Debug feature of alternate languages --- htdocs/core/class/commonobject.class.php | 6 ++++-- htdocs/core/class/extralanguages.class.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4fcac1979b7..a6b96ef3b4d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -635,6 +635,7 @@ abstract class CommonObject $contactid = 0; $thirdpartyid = 0; + $elementforaltlanguage = $this->element; if ($this->element == 'societe') { $thirdpartyid = $this->id; @@ -682,10 +683,11 @@ abstract class CommonObject include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; $extralanguages = new ExtraLanguages($this->db); } - $extralanguages->fetch_name_extralanguages('societe'); + $extralanguages->fetch_name_extralanguages($elementforaltlanguage); - if (!empty($extralanguages->attributes['societe']['address']) || !empty($extralanguages->attributes['societe']['town'])) + if (!empty($extralanguages->attributes[$elementforaltlanguage]['address']) || !empty($extralanguages->attributes[$elementforaltlanguage]['town'])) { + $out .= "\n"; $this->fetchValuesForExtraLanguages(); if (!is_object($form)) $form = new Form($this->db); $htmltext = ''; diff --git a/htdocs/core/class/extralanguages.class.php b/htdocs/core/class/extralanguages.class.php index 48f2e94936a..08413c788b2 100644 --- a/htdocs/core/class/extralanguages.class.php +++ b/htdocs/core/class/extralanguages.class.php @@ -71,7 +71,7 @@ class ExtraLanguages /** * Load array this->attributes with list of fields per object that need an alternate translation. The object and field must be managed with * the widgetForTranslation() method. - * You can set variable MAIN_USE_ALTERNATE_TRANSLATION_FOR=elementA:fieldname,fieldname2;elementB:... + * You must set variable MAIN_USE_ALTERNATE_TRANSLATION_FOR=elementA:fieldname,fieldname2;elementB:... * Example: MAIN_USE_ALTERNATE_TRANSLATION_FOR=societe:name,town;contact:firstname,lastname * * @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).