Skip to content
Snippets Groups Projects
Commit f5d76ac0 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix count of contact was not complete

parent 9b64fbaa
No related branches found
No related tags found
No related merge requests found
...@@ -122,14 +122,15 @@ class Contact extends CommonObject ...@@ -122,14 +122,15 @@ class Contact extends CommonObject
$sql = "SELECT count(sp.rowid) as nb"; $sql = "SELECT count(sp.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (sp.fk_soc = s.rowid)";
if (!$user->rights->societe->client->voir && !$user->societe_id) if (!$user->rights->societe->client->voir && !$user->societe_id)
{ {
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " OUTER JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
$sql.= " OUTER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql.= " WHERE sc.fk_user = " .$user->id; $sql.= " WHERE sc.fk_user = " .$user->id;
$clause = "AND"; $clause = "AND";
} }
$sql.= ' '.$clause.' s.entity IN ('.getEntity($this->element, 1).')'; $sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element, 1).')';
if ($user->societe_id > 0) $sql.=" AND sp.fk_soc = ".$user->societe_id;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment