Fix: [ bug #889 ] Titre civilité ne s'affiche
This commit is contained in:
parent
d9e477d748
commit
df6c796413
@ -1493,19 +1493,17 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Return civility label of a contact
|
||||
* Return civility label of a member
|
||||
*
|
||||
* @param int $nohtmlentities 0=Encode with htmlentities for HTML output, 1=No htmlentities for memory translation
|
||||
* @return string Name translated of civility
|
||||
* @return string Translated name of civility
|
||||
*/
|
||||
function getCivilityLabel($nohtmlentities=0)
|
||||
function getCivilityLabel()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("dict");
|
||||
|
||||
$code=$this->civilite_id;
|
||||
if ($nohtmlentities) return $langs->transnoentities("Civility".$code)!="Civility".$code ? $langs->transnoentities("Civility".$code) : $code;
|
||||
else return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : $code;
|
||||
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civilite", "code", "civilite", $code);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -874,9 +874,9 @@ class Contact extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label of a civility contact
|
||||
* Return civility label of contact
|
||||
*
|
||||
* @return string Translated name of civility
|
||||
* @return string Translated name of civility
|
||||
*/
|
||||
function getCivilityLabel()
|
||||
{
|
||||
@ -884,7 +884,7 @@ class Contact extends CommonObject
|
||||
$langs->load("dict");
|
||||
|
||||
$code=$this->civilite_id;
|
||||
return $langs->trans("Civility".$code)!="Civility".$code ? $langs->trans("Civility".$code) : '';
|
||||
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civilite", "code", "civilite", $code);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -643,13 +643,15 @@ class Translate
|
||||
* Store key-label found into cache variable $this->cache_labels to save SQL requests to get labels.
|
||||
*
|
||||
* @param DoliBD $db Database handler
|
||||
* @param string $key Key to get label (key in language file)
|
||||
* @param string $key Translation key to get label (key in language file)
|
||||
* @param string $tablename Table name without prefix
|
||||
* @param string $fieldkey Field for key
|
||||
* @param string $fieldlabel Field for label
|
||||
* @param string $keyforselect Use another value than the translation key for the where into select
|
||||
* @return string Label in UTF8 (but without entities)
|
||||
* @see dol_getIdFromCode
|
||||
*/
|
||||
function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel)
|
||||
function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel,$keyforselect='')
|
||||
{
|
||||
// If key empty
|
||||
if ($key == '') return '';
|
||||
@ -670,7 +672,7 @@ class Translate
|
||||
|
||||
$sql = "SELECT ".$fieldlabel." as label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
|
||||
$sql.= " WHERE ".$fieldkey." = '".$key."'";
|
||||
$sql.= " WHERE ".$fieldkey." = '".($keyforselect?$keyforselect:$key)."'";
|
||||
dol_syslog(get_class($this).'::getLabelFromKey sql='.$sql,LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -4071,6 +4071,7 @@ function dol_osencode($str)
|
||||
* @param string $fieldkey Field for code
|
||||
* @param string $fieldid Field for id
|
||||
* @return int Id of code
|
||||
* @see getLabelFromKey
|
||||
*/
|
||||
function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id')
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user