Merge pull request #8691 from hregis/develop_email
Fix: use "socpeople" instead "societe"
This commit is contained in:
commit
9aa5633977
@ -680,7 +680,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='.$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;
|
||||
|
||||
@ -78,7 +78,7 @@ if (! $user->rights->societe->client->voir && ! $socid) $sql .= " ".MAIN_DB_PREF
|
||||
$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)";
|
||||
|
||||
@ -687,7 +687,10 @@ 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) $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)
|
||||
|
||||
@ -260,7 +260,7 @@ if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_conta
|
||||
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)";
|
||||
|
||||
@ -85,7 +85,7 @@ class box_contacts extends ModeleBoxes
|
||||
$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";
|
||||
|
||||
@ -1116,7 +1116,7 @@ abstract class CommonObject
|
||||
$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."'";
|
||||
@ -5582,7 +5582,7 @@ abstract class CommonObject
|
||||
$("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();
|
||||
});
|
||||
|
||||
@ -1332,7 +1332,7 @@ class Form
|
||||
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";
|
||||
|
||||
@ -122,7 +122,7 @@ class mailing_advthirdparties extends MailingTargets
|
||||
{
|
||||
$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).")";
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ class mailing_contacts1 extends MailingTargets
|
||||
$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";
|
||||
@ -95,7 +95,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('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";
|
||||
@ -123,7 +123,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('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";*/
|
||||
@ -161,7 +161,7 @@ class mailing_contacts1 extends MailingTargets
|
||||
$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";
|
||||
@ -236,7 +236,7 @@ class mailing_contacts1 extends MailingTargets
|
||||
$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";
|
||||
@ -278,7 +278,7 @@ class mailing_contacts1 extends MailingTargets
|
||||
$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";
|
||||
@ -374,7 +374,7 @@ class mailing_contacts1 extends MailingTargets
|
||||
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";
|
||||
|
||||
@ -322,7 +322,7 @@ class modSociete extends DolibarrModules
|
||||
$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)) {
|
||||
|
||||
@ -1934,7 +1934,7 @@ class Ticketsup extends CommonObject
|
||||
|
||||
// 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) . "'";
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user