1029 |
if ($source == 'external') $sql.=" t.fk_soc as socid,"; |
if ($source == 'external') $sql.=" t.fk_soc as socid,"; |
1030 |
if ($source == 'internal') $sql.=" t.name as nom,"; |
if ($source == 'internal') $sql.=" t.name as nom,"; |
1031 |
if ($source == 'external') $sql.=" t.name as nom,"; |
if ($source == 'external') $sql.=" t.name as nom,"; |
1032 |
$sql.= "tc.code, tc.source, tc.libelle"; |
$sql.= "tc.source, tc.element, tc.code, tc.libelle"; |
1033 |
$sql.= " FROM ".MAIN_DB_PREFIX."element_contact ec,"; |
$sql.= " FROM ".MAIN_DB_PREFIX."element_contact ec,"; |
1034 |
if ($source == 'internal') $sql.=" ".MAIN_DB_PREFIX."user t,"; |
if ($source == 'internal') $sql.=" ".MAIN_DB_PREFIX."user t,"; |
1035 |
if ($source == 'external') $sql.=" ".MAIN_DB_PREFIX."socpeople t,"; |
if ($source == 'external') $sql.=" ".MAIN_DB_PREFIX."socpeople t,"; |
1054 |
{ |
{ |
1055 |
$obj = $this->db->fetch_object($resql); |
$obj = $this->db->fetch_object($resql); |
1056 |
|
|
1057 |
$libelle_type=($langs->trans("TypeContact".$obj->code)!=$langs->trans("TypeContact".$obj->code) ? $langs->trans("TypeContact".$obj->code) : $obj->libelle); |
$transkey="TypeContact_".$obj->element."_".$obj->source."_".$obj->code; |
1058 |
|
$libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle); |
1059 |
$tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id,'nom'=>$obj->nom, |
$tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id,'nom'=>$obj->nom, |
1060 |
'rowid'=>$obj->rowid,'code'=>$obj->code,'libelle'=>$libelle_type,'status'=>$obj->statut); |
'rowid'=>$obj->rowid,'code'=>$obj->code,'libelle'=>$libelle_type,'status'=>$obj->statut); |
1061 |
$i++; |
$i++; |
1107 |
*/ |
*/ |
1108 |
function liste_type_contact($source) |
function liste_type_contact($source) |
1109 |
{ |
{ |
1110 |
|
global $langs; |
1111 |
|
|
1112 |
|
$element='contrat'; |
1113 |
|
|
1114 |
$tab = array(); |
$tab = array(); |
1115 |
|
|
1116 |
$sql = "SELECT distinct tc.rowid, tc.code, tc.libelle"; |
$sql = "SELECT distinct tc.rowid, tc.code, tc.libelle"; |
1117 |
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; |
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; |
1118 |
$sql.= " WHERE element='contrat'"; |
$sql.= " WHERE element='".$element."'"; |
1119 |
$sql.= " AND source='".$source."'"; |
$sql.= " AND source='".$source."'"; |
1120 |
$sql.= " ORDER by tc.code"; |
$sql.= " ORDER by tc.code"; |
1121 |
|
|
1127 |
while ($i < $num) |
while ($i < $num) |
1128 |
{ |
{ |
1129 |
$obj = $this->db->fetch_object($result); |
$obj = $this->db->fetch_object($result); |
1130 |
$tab[$obj->rowid]=$obj->libelle; |
|
1131 |
|
$transkey="TypeContact_".$element."_".$source."_".$obj->code; |
1132 |
|
$libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle); |
1133 |
|
$tab[$obj->rowid]=$libelle_type; |
1134 |
$i++; |
$i++; |
1135 |
} |
} |
1136 |
return $tab; |
return $tab; |