More log into notify class

This commit is contained in:
Laurent Destailleur 2014-09-04 14:38:30 +02:00
parent 5aaba31c6a
commit 32fd2e03ce

View File

@ -147,11 +147,13 @@ class Notify
else $sql.= " AND a.code = '".$action."'"; // New usage else $sql.= " AND a.code = '".$action."'"; // New usage
$sql .= " AND s.rowid = ".$socid; $sql .= " AND s.rowid = ".$socid;
dol_syslog("Notify::send", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
if ($num > 0)
{
$i = 0; $i = 0;
while ($i < $num) // For each notification couple defined (third party/actioncode) while ($i < $num) // For each notification couple defined (third party/actioncode)
{ {
@ -160,7 +162,7 @@ class Notify
$sendto = $obj->firstname . " " . $obj->lastname . " <".$obj->email.">"; $sendto = $obj->firstname . " " . $obj->lastname . " <".$obj->email.">";
$actiondefid = $obj->adid; $actiondefid = $obj->adid;
if (dol_strlen($sendto)) if (dol_strlen($obj->email))
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$application=($conf->global->MAIN_APPLICATION_TITLE?$conf->global->MAIN_APPLICATION_TITLE:'Dolibarr ERP/CRM'); $application=($conf->global->MAIN_APPLICATION_TITLE?$conf->global->MAIN_APPLICATION_TITLE:'Dolibarr ERP/CRM');
@ -238,13 +240,23 @@ class Notify
//dol_syslog("Notify::send ".$this->error, LOG_ERR); //dol_syslog("Notify::send ".$this->error, LOG_ERR);
} }
} }
else
{
dol_syslog("No notification sent for ".$sendto." because email is empty");
}
$i++; $i++;
} }
return $i; return $i;
} }
else else
{ {
$this->error=$this->db->error(); dol_syslog("No notification sent, nothing into notification setup for the thirdparty socid = ".$socid);
return 0;
}
}
else
{
$this->error=$this->db->lasterror();
return -1; return -1;
} }