diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c2a8a052df1..7eae4f9faed 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -453,7 +453,7 @@ abstract class CommonObject * @param string $option 0=Return array id->label, 1=Return array code->label * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) */ - function liste_type_contact($source='internal', $order='code', $option=0) + function liste_type_contact($source='internal', $order='code', $option=0, $activeonly=0) { global $langs; @@ -461,7 +461,9 @@ abstract class CommonObject $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " WHERE tc.element='".$this->element."'"; - $sql.= " AND tc.active=1"; // only the active type + if ($activeonly == 1) + $sql.= " AND tc.active=1"; // only the active type + if (! empty($source)) $sql.= " AND tc.source='".$source."'"; $sql.= " ORDER by tc.".$order;