Fix: limited to a certain status
This commit is contained in:
parent
397c5487d0
commit
3d0d2053bb
@ -296,21 +296,24 @@ class CommonObject
|
|||||||
* Exemple: contact interne suivi paiement ('internal', 'SALESREPFOLL')
|
* Exemple: contact interne suivi paiement ('internal', 'SALESREPFOLL')
|
||||||
* \param source 'external' or 'internal'
|
* \param source 'external' or 'internal'
|
||||||
* \param code 'BILLING', 'SHIPPING', 'SALESREPFOLL', ...
|
* \param code 'BILLING', 'SHIPPING', 'SALESREPFOLL', ...
|
||||||
|
** \param status limited to a certain status
|
||||||
* \return array Liste des id contacts
|
* \return array Liste des id contacts
|
||||||
*/
|
*/
|
||||||
function getIdContact($source,$code)
|
function getIdContact($source,$code,$status=0)
|
||||||
{
|
{
|
||||||
$result=array();
|
$result=array();
|
||||||
$i=0;
|
$i=0;
|
||||||
|
|
||||||
$sql = "SELECT ec.fk_socpeople";
|
$sql = "SELECT ec.fk_socpeople";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as tc";
|
$sql.= " FROM ".MAIN_DB_PREFIX."element_contact as ec";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||||
$sql.= " WHERE ec.element_id = ".$this->id;
|
$sql.= " WHERE ec.element_id = ".$this->id;
|
||||||
$sql.= " AND ec.fk_c_type_contact = tc.rowid";
|
$sql.= " AND ec.fk_c_type_contact = tc.rowid";
|
||||||
$sql.= " AND tc.element = '".$this->element."'";
|
$sql.= " AND tc.element = '".$this->element."'";
|
||||||
$sql.= " AND tc.source = '".$source."'";
|
$sql.= " AND tc.source = '".$source."'";
|
||||||
$sql.= " AND tc.code = '".$code."'";
|
$sql.= " AND tc.code = '".$code."'";
|
||||||
$sql.= " AND tc.active = 1";
|
$sql.= " AND tc.active = 1";
|
||||||
|
if ($status) $sql.= " AND ec.statut = ".$status;
|
||||||
|
|
||||||
dol_syslog("CommonObject::getIdContact sql=".$sql);
|
dol_syslog("CommonObject::getIdContact sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user