Fix scrutinizer bug

This commit is contained in:
Laurent Destailleur 2018-06-06 18:18:50 +02:00
parent bb97119233
commit 6e62727c37
4 changed files with 30 additions and 5 deletions

View File

@ -2417,6 +2417,34 @@ class Adherent extends CommonObject
}
}
/**
* Return number of mass Emailing received by this member with its email
*
* @return int Number of EMailings
*/
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
$resql=$this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
$nb=$obj->nb;
$this->db->free($resql);
return $nb;
}
else
{
$this->error=$this->db->error();
return -1;
}
}
/**
* Sets object to supplied categories.
*

View File

@ -1050,10 +1050,7 @@ class Contact extends CommonObject
$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
dol_syslog(get_class($this)."::getNbOfEMailings", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);

View File

@ -310,7 +310,6 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
default:
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
break;
}
return 0;

View File

@ -2560,7 +2560,8 @@ class User 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
$resql=$this->db->query($sql);
if ($resql)
{