Merge pull request #9595 from ptibogxiv/patch-66

FIX number mailing for a contact with multicompany
This commit is contained in:
Laurent Destailleur 2018-09-23 15:45:06 +02:00 committed by GitHub
commit 969be3a2a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1050,9 +1050,9 @@ class Contact extends CommonObject
function getNbOfEMailings()
{
$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 NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."mailing as m";
$sql.= " WHERE mc.fk_mailing=m.rowid AND mc.email = '".$this->db->escape($this->email)."' ";
$sql.= " AND m.entity IN (".getEntity($this->element).") AND mc.statut NOT IN (-1,0)"; // -1 error, 0 not sent, 1 sent with success
$resql=$this->db->query($sql);
if ($resql)