Skip to content

Commit

Permalink
Merge pull request #8691 from hregis/develop_email
Browse files Browse the repository at this point in the history
Fix: use "socpeople" instead "societe"
  • Loading branch information
eldy committed Apr 27, 2018
2 parents 1cbf5f1 + 2906358 commit 9aa5633
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion htdocs/comm/action/index.php
Expand Up @@ -680,7 +680,7 @@
$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='.$user->id.'))';
$sql.= " AND sp.entity IN (".getEntity('societe').")";
$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
if ($action == 'show_day')
{
$sql.= ' AND MONTH(birthday) = '.$month;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/comm/contact.php
Expand Up @@ -78,7 +78,7 @@
$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('societe').")";
$sql.= " AND p.entity IN (".getEntity('socpeople').")";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($type == "c") $sql.= " AND s.client IN (1, 3)";
if ($type == "p") $sql.= " AND s.client IN (2, 3)";
Expand Down
5 changes: 4 additions & 1 deletion htdocs/contact/class/contact.class.php
Expand Up @@ -687,7 +687,10 @@ function fetch($id, $user=0, $ref_ext='')
$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) $sql .= " WHERE c.ref_ext = '".$this->db->escape($ref_ext)."'";
elseif ($ref_ext) {
$sql .= " WHERE c.entity IN (".getEntity($this->element).")";
$sql .= " AND c.ref_ext = '".$this->db->escape($ref_ext)."'";
}

