do not send extra notif. to owner, send notif. of src and target forlder

This commit is contained in:
Uwe Steinmann 2016-12-08 18:13:12 +01:00
parent 30d85e03fc
commit 3f6f0dd818
3 changed files with 42 additions and 18 deletions

View File

@ -54,7 +54,13 @@ foreach($clipboard['docs'] as $documentid) {
if ($document->setFolder($targetFolder)) {
// Send notification to subscribers.
if($notifier) {
$notifyList = $document->getNotifyList();
$nl1 = $oldFolder->getNotifyList();
$nl2 = $document->getNotifyList();
$nl3 = $targetFolder->getNotifyList();
$nl = array(
'users'=>array_merge($nl1['users'], $nl2['users'], $nl3['users']),
'groups'=>array_merge($nl1['groups'], $nl2['groups'], $nl3['groups'])
);
$subject = "document_moved_email_subject";
$message = "document_moved_email_body";
$params = array();
@ -65,13 +71,13 @@ foreach($clipboard['docs'] as $documentid) {
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toList($user, $notifyList["users"], $subject, $message, $params);
foreach ($notifyList["groups"] as $grp) {
$notifier->toList($user, $nl["users"], $subject, $message, $params);
foreach ($nl["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params);
}
// if user is not owner send notification to owner
if ($user->getID() != $document->getOwner()->getID())
$notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params);
// if ($user->getID() != $document->getOwner()->getID())
// $notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params);
}
$session->removeFromClipboard($document);
@ -95,7 +101,13 @@ foreach($clipboard['folders'] as $folderid) {
if ($folder->setParent($targetFolder)) {
// Send notification to subscribers.
if($notifier) {
$notifyList = $folder->getNotifyList();
$nl1 = $oldFolder->getNotifyList();
$nl2 = $folder->getNotifyList();
$nl3 = $targetFolder->getNotifyList();
$nl = array(
'users'=>array_merge($nl1['users'], $nl2['users'], $nl3['users']),
'groups'=>array_merge($nl1['groups'], $nl2['groups'], $nl3['groups'])
);
$subject = "folder_moved_email_subject";
$message = "folder_moved_email_body";
$params = array();
@ -106,13 +118,13 @@ foreach($clipboard['folders'] as $folderid) {
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID();
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toList($user, $notifyList["users"], $subject, $message, $params);
foreach ($notifyList["groups"] as $grp) {
$notifier->toList($user, $nl["users"], $subject, $message, $params);
foreach ($nl["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params);
}
// if user is not owner send notification to owner
if ($user->getID() != $folder->getOwner()->getID())
$notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params);
// if ($user->getID() != $folder->getOwner()->getID())
// $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params);
}
$session->removeFromClipboard($folder);

View File

@ -64,7 +64,13 @@ if ($targetid != $oldFolder->getID()) {
if ($document->setFolder($targetFolder)) {
// Send notification to subscribers.
if($notifier) {
$notifyList = $document->getNotifyList();
$nl1 = $oldFolder->getNotifyList();
$nl2 = $document->getNotifyList();
$nl3 = $targetFolder->getNotifyList();
$nl = array(
'users'=>array_merge($nl1['users'], $nl2['users'], $nl3['users']),
'groups'=>array_merge($nl1['groups'], $nl2['groups'], $nl3['groups'])
);
$subject = "document_moved_email_subject";
$message = "document_moved_email_body";
$params = array();
@ -75,13 +81,13 @@ if ($targetid != $oldFolder->getID()) {
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toList($user, $notifyList["users"], $subject, $message, $params);
foreach ($notifyList["groups"] as $grp) {
$notifier->toList($user, $nl["users"], $subject, $message, $params);
foreach ($nl["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params);
}
// if user is not owner send notification to owner
if ($user->getID() != $document->getOwner()->getID())
$notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params);
// if ($user->getID() != $document->getOwner()->getID())
// $notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params);
}
} else {

View File

@ -62,7 +62,13 @@ $oldFolder = $folder->getParent();
if ($folder->setParent($targetFolder)) {
// Send notification to subscribers.
if($notifier) {
$notifyList = $folder->getNotifyList();
$nl1 = $oldFolder->getNotifyList();
$nl2 = $folder->getNotifyList();
$nl3 = $targetFolder->getNotifyList();
$nl = array(
'users'=>array_merge($nl1['users'], $nl2['users'], $nl3['users']),
'groups'=>array_merge($nl1['groups'], $nl2['groups'], $nl3['groups'])
);
$subject = "folder_moved_email_subject";
$message = "folder_moved_email_body";
$params = array();
@ -73,8 +79,8 @@ if ($folder->setParent($targetFolder)) {
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID();
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toList($user, $notifyList["users"], $subject, $message, $params);
foreach ($notifyList["groups"] as $grp) {
$notifier->toList($user, $nl["users"], $subject, $message, $params);
foreach ($nl["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params);
}
// if user is not owner send notification to owner