';
if (!$i) $totalarray['nbfield']++;
}
if (!empty($conf->socialnetworks->enabled)) {
diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php
index deb1b1e12c6..3e66210ee6e 100644
--- a/htdocs/core/modules/mailings/contacts1.modules.php
+++ b/htdocs/core/modules/mailings/contacts1.modules.php
@@ -79,8 +79,8 @@ class mailing_contacts1 extends MailingTargets
$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] .= " AND c.email != ''"; // Note that null != '' is false
- $statssql[0] .= " AND c.no_email = 0";
+ $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";
return $statssql;
@@ -103,8 +103,7 @@ class mailing_contacts1 extends MailingTargets
$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 .= " AND c.email != ''"; // Note that null != '' is false
- $sql .= " AND c.no_email = 0";
+ $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
$sql .= " AND c.statut = 1";
@@ -132,10 +131,9 @@ class mailing_contacts1 extends MailingTargets
$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.= " AND sp.email != ''"; // Note that null != '' is false
- $sql.= " AND sp.no_email = 0";
- $sql.= " AND sp.statut = 1";*/
- $sql .= " AND (sp.poste IS NOT NULL AND sp.poste != '')";
+ $sql .= " AND sp.email <> ''"; // Note that null != '' is false
+ $sql .= " AND sp.statut = 1";
+ $sql .= " AND (sp.poste IS NOT NULL AND sp.poste <> '')";
$sql .= " GROUP BY sp.poste";
$sql .= " ORDER BY sp.poste";
$resql = $this->db->query($sql);
@@ -165,10 +163,9 @@ 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.statut = 1"; // Note that null != '' is false
- //$sql.= " AND sp.no_email = 0";
- //$sql.= " AND sp.email != ''";
- //$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
+ $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
+ $sql .= " AND sp.email <> ''"; // Note that null != '' is false
+ $sql .= " AND sp.statut = 1";
$sql .= " AND cs.fk_categorie = c.rowid";
$sql .= " AND cs.fk_socpeople = sp.rowid";
$sql .= " GROUP BY c.label";
@@ -236,10 +233,9 @@ 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.statut = 1"; // Note that null != '' is false
- //$sql.= " AND sp.no_email = 0";
- //$sql.= " AND sp.email != ''";
- //$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
+ $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
+ $sql .= " AND sp.email <> ''"; // Note that null != '' is false
+ $sql .= " AND sp.statut = 1";
$sql .= " AND cs.fk_categorie = c.rowid";
$sql .= " AND cs.fk_soc = sp.fk_soc";
$sql .= " GROUP BY c.label";
@@ -275,10 +271,9 @@ 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.statut = 1"; // Note that null != '' is false
- //$sql.= " AND sp.no_email = 0";
- //$sql.= " AND sp.email != ''";
- //$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
+ $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
+ $sql .= " AND sp.email <> ''"; // Note that null != '' is false
+ $sql .= " AND sp.statut = 1";
$sql .= " AND cs.fk_categorie = c.rowid";
$sql .= " AND cs.fk_soc = sp.fk_soc";
$sql .= " GROUP BY c.label";
@@ -373,7 +368,6 @@ class mailing_contacts1 extends MailingTargets
if ($filter_category_supplier <> 'all') $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as c3s";
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
$sql .= " AND sp.email <> ''";
- $sql .= " AND sp.no_email = 0";
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = sp.email) = 0";
// Exclude unsubscribed email adresses
$sql .= " AND sp.statut = 1";
diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php
index 8e8c9fe4e4f..1a533591b18 100644
--- a/htdocs/core/modules/mailings/modules_mailings.php
+++ b/htdocs/core/modules/mailings/modules_mailings.php
@@ -206,26 +206,26 @@ class MailingTargets // This can't be abstract as it is used for some method
dol_syslog(__METHOD__.": mailing ".$j." targets added");
/*
- //Update the status to show thirdparty mail that don't want to be contacted anymore'
- $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
- $sql .= " SET statut=3";
- $sql .= " WHERE fk_mailing=".$mailing_id." AND email in (SELECT email FROM ".MAIN_DB_PREFIX."societe where fk_stcomm=-1)";
- $sql .= " AND source_type='thirdparty'";
- dol_syslog(__METHOD__.": mailing update status to display thirdparty mail that do not want to be contacted");
- $result=$this->db->query($sql);
-
- //Update the status to show contact mail that don't want to be contacted anymore'
- $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
- $sql .= " SET statut=3";
- $sql .= " WHERE fk_mailing=".$mailing_id." AND source_type='contact' AND (email in (SELECT sc.email FROM ".MAIN_DB_PREFIX."socpeople AS sc ";
- $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid=sc.fk_soc WHERE s.fk_stcomm=-1 OR no_email=1))";
- dol_syslog(__METHOD__.": mailing update status to display contact mail that do not want to be contacted",LOG_DEBUG);
- $result=$this->db->query($sql);
- */
-
+ //Update the status to show thirdparty mail that don't want to be contacted anymore'
+ $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
+ $sql .= " SET statut=3";
+ $sql .= " WHERE fk_mailing=".$mailing_id." AND email in (SELECT email FROM ".MAIN_DB_PREFIX."societe where fk_stcomm=-1)";
+ $sql .= " AND source_type='thirdparty'";
+ dol_syslog(__METHOD__.": mailing update status to display thirdparty mail that do not want to be contacted");
+ $result=$this->db->query($sql);
+
+ //Update the status to show contact mail that don't want to be contacted anymore'
+ $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
+ $sql .= " SET statut=3";
+ $sql .= " WHERE fk_mailing=".$mailing_id." AND source_type='contact' AND (email in (SELECT sc.email FROM ".MAIN_DB_PREFIX."socpeople AS sc ";
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid=sc.fk_soc WHERE s.fk_stcomm=-1 OR no_email=1))";
+ dol_syslog(__METHOD__.": mailing update status to display contact mail that do not want to be contacted",LOG_DEBUG);
+ $result=$this->db->query($sql);
+ */
+
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql .= " SET statut=3";
- $sql .= " WHERE fk_mailing=".$mailing_id." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))";
+ $sql .= " WHERE fk_mailing=".((int) $mailing_id)." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))";
dol_syslog(__METHOD__.":mailing update status to display emails that do not want to be contacted anymore", LOG_DEBUG);
$result = $this->db->query($sql);
diff --git a/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_static.php b/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_static.php
index 969bb165e62..f7540e107fd 100644
--- a/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_static.php
+++ b/htdocs/includes/tecnickcom/tcpdf/include/tcpdf_static.php
@@ -1440,6 +1440,10 @@ class TCPDF_STATIC {
*/
public static function intToRoman($number) {
$roman = '';
+ if ($number >= 4000) {
+ // do not represent numbers above 4000 in Roman numerals
+ return strval($number);
+ }
while ($number >= 1000) {
$roman .= 'M';
$number -= 1000;
diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang
index a7cfde68ae7..3a1612a9d9d 100644
--- a/htdocs/langs/en_US/mails.lang
+++ b/htdocs/langs/en_US/mails.lang
@@ -60,6 +60,7 @@ EMailTestSubstitutionReplacedByGenericValues=When using test mode, substitutions
MailingAddFile=Attach this file
NoAttachedFiles=No attached files
BadEMail=Bad value for Email
+EMailNotDefined=Email not defined
ConfirmCloneEMailing=Are you sure you want to clone this emailing?
CloneContent=Clone message
CloneReceivers=Cloner recipients
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index ca5a8959946..36f294b23f3 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -1638,7 +1638,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '
';
diff --git a/htdocs/public/emailing/mailing-unsubscribe.php b/htdocs/public/emailing/mailing-unsubscribe.php
index 0e07359c484..79df2c9e014 100644
--- a/htdocs/public/emailing/mailing-unsubscribe.php
+++ b/htdocs/public/emailing/mailing-unsubscribe.php
@@ -120,20 +120,6 @@ if (!empty($tag) && ($unsuscrib == '1'))
$resql = $db->query($sql);
if (!$resql) dol_print_error($db);
- /*
- // Update status communication of thirdparty prospect (old usage)
- $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=-1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag = '".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)";
-
- $resql=$db->query($sql);
- if (! $resql) dol_print_error($db);
-
- // Update status communication of contact prospect (old usage)
- $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET no_email=1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag = '".$db->escape($tag)."' AND source_type='contact' AND source_id is not null)";
-
- $resql=$db->query($sql);
- if (! $resql) dol_print_error($db);
- */
-
// Update status communication of email (new usage)
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_unsubscribe (date_creat, entity, email, unsubscribegroup, ip) VALUES ('".$db->idate(dol_now())."', ".$db->escape($obj->entity).", '".$db->escape($obj->email)."', '', '".$db->escape(getUserRemoteIP())."')";