| '.$langs->trans("ContactVisibility").' | ';
print $object->LibPubPriv($object->priv);
diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php
index 5aeed0d784a..e24c09aebe5 100755
--- a/htdocs/core/modules/mailings/contacts1.modules.php
+++ b/htdocs/core/modules/mailings/contacts1.modules.php
@@ -77,6 +77,7 @@ class mailing_contacts1 extends MailingTargets
$statssql[0].= " AND c.entity IN (".getEntity('societe', 1).")";
$statssql[0].= " AND s.client IN (1, 3)";
$statssql[0].= " AND c.email != ''"; // Note that null != '' is false
+ $statssql[0].= " AND c.no_email = 0";
return $statssql;
}
@@ -99,6 +100,7 @@ class mailing_contacts1 extends MailingTargets
$sql .= " WHERE s.rowid = c.fk_soc";
$sql .= " AND c.entity IN (".getEntity('societe', 1).")";
$sql .= " AND c.email != ''"; // Note that null != '' is false
+ $sql .= " AND c.no_email = 0";
// La requete doit retourner un champ "nb" pour etre comprise
// par parent::getNbOfRecipients
@@ -205,6 +207,7 @@ class mailing_contacts1 extends MailingTargets
$sql.= " WHERE s.rowid = c.fk_soc";
$sql.= " AND c.entity IN (".getEntity('societe', 1).")";
$sql.= " AND c.email != ''";
+ $sql.= " AND c.no_email = 0";
foreach($filtersarray as $key)
{
if ($key == 'prospects') $sql.= " AND s.client=2";
diff --git a/htdocs/core/modules/mailings/contacts2.modules.php b/htdocs/core/modules/mailings/contacts2.modules.php
index ed1905d634e..5332210fe73 100755
--- a/htdocs/core/modules/mailings/contacts2.modules.php
+++ b/htdocs/core/modules/mailings/contacts2.modules.php
@@ -84,6 +84,7 @@ class mailing_contacts2 extends MailingTargets
$sql.= " ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE s.rowid = sp.fk_soc";
$sql.= " AND sp.email != ''"; // Note that null != '' is false
+ $sql.= " AND sp.no_email = 0";
//$sql.= " AND sp.poste != ''";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
if ($filtersarray[0]<>'all') $sql.= " AND sp.poste ='".$filtersarray[0]."'";
@@ -165,6 +166,7 @@ class mailing_contacts2 extends MailingTargets
$sql.= " WHERE s.rowid = sp.fk_soc";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
$sql.= " AND sp.email != ''"; // Note that null != '' is false
+ $sql.= " AND sp.no_email = 0";
//$sql.= " AND sp.poste != ''";
// La requete doit retourner un champ "nb" pour etre comprise
// par parent::getNbOfRecipients
@@ -189,6 +191,7 @@ class mailing_contacts2 extends MailingTargets
$sql.= " WHERE s.rowid = sp.fk_soc";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
$sql.= " AND sp.email != ''"; // Note that null != '' is false
+ $sql.= " AND sp.no_email = 0";
$sql.= " AND (sp.poste IS NOT NULL AND sp.poste != '')";
$sql.= " GROUP BY sp.poste";
$sql.= " ORDER BY sp.poste";
diff --git a/htdocs/core/modules/mailings/contacts3.modules.php b/htdocs/core/modules/mailings/contacts3.modules.php
index 9f0453ada2f..be2372426fc 100755
--- a/htdocs/core/modules/mailings/contacts3.modules.php
+++ b/htdocs/core/modules/mailings/contacts3.modules.php
@@ -85,6 +85,7 @@ class mailing_contacts3 extends MailingTargets
if ($filtersarray[0] <> 'all') $sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs";
$sql.= " WHERE s.rowid = sp.fk_soc";
$sql.= " AND sp.email != ''"; // Note that null != '' is false
+ $sql.= " AND sp.no_email = 0";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_categorie = c.rowid";
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_societe = sp.fk_soc";
@@ -171,6 +172,7 @@ class mailing_contacts3 extends MailingTargets
$sql.= " WHERE s.rowid = c.fk_soc";
$sql.= " AND c.entity IN (".getEntity('societe', 1).")";
$sql.= " AND c.email != ''"; // Note that null != '' is false
+ $sql.= " AND c.no_email = 0";
/*
$sql = "SELECT count(distinct(sp.email)) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
@@ -207,6 +209,7 @@ class mailing_contacts3 extends MailingTargets
$sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs";
$sql.= " WHERE s.rowid = sp.fk_soc";
$sql.= " AND sp.email != ''"; // Note that null != '' is false
+ $sql.= " AND sp.no_email = 0";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
$sql.= " AND cs.fk_categorie = c.rowid";
$sql.= " AND cs.fk_societe = sp.fk_soc";
diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql
index e1d124eee8b..57f61c19bdd 100755
--- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql
+++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql
@@ -71,3 +71,5 @@ ALTER TABLE llx_commande_fournisseur CHANGE fk_methode_commande fk_input_method
INSERT INTO llx_const (name, value, type, note, visible) values ('PRODUCT_CODEPRODUCT_ADDON','mod_codeproduct_leopard','yesno','Module to control product codes',0);
ALTER TABLE llx_c_barcode_type ADD UNIQUE INDEX uk_c_barcode_type(code, entity);
+
+ALTER TABLE llx_socpeople ADD column no_email SMALLINT NOT NULL DEFAULT 0 AFTER priv;
diff --git a/htdocs/install/mysql/tables/llx_socpeople.sql b/htdocs/install/mysql/tables/llx_socpeople.sql
index 534d0abbdd6..532f752d331 100644
--- a/htdocs/install/mysql/tables/llx_socpeople.sql
+++ b/htdocs/install/mysql/tables/llx_socpeople.sql
@@ -41,6 +41,7 @@ create table llx_socpeople
fax varchar(30),
email varchar(255),
jabberid varchar(255),
+ no_email smallint NOT NULL DEFAULT 0,
priv smallint NOT NULL DEFAULT 0,
fk_user_creat integer DEFAULT 0, -- user qui a creel'enregistrement
fk_user_modif integer,
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index b2bf2106f90..d2c6af5167b 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -68,6 +68,7 @@ Phone=Phone
PhonePro=Prof. phone
PhonePerso=Pers. phone
PhoneMobile=Mobile
+No_Email=Don't send e-mail
Fax=Fax
Zip=Zip Code
Town=City
diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang
index ae6b8c44369..2c0144f449e 100644
--- a/htdocs/langs/fr_FR/companies.lang
+++ b/htdocs/langs/fr_FR/companies.lang
@@ -70,6 +70,7 @@ Phone=Téléphone
PhonePro=Tél pro.
PhonePerso=Tél perso.
PhoneMobile=Tél portable
+No_Email=Ne pas envoyer d'e-mail
Fax=Fax
Zip=Code postal
Town=Ville
|