Merge pull request #12563 from atm-maxime/fix_notification_user_diabled

Fix #12448 : notifications were sent to disabled user or contacts
This commit is contained in:
Laurent Destailleur 2019-11-30 01:18:35 +01:00 committed by GitHub
commit 7b828d1f0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -329,6 +329,7 @@ class Notify
$sql.= " ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action";
$sql.= " AND n.fk_soc = s.rowid";
$sql.= " AND c.statut = 1";
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
$sql .= " AND s.rowid = ".$object->socid;
@ -342,6 +343,7 @@ class Notify
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
$sql.= " ".MAIN_DB_PREFIX."notify_def as n";
$sql.= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action";
$sql.= " AND c.statut = 1";
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
else $sql.= " AND a.code = '".$notifcode."'"; // New usage