$resql=$this->db->query($sql);
if ($resql)
Expand Down
2 changes: 1 addition & 1 deletion htdocs/contact/list.php
Expand Up @@ -260,7 +260,7 @@
if (! empty($search_categ_thirdparty)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
if (! empty($search_categ_supplier)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc"; // We need this table joined to the select in order to filter by categ
if (!$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('societe').')';
$sql.= ' WHERE p.entity IN ('.getEntity('socpeople').')';
if (!$user->rights->societe->client->voir && !$socid) //restriction
{
$sql .= " AND (sc.fk_user = " .$user->id." OR p.fk_soc IS NULL)";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/boxes/box_contacts.php
Expand Up @@ -85,7 +85,7 @@ function loadBox($max=5)
$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) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE sp.entity IN (".getEntity('societe').")";
$sql.= " WHERE sp.entity IN (".getEntity('socpeople').")";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($user->societe_id) $sql.= " AND sp.fk_soc = ".$user->societe_id;
$sql.= " ORDER BY sp.tms DESC";
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/class/commonobject.class.php
Expand Up @@ -1116,7 +1116,7 @@ function getIdContact($source,$code,$status=0)
$sql.= " WHERE ec.element_id = ".$id;
$sql.= " AND ec.fk_socpeople = c.rowid";
if ($source == 'internal') $sql.= " AND c.entity IN (0,".$conf->entity.")";
if ($source == 'external') $sql.= " AND c.entity IN (".getEntity('societe').")";
if ($source == 'external') $sql.= " AND c.entity IN (".getEntity('socpeople').")";
$sql.= " AND ec.fk_c_type_contact = tc.rowid";
$sql.= " AND tc.element = '".$element."'";
$sql.= " AND tc.source = '".$source."'";
Expand Down Expand Up @@ -5582,7 +5582,7 @@ function showInputField($val, $key, $value, $moreparam='', $keysuffix='', $keypr
$("a#'.dol_escape_js($keyprefix.$key.$keysuffix).'_add").click(function() {
$("'.dol_escape_js($newInput).'").insertBefore(this);
});
$(document).on("click", "a.'.dol_escape_js($keyprefix.$key.$keysuffix).'_del", function() {
$(this).parent().remove();
});
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/html.form.class.php
Expand Up @@ -1332,7 +1332,7 @@ function selectcontacts($socid, $selected='', $htmlname='contactid', $showempty=
if ($showsoc > 0) $sql.= " , s.nom as company";
$sql.= " FROM ".MAIN_DB_PREFIX ."socpeople as sp";
if ($showsoc > 0) $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX ."societe as s ON s.rowid=sp.fk_soc";
$sql.= " WHERE sp.entity IN (".getEntity('societe').")";
$sql.= " WHERE sp.entity IN (".getEntity('socpeople').")";
if ($socid > 0) $sql.= " AND sp.fk_soc=".$socid;
if (! empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND sp.statut <> 0";
$sql.= " ORDER BY sp.lastname ASC";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/mailings/advthirdparties.modules.php
Expand Up @@ -122,7 +122,7 @@ function add_to_target_spec($mailing_id,$socid,$type_of_target, $contactid)
{
$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('societe').")";
$sql.= " WHERE socp.entity IN (".getEntity('socpeople').")";
if (count($contactid)>0) {
$sql.= " AND socp.rowid IN (".implode(',',$contactid).")";
}
Expand Down
14 changes: 7 additions & 7 deletions htdocs/core/modules/mailings/contacts1.modules.php
Expand Up @@ -71,7 +71,7 @@ function getSqlArrayForStats()
$statssql[0] = "SELECT '".$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('societe').")";
$statssql[0].= " WHERE c.entity IN (".getEntity('socpeople').")";
$statssql[0].= " AND c.email != ''"; // Note that null != '' is false
$statssql[0].= " AND c.no_email = 0";
$statssql[0].= " AND c.statut = 1";
Expand All @@ -95,7 +95,7 @@ function getNbOfRecipients($sql='')
$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('societe').")";
$sql.= " WHERE c.entity IN (".getEntity('socpeople').")";
$sql.= " AND c.email != ''"; // Note that null != '' is false
$sql.= " AND c.no_email = 0";
$sql.= " AND c.statut = 1";
Expand Down Expand Up @@ -123,7 +123,7 @@ function formFilter()
// 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('societe').")";
$sql.= " WHERE sp.entity IN (".getEntity('socpeople').")";
/*$sql.= " AND sp.email != ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0";
$sql.= " AND sp.statut = 1";*/
Expand Down Expand Up @@ -161,7 +161,7 @@ function formFilter()
$sql.= " WHERE sp.statut = 1"; // Note that null != '' is false
//$sql.= " AND sp.no_email = 0";
//$sql.= " AND sp.email != ''";
//$sql.= " AND sp.entity IN (".getEntity('societe').")";
//$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
$sql.= " AND cs.fk_categorie = c.rowid";
$sql.= " AND cs.fk_socpeople = sp.rowid";
$sql.= " GROUP BY c.label";
Expand Down Expand Up @@ -236,7 +236,7 @@ function formFilter()
$sql.= " WHERE sp.statut = 1"; // Note that null != '' is false
//$sql.= " AND sp.no_email = 0";
//$sql.= " AND sp.email != ''";
//$sql.= " AND sp.entity IN (".getEntity('societe').")";
//$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
$sql.= " AND cs.fk_categorie = c.rowid";
$sql.= " AND cs.fk_soc = sp.fk_soc";
$sql.= " GROUP BY c.label";
Expand Down Expand Up @@ -278,7 +278,7 @@ function formFilter()
$sql.= " WHERE sp.statut = 1"; // Note that null != '' is false
//$sql.= " AND sp.no_email = 0";
//$sql.= " AND sp.email != ''";
//$sql.= " AND sp.entity IN (".getEntity('societe').")";
//$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
$sql.= " AND cs.fk_categorie = c.rowid";
$sql.= " AND cs.fk_soc = sp.fk_soc";
$sql.= " GROUP BY c.label";
Expand Down Expand Up @@ -374,7 +374,7 @@ function add_to_target($mailing_id,$filtersarray=array())
if ($filter_category_customer <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as c2s";
if ($filter_category_supplier <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c3";
if ($filter_category_supplier <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_fournisseur as c3s";
$sql.= " WHERE sp.entity IN (".getEntity('societe').")";
$sql.= " WHERE sp.entity IN (".getEntity('socpeople').")";
$sql.= " AND sp.email <> ''";
$sql.= " AND sp.no_email = 0";
$sql.= " AND sp.statut = 1";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/modSociete.class.php
Expand Up @@ -322,7 +322,7 @@ function __construct($db)
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON c.fk_departement = d.rowid';
$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] .=' WHERE c.entity IN ('.getEntity('societe').')';
$this->export_sql_end[$r] .=' WHERE c.entity IN ('.getEntity('socpeople').')';
if (is_object($user) && empty($user->rights->societe->client->voir)) {
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' ';
if (! empty($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS)) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/ticketsup/class/ticketsup.class.php
Expand Up @@ -1934,7 +1934,7 @@ public function searchContactByEmail($email, $socid = '', $case = '')

// Generation requete recherche
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "socpeople";
$sql .= " WHERE entity IN (" . getEntity('ticketsup', 1) . ")";
$sql .= " WHERE entity IN (" . getEntity('socpeople') . ")";
if (!empty($socid)) {
$sql .= " AND fk_soc='" . $this->db->escape($socid) . "'";
}
Expand Down

0 comments on commit 9aa5633

Please sign in to comment.