Debug feature of alternate languages

This commit is contained in:
Laurent Destailleur 2020-05-29 21:59:33 +02:00
parent 540a64bbba
commit 7fc6917cfd
2 changed files with 5 additions and 3 deletions

View File

@ -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 .= "<!-- alternatelanguage for '".$elementforaltlanguage."' set to fields '".join(',', $extralanguages->attributes[$elementforaltlanguage]). "' -->\n";
$this->fetchValuesForExtraLanguages();
if (!is_object($form)) $form = new Form($this->db);
$htmltext = '';

View File

@ -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', ...).