diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index da9f1b6e3f8..2ec4c39c1c7 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -347,7 +347,7 @@ if ($object->fetch($id) >= 0) print ''; print '
'; - print '
'; + print ''; print ''; print_titre($langs->trans("ToClearAllRecipientsClickHere")); print ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index fc3a386af02..93ee8e61692 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -72,6 +72,7 @@ class Contact extends CommonObject var $birthday; var $default_lang; var $note; // Private note + var $no_email; // 1=Don't send e-mail to this contact, 0=do var $ref_facturation; // Nb de reference facture pour lequel il est contact var $ref_contrat; // Nb de reference contrat pour lequel il est contact @@ -250,6 +251,7 @@ class Contact extends CommonObject $sql .= ", priv = '".$this->priv."'"; $sql .= ", fk_user_modif=".($user->id > 0 ? "'".$user->id."'":"null"); $sql .= ", default_lang=".($this->default_lang?"'".$this->default_lang."'":"null"); + $sql .= ", no_email=".($this->no_email?"'".$this->no_email."'":"null"); $sql .= " WHERE rowid=".$id; dol_syslog(get_class($this)."::update sql=".$sql,LOG_DEBUG); @@ -468,7 +470,7 @@ class Contact extends CommonObject $sql.= " c.fk_departement,"; $sql.= " c.birthday,"; $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid,"; - $sql.= " c.priv, c.note, c.default_lang, c.canvas,"; + $sql.= " c.priv, c.note, c.default_lang, c.no_email, c.canvas,"; $sql.= " c.import_key,"; $sql.= " p.libelle as country, p.code as country_code,"; $sql.= " d.nom as state, d.code_departement as state_code,"; @@ -536,6 +538,7 @@ class Contact extends CommonObject $this->birthday = $this->db->jdate($obj->birthday); $this->note = $obj->note; $this->default_lang = $obj->default_lang; + $this->no_email = $obj->no_email; $this->user_id = $obj->user_id; $this->user_login = $obj->user_login; $this->canvas = $obj->canvas; diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 96c80739461..8e0878ca733 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -146,6 +146,7 @@ if (empty($reshook)) $object->phone_mobile = $_POST["phone_mobile"]; $object->fax = $_POST["fax"]; $object->jabberid = $_POST["jabberid"]; + $object->no_email = $_POST["no_email"]; $object->priv = $_POST["priv"]; $object->note = $_POST["note"]; @@ -237,6 +238,7 @@ if (empty($reshook)) $object->phone_mobile = $_POST["phone_mobile"]; $object->fax = $_POST["fax"]; $object->jabberid = $_POST["jabberid"]; + $object->no_email = $_POST["no_email"]; $object->priv = $_POST["priv"]; $object->note = $_POST["note"]; @@ -448,8 +450,9 @@ else if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party print ''; - // Instant message - print ''; + // Instant message and no email + print ''; + print ''; // Visibility print ''; // Jabberid - print ''; + print ''; + print ''; // Visibility print ''; - // Instant message - print ''; + // Instant message and no email + print ''; + print ''; print '
'.$langs->trans("Email").'email).'">
'.$langs->trans("IM").'jabberid).'">
'.$langs->trans("IM").'jabberid).'">'.$langs->trans("No_Email").''.$form->selectyesno('no_email',(isset($_POST["no_email"])?$_POST["no_email"]:$object->no_email), 1).'
'.$langs->trans("ContactVisibility").''; @@ -623,7 +626,8 @@ else print '
Jabberidjabberid).'">
Jabberidjabberid).'">'.$langs->trans("No_Email").''.$form->selectyesno('no_email',(isset($_POST["no_email"])?$_POST["no_email"]:$object->no_email), 1).'
'.$langs->trans("ContactVisibility").''; @@ -815,8 +819,9 @@ else } print '
'.$langs->trans("IM").''.$object->jabberid.'
'.$langs->trans("IM").''.$object->jabberid.''.$langs->trans("No_Email").''.yn($object->no_email).'
'.$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