FIX filter on entity must be done as soon as we don't search on rowid.
This commit is contained in:
parent
84983140b6
commit
5a7cb95b72
@ -682,12 +682,13 @@ class Contact extends CommonObject
|
||||
/**
|
||||
* Load object contact
|
||||
*
|
||||
* @param int $id id du contact
|
||||
* @param User $user Utilisateur (abonnes aux alertes) qui veut les alertes de ce contact
|
||||
* @param string $ref_ext External reference, not given by Dolibarr
|
||||
* @return int -1 if KO, 0 if OK but not found, 1 if OK
|
||||
* @param int $id id du contact
|
||||
* @param User $user Utilisateur (abonnes aux alertes) qui veut les alertes de ce contact
|
||||
* @param string $ref_ext External reference, not given by Dolibarr
|
||||
* @param string $email Email
|
||||
* @return int -1 if KO, 0 if OK but not found, 1 if OK
|
||||
*/
|
||||
function fetch($id, $user=0, $ref_ext='')
|
||||
function fetch($id, $user=0, $ref_ext='', $email='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -721,9 +722,15 @@ class Contact extends CommonObject
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
|
||||
if ($id) $sql.= " WHERE c.rowid = ". $id;
|
||||
elseif ($ref_ext) {
|
||||
else
|
||||
{
|
||||
$sql .= " WHERE c.entity IN (".getEntity($this->element).")";
|
||||
$sql .= " AND c.ref_ext = '".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_ext) {
|
||||
$sql .= " AND c.ref_ext = '".$this->db->escape($ref_ext)."'";
|
||||
}
|
||||
if ($email) {
|
||||
$sql .= " AND c.email = '".$this->db->escape($email)."'";
|
||||
}
|
||||
}
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user