diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 3e995d780be..c0c1fcba460 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -740,7 +740,7 @@ else // Forme juridique $var=!$var; print ''.$langs->trans("JuridicalStatus").''; - print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE,1); + print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); print ''; // ProfId1 diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 6fe06660139..e7ed17f5e04 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -72,7 +72,7 @@ if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE) $object->substitutionarray, array( '__CHECK_READ__' => 'CheckMail', - '__UNSUSCRIBE__' => 'Unsubscribe' + '__UNSUBSCRIBE__' => 'Unsubscribe' ) ); } @@ -97,7 +97,7 @@ if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE) $object->substitutionarrayfortest, array( '__CHECK_READ__' => 'TESTCheckMail', - '__UNSUSCRIBE__' => 'TESTUnsubscribe' + '__UNSUBSCRIBE__' => 'TESTUnsubscribe' ) ); } @@ -224,7 +224,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes') '__ID__' => $obj->source_id, '__EMAIL__' => $obj->email, '__CHECK_READ__' => '', - '__UNSUSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', + '__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', '__MAILTOEMAIL__' => ''.$obj->email.'', '__LASTNAME__' => $obj->nom, '__FIRSTNAME__' => $obj->prenom, diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index d9b69e35fcf..6e03e4c5eae 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -805,8 +805,12 @@ class Contact extends CommonObject $sql = "SELECT count(mc.email) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql.= " WHERE mc.email = '".$this->db->escape($this->email)."'"; - $sql.= " AND mc.statut=1"; // -1 erreur, 0 non envoye, 1 envoye avec succes + $sql.= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes + + dol_syslog(get_class($this)."::getNbOfEMailings sql=".$sql, LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) { $obj = $this->db->fetch_object($resql); diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index 44ad66059a8..e7635e808d6 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -158,7 +158,9 @@ class MailingTargets // This can't be abstract as it is used for some method $sql .= " (fk_mailing,"; $sql .= " fk_contact,"; $sql .= " nom, prenom, email, other, source_url, source_id,"; - if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) $sql .= " tag,"; + if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) { + $sql .= " tag,"; + } $sql.= " source_type)"; $sql .= " VALUES (".$mailing_id.","; $sql .= (empty($cibles[$i]['fk_contact']) ? '0' : "'".$cibles[$i]['fk_contact']."'") .","; @@ -168,7 +170,9 @@ class MailingTargets // This can't be abstract as it is used for some method $sql .= "'".$this->db->escape($cibles[$i]['other'])."',"; $sql .= "'".$this->db->escape($cibles[$i]['source_url'])."',"; $sql .= "'".$this->db->escape($cibles[$i]['source_id'])."',"; - if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) $sql .= "'".$this->db->escape(md5($cibles[$i]['email'].';'.$cibles[$i]['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',"; + if (! empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) { + $sql .= "'".$this->db->escape(md5($cibles[$i]['email'].';'.$cibles[$i]['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',"; + } $sql .= "'".$this->db->escape($cibles[$i]['source_type'])."')"; $result=$this->db->query($sql); if ($result) @@ -189,6 +193,7 @@ class MailingTargets // This can't be abstract as it is used for some method } } + dol_syslog(get_class($this)."::add_to_target: sql ".$sql,LOG_DEBUG); dol_syslog(get_class($this)."::add_to_target: mailing ".$j." targets added"); //Update the status to show thirdparty mail that don't want to be contacted anymore' diff --git a/scripts/emailings/cron-mailing-send.php b/scripts/emailings/cron-mailing-send.php index a100a415651..61ba222e2ef 100644 --- a/scripts/emailings/cron-mailing-send.php +++ b/scripts/emailings/cron-mailing-send.php @@ -133,7 +133,7 @@ if ($resql) '__ID__' => $obj2->source_id, '__EMAIL__' => $obj2->email, '__CHECK_READ__' => '', - '__UNSUSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', + '__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', '__MAILTOEMAIL__' => ''.$obj2->email.'', '__LASTNAME__' => $obj2->lastname, '__FIRSTNAME__' => $obj2->firstname, diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index b7de64e74ca..abb2667f458 100644 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -140,7 +140,7 @@ if ($resql) '__ID__' => $obj->source_id, '__EMAIL__' => $obj->email, '__CHECK_READ__' => '', - '__UNSUSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', + '__UNSUBSCRIBE__' => ''.$langs->trans("MailUnsubcribe").'', '__MAILTOEMAIL__' => ''.$obj->email.'', '__LASTNAME__' => $obj->lastname, '__FIRSTNAME__' => $obj->firstname,