From 3f6f0dd8181ecc0a2d02db6e1af2ae0d09d71c8f Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 8 Dec 2016 18:13:12 +0100 Subject: [PATCH] do not send extra notif. to owner, send notif. of src and target forlder --- op/op.MoveClipboard.php | 32 ++++++++++++++++++++++---------- op/op.MoveDocument.php | 16 +++++++++++----- op/op.MoveFolder.php | 12 +++++++++--- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/op/op.MoveClipboard.php b/op/op.MoveClipboard.php index 5ac91f749..17b3acfe1 100644 --- a/op/op.MoveClipboard.php +++ b/op/op.MoveClipboard.php @@ -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); diff --git a/op/op.MoveDocument.php b/op/op.MoveDocument.php index 184926527..8f3c5f9bf 100644 --- a/op/op.MoveDocument.php +++ b/op/op.MoveDocument.php @@ -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 { diff --git a/op/op.MoveFolder.php b/op/op.MoveFolder.php index a3106c9c8..c88217060 100644 --- a/op/op.MoveFolder.php +++ b/op/op.MoveFolder.php @@ -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