diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index ed58812dfc3..7b3b02e6c04 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -801,8 +801,8 @@ class Contact extends CommonObject /** - * \brief Retourne le libelle de civilite du contact - * \return string Nom traduit de la civilite + * Return label of a civility contact + * @return string Translated name of civility */ function getCivilityLabel() { @@ -810,7 +810,14 @@ class Contact extends CommonObject $langs->load("dict"); $code=$this->civilite_id; - return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : $code; + return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : ''; + if (empty($ret)) + { + $ret=$code; + $langs->getLabelFromKey($db,$reg[1],'c_civilite','code','civilite'); + //$ret=dol_getIdFromCode($this->db,$code,'c_civilite', + } + return $ret; } diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 48580c88e24..9b02775e854 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -320,8 +320,8 @@ class Translate { /** - * \brief Mark domain as not loaded to be able to load it again. - * \param domain File name to load (.lang file). Use @ before value if domain is in a module directory. + * Mark domain as not loaded to be able to load it again. + * @param domain File name to load (.lang file). Use @ before value if domain is in a module directory. */ function UnLoad($domain) { @@ -330,8 +330,8 @@ class Translate { } /** - * \brief Retourn list of files already loaded into memory - * \return string List of files loaded into memory "main=1,errors=1,..." + * Return list of files already loaded into memory + * @return string List of files loaded into memory "main=1,errors=1,..." */ function list_domainloaded() { @@ -346,7 +346,9 @@ class Translate { /** * Return translated value of key. Search in lang file, then into database. - * If not found, return key + * If not found, return key. + * WARNING: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey), getLabelFromKey must + * not be called with same value than input. * * @param key * @return string @@ -371,7 +373,11 @@ class Translate { { $newstr=$this->getLabelFromKey($db,$reg[1],'c_paiement','code','libelle'); } - return $newstr; + else if (preg_match('/Civility([0-9A-Z]+)$/i',$key,$reg)) + { + $newstr=$this->getLabelFromKey($db,$reg[1],'c_civilite','code','civilite'); + } + return $newstr; } diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php index e9c9388ca10..2e508a7ef10 100644 --- a/htdocs/lib/company.lib.php +++ b/htdocs/lib/company.lib.php @@ -104,13 +104,6 @@ function societe_prepare_head($object) $head[$h][2] = 'notify'; $h++; } - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$object->id; - $head[$h][1] = $langs->trans("Info"); - $head[$h][2] = 'info'; - $h++; - } // Show more tabs from modules @@ -130,6 +123,15 @@ function societe_prepare_head($object) } } + // Log + if ($user->societe_id == 0) + { + $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$object->id; + $head[$h][1] = $langs->trans("Info"); + $head[$h][2] = 'info'; + $h++; + } + return $head; }