Update commonobject.class.php

add complementary param
This commit is contained in:
BENKE Charles 2013-09-25 10:15:32 +02:00
parent d978d64d59
commit b400803a2a

View File

@ -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;