Update contact.class.php

This commit is contained in:
Laurent Destailleur 2018-09-23 15:44:44 +02:00 committed by GitHub
parent 77dd516023
commit 39e9029e41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1050,10 +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.= " LEFT JOIN ".MAIN_DB_PREFIX."mailing as m on mc.fk_mailing=m.rowid";
$sql.= " WHERE mc.email = '".$this->db->escape($this->email)."' ";
$sql.= " AND m.entity IN (".getEntity($this->element).") 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)