Skip to content
Snippets Groups Projects
Commit d1df89ad authored by Pegane Nestor's avatar Pegane Nestor
Browse files

FIX #6694 added control on diffusion_type and changed array for events

parent eecd908e
No related branches found
No related tags found
No related merge requests found
...@@ -60,16 +60,21 @@ while ($state <> 'END') { ...@@ -60,16 +60,21 @@ while ($state <> 'END') {
$u=1; $u=1;
while ($line2 = $stmt2->fetchObject()) { while ($line2 = $stmt2->fetchObject()) {
$recipients = array(); if ($notification->diffusion_type == "groups"){
$recipients = $diffusion_type_controler->getRecipients($notification, ''); $recipients = array();
$aRecipients = []; $recipients = $diffusion_type_controler->getRecipients($notification, '');
foreach ($recipients as $itemRecipient) { $aRecipients = [];
array_push($aRecipients, $itemRecipient->user_id); foreach ($recipients as $itemRecipient) {
} array_push($aRecipients, $itemRecipient->user_id);
if(empty($aRecipients)){ }
$aRecipients = "0=1"; if(empty($aRecipients)){
$aRecipients = "0=1";
}
$stmt3 = $db->query("SELECT usergroup_content.user_id,users.status FROM usergroup_content, users WHERE group_id = ? and users.status in ('OK') and usergroup_content.user_id=users.user_id and users.user_id in (?)", array($line2->group_id, $aRecipients));
} else {
$stmt3 = $db->query("SELECT usergroup_content.user_id,users.status FROM usergroup_content, users WHERE group_id = ? and users.status in ('OK') and usergroup_content.user_id=users.user_id",array($line2->group_id));
} }
$stmt3 = $db->query("SELECT usergroup_content.user_id,users.status FROM usergroup_content, users WHERE group_id = ? and users.status in ('OK') and usergroup_content.user_id=users.user_id and users.user_id in (?)", array($line2->group_id, $aRecipients));
$baskets_notif = array(); $baskets_notif = array();
$rowCount3 = $stmt3->rowCount(); $rowCount3 = $stmt3->rowCount();
$logger->write("GROUP: " . $line2->group_id . " ... " . $rowCount3 . " user(s) to notify", 'INFO'); $logger->write("GROUP: " . $line2->group_id . " ... " . $rowCount3 . " user(s) to notify", 'INFO');
...@@ -225,7 +230,7 @@ while ($state <> 'END') { ...@@ -225,7 +230,7 @@ while ($state <> 'END') {
$attachments = array(); $attachments = array();
if ($tmpNotif['attach']) { if ($tmpNotif['attach']) {
$logger->write('Adding attachments', 'INFO'); $logger->write('Adding attachments', 'INFO');
foreach ($tmpNotif['events'] as $event) { foreach ($basket_list['events'] as $event) {
// Check if event is related to document in collection // Check if event is related to document in collection
if ($event->res_id != '') { if ($event->res_id != '') {
$query = "SELECT " $query = "SELECT "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment