diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 4142ff9a958..1b4340276f8 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -931,7 +931,7 @@ if ($showbirthday) { $sql = 'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday'; $sql .= ' FROM '.MAIN_DB_PREFIX.'socpeople as sp'; $sql .= ' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.((int) $user->id).'))'; - $sql .= " AND sp.entity IN (".getEntity('socpeople').")"; + $sql .= " AND sp.entity IN (".getEntity('contact').")"; if ($mode == 'show_day') { $sql .= ' AND MONTH(birthday) = '.((int) $month); $sql .= ' AND DAY(birthday) = '.((int) $day); diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index 62f57c008ba..d83fdbcb78c 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -88,7 +88,7 @@ if (empty($user->rights->societe->client->voir) && !$socid) { $sql .= " ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; $sql .= " WHERE s.fk_stcomm = st.id"; -$sql .= " AND p.entity IN (".getEntity('socpeople').")"; +$sql .= " AND p.entity IN (".getEntity('contact').")"; if (empty($user->rights->societe->client->voir) && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 79e25c83385..62dd24aaaf7 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -686,7 +686,7 @@ class AdvanceTargetingMailing extends CommonObject $sqlwhere = array(); - $sqlwhere[] = 't.entity IN ('.getEntity('socpeople').')'; + $sqlwhere[] = 't.entity IN ('.getEntity('contact').')'; if (count($arrayquery) > 0) { if (array_key_exists('contact_categ', $arrayquery)) { diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 92549312e59..487c075b3a1 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1826,7 +1826,7 @@ class Contact extends CommonObject $this->db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_socpeople=".((int) $this->id)." AND entity IN (".getEntity("societe_contact").")"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_socpeople=".((int) $this->id)." AND entity IN (".getEntity("contact").")"; $result = $this->db->query($sql); if (!$result) { diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 66561730829..f85cb6dbeee 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -405,7 +405,7 @@ if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') { if (empty($user->rights->societe->client->voir) && !$socid) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; } -$sql .= ' WHERE p.entity IN ('.getEntity('socpeople').')'; +$sql .= ' WHERE p.entity IN ('.getEntity('contact').')'; if (empty($user->rights->societe->client->voir) && !$socid) { //restriction $sql .= " AND (sc.fk_user = ".((int) $user->id)." OR p.fk_soc IS NULL)"; } diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index f9938a02aa1..b2ba608d689 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -110,7 +110,7 @@ class box_contacts extends ModeleBoxes if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } - $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; + $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; if (empty($user->rights->societe->client->voir) && !$user->socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ea6d145641a..eca88386656 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1677,7 +1677,7 @@ class Form if ($showsoc > 0 || !empty($conf->global->CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST)) { $sql .= " LEFT OUTER JOIN ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc"; } - $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; + $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; if ($socid > 0 || $socid == -1) { $sql .= " AND sp.fk_soc = ".((int) $socid); } diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index cbf668b6c67..538e5389727 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -123,7 +123,7 @@ class mailing_advthirdparties extends MailingTargets if (count($socid) > 0 || count($contactid) > 0) { $sql = "SELECT socp.rowid as id, socp.email as email, socp.lastname as lastname, socp.firstname as firstname"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as socp"; - $sql .= " WHERE socp.entity IN (".getEntity('socpeople').")"; + $sql .= " WHERE socp.entity IN (".getEntity('contact').")"; if (count($contactid) > 0) { $sql .= " AND socp.rowid IN (".$this->db->sanitize(implode(',', $contactid)).")"; } diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 4b928d8af07..d43c95720d3 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -78,7 +78,7 @@ class mailing_contacts1 extends MailingTargets $statssql[0] = "SELECT '".$this->db->escape($langs->trans("NbOfCompaniesContacts"))."' as label,"; $statssql[0] .= " count(distinct(c.email)) as nb"; $statssql[0] .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; - $statssql[0] .= " WHERE c.entity IN (".getEntity('socpeople').")"; + $statssql[0] .= " WHERE c.entity IN (".getEntity('contact').")"; $statssql[0] .= " AND c.email <> ''"; // Note that null != '' is false $statssql[0] .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0"; $statssql[0] .= " AND c.statut = 1"; @@ -102,7 +102,7 @@ class mailing_contacts1 extends MailingTargets $sql = "SELECT count(distinct(c.email)) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc"; - $sql .= " WHERE c.entity IN (".getEntity('socpeople').")"; + $sql .= " WHERE c.entity IN (".getEntity('contact').")"; $sql .= " AND c.email <> ''"; // Note that null != '' is false $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0"; // exclude unsubscribed users @@ -130,7 +130,7 @@ class mailing_contacts1 extends MailingTargets // Add filter on job position $sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; - $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; + $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; $sql .= " AND sp.email <> ''"; // Note that null != '' is false $sql .= " AND sp.statut = 1"; $sql .= " AND (sp.poste IS NOT NULL AND sp.poste <> '')"; @@ -165,7 +165,7 @@ class mailing_contacts1 extends MailingTargets $sql .= " ".MAIN_DB_PREFIX."socpeople as sp,"; $sql .= " ".MAIN_DB_PREFIX."categorie as c,"; $sql .= " ".MAIN_DB_PREFIX."categorie_contact as cs"; - $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; + $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; $sql .= " AND sp.email <> ''"; // Note that null != '' is false $sql .= " AND sp.statut = 1"; $sql .= " AND cs.fk_categorie = c.rowid"; @@ -238,7 +238,7 @@ class mailing_contacts1 extends MailingTargets $sql .= " ".MAIN_DB_PREFIX."socpeople as sp,"; $sql .= " ".MAIN_DB_PREFIX."categorie as c,"; $sql .= " ".MAIN_DB_PREFIX."categorie_societe as cs"; - $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; + $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; $sql .= " AND sp.email <> ''"; // Note that null != '' is false $sql .= " AND sp.statut = 1"; $sql .= " AND cs.fk_categorie = c.rowid"; @@ -275,7 +275,7 @@ class mailing_contacts1 extends MailingTargets $sql .= " ".MAIN_DB_PREFIX."socpeople as sp,"; $sql .= " ".MAIN_DB_PREFIX."categorie as c,"; $sql .= " ".MAIN_DB_PREFIX."categorie_fournisseur as cs"; - $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; + $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; $sql .= " AND sp.email <> ''"; // Note that null != '' is false $sql .= " AND sp.statut = 1"; $sql .= " AND cs.fk_categorie = c.rowid"; @@ -375,7 +375,7 @@ class mailing_contacts1 extends MailingTargets $sql .= ", ".MAIN_DB_PREFIX."categorie as c3"; $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as c3s"; } - $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; + $sql .= " WHERE sp.entity IN (".getEntity('contact').")"; $sql .= " AND sp.email <> ''"; $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = sp.email) = 0"; // Exclude unsubscribed email adresses diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index b81dffc0657..09089d57563 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -380,7 +380,7 @@ class modSociete extends DolibarrModules // Add multicompany field if (! empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) { if (!empty($conf->multicompany->enabled)) { - $nbofallowedentities = count(explode(',', getEntity('socpeople'))); + $nbofallowedentities = count(explode(',', getEntity('contact'))); if ($nbofallowedentities > 1) { $this->export_fields_array[$r]['c.entity'] = 'Entity'; } @@ -437,7 +437,7 @@ class modSociete extends DolibarrModules $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id'; - $this->export_sql_end[$r] .= ' WHERE c.entity IN ('.getEntity('socpeople').')'; + $this->export_sql_end[$r] .= ' WHERE c.entity IN ('.getEntity('contact').')'; if (is_object($user) && empty($user->rights->societe->client->voir)) { $this->export_sql_end[$r] .= ' AND (sc.fk_user = '.((int) $user->id).' '; if (!empty($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS)) { diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 89a29d7c4cd..3e7e1ac2080 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -192,7 +192,7 @@ class Contacts extends DolibarrApi $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON t.fk_soc = s.rowid"; - $sql .= ' WHERE t.entity IN ('.getEntity('socpeople').')'; + $sql .= ' WHERE t.entity IN ('.getEntity('contact').')'; if ($socids) { $sql .= " AND t.fk_soc IN (".$this->db->sanitize($socids).")"; } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 14c1e0719a3..84e45c2dad0 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1933,7 +1933,7 @@ class Ticket extends CommonObject // Generation requete recherche $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."socpeople"; - $sql .= " WHERE entity IN (".getEntity('socpeople').")"; + $sql .= " WHERE entity IN (".getEntity('contact').")"; if (!empty($socid)) { $sql .= " AND fk_soc='".$this->db->escape($socid)."'"; }