Fix: Translation of civility

This commit is contained in:
Laurent Destailleur 2011-01-23 22:39:48 +00:00
parent 261feb2b98
commit e208dd4068
3 changed files with 31 additions and 16 deletions

View File

@ -801,8 +801,8 @@ class Contact extends CommonObject
/** /**
* \brief Retourne le libelle de civilite du contact * Return label of a civility contact
* \return string Nom traduit de la civilite * @return string Translated name of civility
*/ */
function getCivilityLabel() function getCivilityLabel()
{ {
@ -810,7 +810,14 @@ class Contact extends CommonObject
$langs->load("dict"); $langs->load("dict");
$code=$this->civilite_id; $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;
} }

View File

@ -320,8 +320,8 @@ class Translate {
/** /**
* \brief Mark domain as not loaded to be able to load it again. * 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. * @param domain File name to load (.lang file). Use @ before value if domain is in a module directory.
*/ */
function UnLoad($domain) function UnLoad($domain)
{ {
@ -330,8 +330,8 @@ class Translate {
} }
/** /**
* \brief Retourn list of files already loaded into memory * Return list of files already loaded into memory
* \return string List of files loaded into memory "main=1,errors=1,..." * @return string List of files loaded into memory "main=1,errors=1,..."
*/ */
function list_domainloaded() function list_domainloaded()
{ {
@ -346,7 +346,9 @@ class Translate {
/** /**
* Return translated value of key. Search in lang file, then into database. * 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 * @param key
* @return string * @return string
@ -371,7 +373,11 @@ class Translate {
{ {
$newstr=$this->getLabelFromKey($db,$reg[1],'c_paiement','code','libelle'); $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;
} }

View File

@ -104,13 +104,6 @@ function societe_prepare_head($object)
$head[$h][2] = 'notify'; $head[$h][2] = 'notify';
$h++; $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 // 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; return $head;
} }