From 32ca8ccae3e19b3e0c8cdb0af92e6717b59ccc04 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 28 Jan 2021 21:05:52 +0100 Subject: [PATCH 1/8] add method getDMS() to class SeedDMS_Core_User and SeedDMS_Core_Group --- SeedDMS_Core/Core/inc.ClassGroup.php | 7 +++++++ SeedDMS_Core/Core/inc.ClassUser.php | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/SeedDMS_Core/Core/inc.ClassGroup.php b/SeedDMS_Core/Core/inc.ClassGroup.php index e024b6cc1..4e7b9ba47 100644 --- a/SeedDMS_Core/Core/inc.ClassGroup.php +++ b/SeedDMS_Core/Core/inc.ClassGroup.php @@ -131,6 +131,13 @@ class SeedDMS_Core_Group { /* {{{ */ $this->_dms = $dms; } /* }}} */ + /** + * @return SeedDMS_Core_DMS $dms + */ + function getDMS() { + return $this->_dms; + } + /** * @return int */ diff --git a/SeedDMS_Core/Core/inc.ClassUser.php b/SeedDMS_Core/Core/inc.ClassUser.php index cdf46ebe6..495b4b310 100644 --- a/SeedDMS_Core/Core/inc.ClassUser.php +++ b/SeedDMS_Core/Core/inc.ClassUser.php @@ -257,6 +257,13 @@ class SeedDMS_Core_User { /* {{{ */ $this->_dms = $dms; } + /** + * @return SeedDMS_Core_DMS $dms + */ + function getDMS() { + return $this->_dms; + } + /** * @return int */ From 4ad9638e33023f5cde3f33cd6cae5533b5c108e6 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 28 Jan 2021 21:07:04 +0100 Subject: [PATCH 2/8] toList() returns error --- inc/inc.ClassEmailNotify.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inc/inc.ClassEmailNotify.php b/inc/inc.ClassEmailNotify.php index 674043faa..8e4d25742 100644 --- a/inc/inc.ClassEmailNotify.php +++ b/inc/inc.ClassEmailNotify.php @@ -216,10 +216,11 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify { return false; } + $ret = true; foreach ($recipients as $recipient) { - $this->toIndividual($sender, $recipient, $subject, $message, $params); + $ret &= $this->toIndividual($sender, $recipient, $subject, $message, $params); } - return true; + return $ret; } /* }}} */ } From d0c1b1633249caf5363967a772377643e8ea0e38 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 28 Jan 2021 21:08:33 +0100 Subject: [PATCH 3/8] pass logger to constructor, introduce type of receiver --- inc/inc.ClassNotificationService.php | 57 +++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/inc/inc.ClassNotificationService.php b/inc/inc.ClassNotificationService.php index e7bea6347..67e92ef53 100644 --- a/inc/inc.ClassNotificationService.php +++ b/inc/inc.ClassNotificationService.php @@ -31,9 +31,23 @@ class SeedDMS_NotificationService { */ protected $errors; - public function __construct() { + /* + * Service for logging + */ + protected $logger; + + /* + * Possible types of receivers + */ + const RECV_ANY = 0; + const RECV_NOTIFICATION = 1; + const RECV_REVIEWER = 2; + const RECV_APPROVER = 3; + + public function __construct($logger = null) { $this->services = array(); $this->errors = array(); + $this->logger = $logger; } public function addService($service, $name='') { @@ -51,14 +65,21 @@ class SeedDMS_NotificationService { return $this->errors; } - public function toIndividual($sender, $recipient, $subject, $message, $params=array()) { + public function toIndividual($sender, $recipient, $subject, $message, $params=array(), $recvtype=0) { $error = true; foreach($this->services as $name => $service) { - if(!is_callable([$service, 'filter']) || $service->filter($sender, $recipient, $subject, $message, $params)) { - if(!$service->toIndividual($sender, $recipient, $subject, $message, $params)) { + if(!is_callable([$service, 'filter']) || $service->filter($sender, $recipient, $subject, $message, $params, $recvtype)) { + if(is_object($recipient) && ($dms = $recipient->getDMS()) && !strcasecmp(get_class($recipient), $dms->getClassname('user')) && !$recipient->isDisabled() && $recipient->getEmail()!="") { + $to = $recipient->getEmail(); + } elseif(is_string($recipient) && trim($recipient) != "") { + $to = $recipient; + } + if(!$service->toIndividual($sender, $recipient, $subject, $message, $params, $recvtype)) { $error = false; $this->errors[$name] = false; + $this->logger->log('Notification service: '.$name.'. Sending mail \''.$subject.'\' to user \''.$to.'\' failed.', PEAR_LOG_ERR); } else { + $this->logger->log('Notification service: '.$name.'. Sending mail \''.$subject.'\' to user \''.$to.'\' successful.', PEAR_LOG_INFO); $this->errors[$name] = true; } } @@ -66,30 +87,46 @@ class SeedDMS_NotificationService { return $error; } - public function toGroup($sender, $groupRecipient, $subject, $message, $params=array()) { + public function toGroup($sender, $groupRecipient, $subject, $message, $params=array(), $recvtype=0) { $error = true; foreach($this->services as $name => $service) { - if(!is_callable([$service, 'filter']) || $service->filter($sender, $groupRecipient, $subject, $message, $params)) { - if(!$service->toGroup($sender, $groupRecipient, $subject, $message, $params)) { + if(!is_callable([$service, 'filter']) || $service->filter($sender, $groupRecipient, $subject, $message, $params, $recvtype)) { + if(is_object($groupRecipient) && ($dms = $recipient->getDMS()) && strcasecmp(get_class($groupRecipient), $dms->getClassname('group'))) { + $to = $groupRecipient->getName(); + } + if(!$service->toGroup($sender, $groupRecipient, $subject, $message, $params, $recvtype)) { $error = false; $this->errors[$name] = false; + $this->logger->log('Notification service: '.$name.'. Sending mail \''.$subject.'\' to group \''.$to.'\' failed.', PEAR_LOG_ERR); } else { $this->errors[$name] = true; + $this->logger->log('Notification service: '.$name.'. Sending mail \''.$subject.'\' to group \''.$to.'\' successful.', PEAR_LOG_INFO); } } } return $error; } - public function toList($sender, $recipients, $subject, $message, $params=array()) { + public function toList($sender, $recipients, $subject, $message, $params=array(), $recvtype=0) { $error = true; foreach($this->services as $name => $service) { - if(!is_callable([$service, 'filter']) || $service->filter($sender, $recipients, $subject, $message, $params)) { - if(!$service->toList($sender, $recipients, $subject, $message, $params)) { + if(!is_callable([$service, 'filter']) || $service->filter($sender, $recipients, $subject, $message, $params, $recvtype)) { + $to = []; + foreach ($recipients as $recipient) { + if(is_object($recipient) && ($dms = $recipient->getDMS()) && !strcasecmp(get_class($recipient), $dms->getClassname('user')) && !$recipient->isDisabled() && $recipient->getEmail()!="") { + $to[] = $recipient->getEmail(); + } elseif(is_string($recipient) && trim($recipient) != "") { + $to[] = $recipient; + } + } + $to = implode($to, ', '); + if(!$service->toList($sender, $recipients, $subject, $message, $params, $recvtype)) { $error = false; $this->errors[$name] = false; + $this->logger->log('Notification service: '.$name.'. Sending mail \''.$subject.'\' to users \''.$to.'\' failed.', PEAR_LOG_ERR); } else { $this->errors[$name] = true; + $this->logger->log('Notification service: '.$name.'. Sending mail \''.$subject.'\' to users \''.$to.'\' successful.', PEAR_LOG_INFO); } } } From fdde3e29c5ff3afd648c9c0a2d5923fe3c1474fb Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 28 Jan 2021 21:09:11 +0100 Subject: [PATCH 4/8] pass logger to Authentication Service --- inc/inc.Authentication.php | 3 ++- webdav/index.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/inc/inc.Authentication.php b/inc/inc.Authentication.php index 63b5b9d01..a587338eb 100644 --- a/inc/inc.Authentication.php +++ b/inc/inc.Authentication.php @@ -95,7 +95,8 @@ if($settings->_useHomeAsRootFolder && !$user->isAdmin() && $user->getHomeFolder( $dms->setRootFolderID($user->getHomeFolder()); } -$notifier = new SeedDMS_NotificationService(); +global $logger; +$notifier = new SeedDMS_NotificationService($logger); if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) { foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) { diff --git a/webdav/index.php b/webdav/index.php index 7c3bac0ed..f7bdea5ac 100644 --- a/webdav/index.php +++ b/webdav/index.php @@ -27,7 +27,7 @@ if($settings->_logFileEnable) { $log = null; } -$notifier = new SeedDMS_NotificationService(); +$notifier = new SeedDMS_NotificationService($log); if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) { foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) { From e6790f6b2f015069fb2a75c498c639694975e792 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 29 Jan 2021 08:56:01 +0100 Subject: [PATCH 5/8] add comment that toGroup and toList are deprecated --- inc/inc.ClassEmailNotify.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/inc/inc.ClassEmailNotify.php b/inc/inc.ClassEmailNotify.php index 8e4d25742..630697969 100644 --- a/inc/inc.ClassEmailNotify.php +++ b/inc/inc.ClassEmailNotify.php @@ -197,6 +197,11 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify { } } /* }}} */ + /** + * This method is deprecated! + * + * The dispatching is now done in SeedDMS_NotificationService::toGroup() + */ function toGroup($sender, $groupRecipient, $subject, $message, $params=array()) { /* {{{ */ if ((!is_object($sender) && strcasecmp(get_class($sender), $this->_dms->getClassname('user'))) || (!is_object($groupRecipient) || strcasecmp(get_class($groupRecipient), $this->_dms->getClassname('group')))) { @@ -210,6 +215,11 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify { return true; } /* }}} */ + /** + * This method is deprecated! + * + * The dispatching is now done in SeedDMS_NotificationService::toList() + */ function toList($sender, $recipients, $subject, $message, $params=array()) { /* {{{ */ if ((!is_object($sender) && strcasecmp(get_class($sender), $this->_dms->getClassname('user'))) || (!is_array($recipients) && count($recipients)==0)) { From 8e2682dcf0ebc883150fef198ff115192ddf57ee Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 29 Jan 2021 08:57:37 +0100 Subject: [PATCH 6/8] add type of receiver, do not call toList and toGroup anymore --- inc/inc.ClassNotificationService.php | 69 +++++++++++++++------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/inc/inc.ClassNotificationService.php b/inc/inc.ClassNotificationService.php index 67e92ef53..e4d04b4e4 100644 --- a/inc/inc.ClassNotificationService.php +++ b/inc/inc.ClassNotificationService.php @@ -41,8 +41,10 @@ class SeedDMS_NotificationService { */ const RECV_ANY = 0; const RECV_NOTIFICATION = 1; - const RECV_REVIEWER = 2; - const RECV_APPROVER = 3; + const RECV_OWNER = 2; + const RECV_REVIEWER = 3; + const RECV_APPROVER = 4; + const RECV_WORKFLOW = 5; public function __construct($logger = null) { $this->services = array(); @@ -74,7 +76,7 @@ class SeedDMS_NotificationService { } elseif(is_string($recipient) && trim($recipient) != "") { $to = $recipient; } - if(!$service->toIndividual($sender, $recipient, $subject, $message, $params, $recvtype)) { + if(!$service->toIndividual($sender, $recipient, $subject, $message, $params)) { $error = false; $this->errors[$name] = false; $this->logger->log('Notification service: '.$name.'. Sending mail \''.$subject.'\' to user \''.$to.'\' failed.', PEAR_LOG_ERR); @@ -87,47 +89,48 @@ class SeedDMS_NotificationService { return $error; } + /** + * Send a notification to each user of a group + * + */ public function toGroup($sender, $groupRecipient, $subject, $message, $params=array(), $recvtype=0) { $error = true; foreach($this->services as $name => $service) { - if(!is_callable([$service, 'filter']) || $service->filter($sender, $groupRecipient, $subject, $message, $params, $recvtype)) { - if(is_object($groupRecipient) && ($dms = $recipient->getDMS()) && strcasecmp(get_class($groupRecipient), $dms->getClassname('group'))) { - $to = $groupRecipient->getName(); - } - if(!$service->toGroup($sender, $groupRecipient, $subject, $message, $params, $recvtype)) { - $error = false; - $this->errors[$name] = false; - $this->logger->log('Notification service: '.$name.'. Sending mail \''.$subject.'\' to group \''.$to.'\' failed.', PEAR_LOG_ERR); - } else { - $this->errors[$name] = true; - $this->logger->log('Notification service: '.$name.'. Sending mail \''.$subject.'\' to group \''.$to.'\' successful.', PEAR_LOG_INFO); - } + $ret = true; + foreach ($groupRecipient->getUsers() as $recipient) { + $ret &= $this->toIndividual($sender, $recipient, $subject, $message, $params, $recvtype); + } + $this->errors[$name] = $ret; + if(!$ret) { + $error = false; } } return $error; } + /** + * Send a notification to a list of recipients + * + * The list of recipients may contain both email addresses and users + * + * @param string|object $sender either an email address or a user + * @param array $recipients list of recipients + * @param string $subject key of translatable phrase for the subject + * @param string $message key of translatable phrase for the message body + * @param array $params list of parameters filled into the subject and body + * @param int $recvtype type of receiver + * @return boolean true on success, otherwise false + */ public function toList($sender, $recipients, $subject, $message, $params=array(), $recvtype=0) { $error = true; foreach($this->services as $name => $service) { - if(!is_callable([$service, 'filter']) || $service->filter($sender, $recipients, $subject, $message, $params, $recvtype)) { - $to = []; - foreach ($recipients as $recipient) { - if(is_object($recipient) && ($dms = $recipient->getDMS()) && !strcasecmp(get_class($recipient), $dms->getClassname('user')) && !$recipient->isDisabled() && $recipient->getEmail()!="") { - $to[] = $recipient->getEmail(); - } elseif(is_string($recipient) && trim($recipient) != "") { - $to[] = $recipient; - } - } - $to = implode($to, ', '); - if(!$service->toList($sender, $recipients, $subject, $message, $params, $recvtype)) { - $error = false; - $this->errors[$name] = false; - $this->logger->log('Notification service: '.$name.'. Sending mail \''.$subject.'\' to users \''.$to.'\' failed.', PEAR_LOG_ERR); - } else { - $this->errors[$name] = true; - $this->logger->log('Notification service: '.$name.'. Sending mail \''.$subject.'\' to users \''.$to.'\' successful.', PEAR_LOG_INFO); - } + $ret = true; + foreach ($recipients as $recipient) { + $ret &= $this->toIndividual($sender, $recipients, $subject, $message, $params, $recvtype); + } + $this->errors[$name] = $ret; + if(!$ret) { + $error = false; } } return $error; From 862f8dffb321580271f7b481fb68633b0145a840 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 29 Jan 2021 08:58:21 +0100 Subject: [PATCH 7/8] pass type of notification receiver in each call of notification service --- op/op.AddDocument.php | 16 ++++---- op/op.AddFile.php | 4 +- op/op.AddSubFolder.php | 4 +- op/op.Ajax.php | 24 ++++++------ op/op.ApproveDocument.php | 20 +++++----- op/op.DocumentAccess.php | 18 ++++----- op/op.DocumentNotify.php | 8 ++-- op/op.EditAttributes.php | 8 ++-- op/op.EditComment.php | 4 +- op/op.EditDocument.php | 26 ++++++------- op/op.EditFolder.php | 20 +++++----- op/op.EditOnline.php | 4 +- op/op.FolderAccess.php | 20 +++++----- op/op.FolderNotify.php | 8 ++-- op/op.ManageNotify.php | 6 +-- op/op.MoveClipboard.php | 12 +++--- op/op.MoveDocument.php | 6 +-- op/op.MoveFolder.php | 6 +-- op/op.OverrideContentStatus.php | 6 +-- op/op.RemoveDocument.php | 4 +- op/op.RemoveDocumentFile.php | 4 +- op/op.RemoveFolder.php | 4 +- op/op.RemoveVersion.php | 57 ++++++++++++++++++---------- op/op.RemoveWorkflowFromDocument.php | 4 +- op/op.ReturnFromSubWorkflow.php | 4 +- op/op.ReviewDocument.php | 26 ++++++------- op/op.RewindWorkflow.php | 4 +- op/op.RunSubWorkflow.php | 4 +- op/op.SetReviewersApprovers.php | 16 ++++---- op/op.SetWorkflow.php | 4 +- op/op.TransferDocument.php | 4 +- op/op.TriggerWorkflow.php | 8 ++-- op/op.UpdateDocument.php | 22 +++++------ op/op.UsrMgr.php | 2 +- 34 files changed, 202 insertions(+), 185 deletions(-) diff --git a/op/op.AddDocument.php b/op/op.AddDocument.php index f76224216..7ba864f0c 100644 --- a/op/op.AddDocument.php +++ b/op/op.AddDocument.php @@ -421,9 +421,9 @@ for ($file_num=0;$file_num_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } if($workflow && $settings->_enableNotificationWorkflow) { @@ -442,10 +442,10 @@ for ($file_num=0;$file_numgetNextTransitions($workflow->getInitState()) as $ntransition) { foreach($ntransition->getUsers() as $tuser) { - $notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params); + $notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW); } foreach($ntransition->getGroups() as $tuser) { - $notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params); + $notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW); } } } @@ -466,10 +466,10 @@ for ($file_num=0;$file_num_httpRoot; foreach($reviewers['i'] as $reviewerid) { - $notifier->toIndividual($user, $dms->getUser($reviewerid), $subject, $message, $params); + $notifier->toIndividual($user, $dms->getUser($reviewerid), $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); } foreach($reviewers['g'] as $reviewergrpid) { - $notifier->toGroup($user, $dms->getGroup($reviewergrpid), $subject, $message, $params); + $notifier->toGroup($user, $dms->getGroup($reviewergrpid), $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); } } @@ -487,10 +487,10 @@ for ($file_num=0;$file_num_httpRoot; foreach($approvers['i'] as $approverid) { - $notifier->toIndividual($user, $dms->getUser($approverid), $subject, $message, $params); + $notifier->toIndividual($user, $dms->getUser($approverid), $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); } foreach($approvers['g'] as $approvergrpid) { - $notifier->toGroup($user, $dms->getGroup($approvergrpid), $subject, $message, $params); + $notifier->toGroup($user, $dms->getGroup($approvergrpid), $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); } } } diff --git a/op/op.AddFile.php b/op/op.AddFile.php index 3eb2d566f..5f970afdd 100644 --- a/op/op.AddFile.php +++ b/op/op.AddFile.php @@ -123,9 +123,9 @@ for ($file_num=0;$file_num_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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } diff --git a/op/op.AddSubFolder.php b/op/op.AddSubFolder.php index c7fe9f600..a98c9d7ac 100644 --- a/op/op.AddSubFolder.php +++ b/op/op.AddSubFolder.php @@ -139,9 +139,9 @@ if(!$subFolder = $controller->run()) { $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$subFolder->getID(); $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } diff --git a/op/op.Ajax.php b/op/op.Ajax.php index cb70295e9..41c4f499e 100644 --- a/op/op.Ajax.php +++ b/op/op.Ajax.php @@ -473,9 +473,9 @@ switch($command) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$parent->getID(); - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } header('Content-Type: application/json'); @@ -529,9 +529,9 @@ switch($command) { $params['username'] = $user->getFullName(); $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } @@ -830,9 +830,9 @@ switch($command) { $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } if($workflow && $settings->_enableNotificationWorkflow) { @@ -851,10 +851,10 @@ switch($command) { foreach($workflow->getNextTransitions($workflow->getInitState()) as $ntransition) { foreach($ntransition->getUsers() as $tuser) { - $notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params); + $notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW); } foreach($ntransition->getGroups() as $tuser) { - $notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params); + $notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW); } } } @@ -875,10 +875,10 @@ switch($command) { $params['http_root'] = $settings->_httpRoot; foreach($reviewers['i'] as $reviewerid) { - $notifier->toIndividual($user, $dms->getUser($reviewerid), $subject, $message, $params); + $notifier->toIndividual($user, $dms->getUser($reviewerid), $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); } foreach($reviewers['g'] as $reviewergrpid) { - $notifier->toGroup($user, $dms->getGroup($reviewergrpid), $subject, $message, $params); + $notifier->toGroup($user, $dms->getGroup($reviewergrpid), $subject, $message, $params, $params, SeedDMS_NotificationService::RECV_REVIEWER); } } @@ -896,10 +896,10 @@ switch($command) { $params['http_root'] = $settings->_httpRoot; foreach($approvers['i'] as $approverid) { - $notifier->toIndividual($user, $dms->getUser($approverid), $subject, $message, $params); + $notifier->toIndividual($user, $dms->getUser($approverid), $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); } foreach($approvers['g'] as $approvergrpid) { - $notifier->toGroup($user, $dms->getGroup($approvergrpid), $subject, $message, $params); + $notifier->toGroup($user, $dms->getGroup($approvergrpid), $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); } } } diff --git a/op/op.ApproveDocument.php b/op/op.ApproveDocument.php index 597573814..a1cad49b7 100644 --- a/op/op.ApproveDocument.php +++ b/op/op.ApproveDocument.php @@ -115,13 +115,13 @@ if ($_POST["approvalType"] == "ind") { $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); - $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params); + $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); // Send notification to subscribers. $nl=$document->getNotifyList(); - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } @@ -153,13 +153,13 @@ else if ($_POST["approvalType"] == "grp") { $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); - $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params); + $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); // Send notification to subscribers. $nl=$document->getNotifyList(); - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } @@ -188,9 +188,9 @@ if ($_POST["approvalStatus"]==-1){ $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } @@ -240,9 +240,9 @@ if ($_POST["approvalStatus"]==-1){ $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } diff --git a/op/op.DocumentAccess.php b/op/op.DocumentAccess.php index 76b48018f..af69f0aa0 100644 --- a/op/op.DocumentAccess.php +++ b/op/op.DocumentAccess.php @@ -160,11 +160,11 @@ if ($action == "setowner") { $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } -// $notifier->toIndividual($user, $oldowner, $subject, $message, $params); +// $notifier->toIndividual($user, $oldowner, $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_setowner'))); } @@ -185,9 +185,9 @@ else if ($action == "notinherit") { $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } @@ -208,9 +208,9 @@ else if ($action == "inherit") { $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_inherit_access'))); @@ -230,9 +230,9 @@ else if ($action == "setdefault") { $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_set_default_access'))); diff --git a/op/op.DocumentNotify.php b/op/op.DocumentNotify.php index eb546a241..1e5d8ac03 100644 --- a/op/op.DocumentNotify.php +++ b/op/op.DocumentNotify.php @@ -112,10 +112,10 @@ if ($action == "delnotify"){ $params['http_root'] = $settings->_httpRoot; if ($userid > 0) { - $notifier->toIndividual($user, $obj, $subject, $message, $params); + $notifier->toIndividual($user, $obj, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } else { - $notifier->toGroup($user, $obj, $subject, $message, $params); + $notifier->toGroup($user, $obj, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } break; @@ -154,7 +154,7 @@ else if ($action == "addnotify") { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toIndividual($user, $obj, $subject, $message, $params); + $notifier->toIndividual($user, $obj, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } break; @@ -188,7 +188,7 @@ else if ($action == "addnotify") { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toGroup($user, $obj, $subject, $message, $params); + $notifier->toGroup($user, $obj, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } break; } diff --git a/op/op.EditAttributes.php b/op/op.EditAttributes.php index cde0f86e4..95a5740b7 100644 --- a/op/op.EditAttributes.php +++ b/op/op.EditAttributes.php @@ -114,9 +114,9 @@ if($oldattributes) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $notifyList["users"], $subject, $message, $params); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } @@ -142,9 +142,9 @@ if($newattributes) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $notifyList["users"], $subject, $message, $params); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } diff --git a/op/op.EditComment.php b/op/op.EditComment.php index 7dec214f7..7da9cc26a 100644 --- a/op/op.EditComment.php +++ b/op/op.EditComment.php @@ -103,9 +103,9 @@ if (($oldcomment = $version->getComment()) != $comment) { $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID()."&version=".$version->getVersion(); $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $notifyList["users"], $subject, $message, $params); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } diff --git a/op/op.EditDocument.php b/op/op.EditDocument.php index f2b7ab6e3..538d3a050 100644 --- a/op/op.EditDocument.php +++ b/op/op.EditDocument.php @@ -167,11 +167,11 @@ if ($oldname != $name) { // if user is not owner send notification to owner if ($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) { - $notifyList['users'][] = $document->getOwner(); + $notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } - $notifier->toList($user, $notifyList["users"], $subject, $message, $params); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } @@ -196,11 +196,11 @@ if ($oldcomment != $comment) { // if user is not owner send notification to owner if ($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) { - $notifyList['users'][] = $document->getOwner(); + $notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } - $notifier->toList($user, $notifyList["users"], $subject, $message, $params); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } @@ -223,11 +223,11 @@ if ($expires != $oldexpires) { // if user is not owner send notification to owner if ($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) { - $notifyList['users'][] = $document->getOwner(); + $notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } - $notifier->toList($user, $notifyList["users"], $subject, $message, $params); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } @@ -254,9 +254,9 @@ if($oldattributes) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $notifyList["users"], $subject, $message, $params); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } @@ -281,9 +281,9 @@ if($newattributes) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $notifyList["users"], $subject, $message, $params); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } diff --git a/op/op.EditFolder.php b/op/op.EditFolder.php index b064e458a..485069bb8 100644 --- a/op/op.EditFolder.php +++ b/op/op.EditFolder.php @@ -112,13 +112,13 @@ if($oldname != $name) { $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } // if user is not owner send notification to owner // if ($user->getID() != $folder->getOwner()->getID()) -// $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params); +// $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } } @@ -138,13 +138,13 @@ if($oldcomment != $comment) { $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } // if user is not owner send notification to owner // if ($user->getID() != $folder->getOwner()->getID()) -// $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params); +// $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } } @@ -168,9 +168,9 @@ if($oldattributes) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $notifyList["users"], $subject, $message, $params); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } @@ -195,9 +195,9 @@ if($newattributes) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $notifyList["users"], $subject, $message, $params); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } diff --git a/op/op.EditOnline.php b/op/op.EditOnline.php index c0dc2d401..2ad2327b4 100644 --- a/op/op.EditOnline.php +++ b/op/op.EditOnline.php @@ -78,9 +78,9 @@ if($lc->getChecksum() == SeedDMS_Core_File::checksum($tmpfname)) { $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } echo json_encode(array('success'=>true, 'message'=>getMLText('splash_saved_file'))); diff --git a/op/op.FolderAccess.php b/op/op.FolderAccess.php index 6ee5d3e8c..00bb30468 100644 --- a/op/op.FolderAccess.php +++ b/op/op.FolderAccess.php @@ -140,9 +140,9 @@ if ($action == "setowner") { $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_setowner'))); @@ -171,9 +171,9 @@ else if ($action == "notinherit") { $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_notinherit_access'))); } @@ -194,9 +194,9 @@ else if ($action == "notinherit") { $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } @@ -233,9 +233,9 @@ else if ($action == "inherit") { $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_inherit_access'))); @@ -260,9 +260,9 @@ else if ($action == "setdefault") { $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_set_default_access'))); diff --git a/op/op.FolderNotify.php b/op/op.FolderNotify.php index aa9f235b5..c9b8fc48e 100644 --- a/op/op.FolderNotify.php +++ b/op/op.FolderNotify.php @@ -107,10 +107,10 @@ if ($action == "delnotify") { $params['http_root'] = $settings->_httpRoot; if ($userid > 0) { - $notifier->toIndividual($user, $obj, $subject, $message, $params); + $notifier->toIndividual($user, $obj, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } else { - $notifier->toGroup($user, $obj, $subject, $message, $params); + $notifier->toGroup($user, $obj, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } break; @@ -149,7 +149,7 @@ else if ($action == "addnotify") { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toIndividual($user, $obj, $subject, $message, $params); + $notifier->toIndividual($user, $obj, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } break; @@ -184,7 +184,7 @@ else if ($action == "addnotify") { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toGroup($user, $obj, $subject, $message, $params); + $notifier->toGroup($user, $obj, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } break; } diff --git a/op/op.ManageNotify.php b/op/op.ManageNotify.php index 738b67530..25429d86b 100644 --- a/op/op.ManageNotify.php +++ b/op/op.ManageNotify.php @@ -29,7 +29,7 @@ if ($user->isGuest()) { UI::exitError(getMLText("my_account"),getMLText("access_denied")); } -function add_folder_notify($folder,$userid,$recursefolder,$recursedoc) { +function add_folder_notify($folder,$userid,$recursefolder,$recursedoc) { /* {{{ */ global $dms; $folder->addNotify($userid, true); @@ -55,7 +55,7 @@ function add_folder_notify($folder,$userid,$recursefolder,$recursedoc) { foreach($subFolders as $subFolder) add_folder_notify($subFolder,$userid,$recursefolder,$recursedoc); } -} +} /* }}} */ if (!isset($_GET["type"])) UI::exitError(getMLText("my_account"),getMLText("error_occured")); if (!isset($_GET["action"])) UI::exitError(getMLText("my_account"),getMLText("error_occured")); @@ -123,7 +123,7 @@ if ($_GET["type"]=="document"){ $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toIndividual($user, $obj, $subject, $message, $params); + $notifier->toIndividual($user, $obj, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } diff --git a/op/op.MoveClipboard.php b/op/op.MoveClipboard.php index d675e5c6a..2e77ffca4 100644 --- a/op/op.MoveClipboard.php +++ b/op/op.MoveClipboard.php @@ -73,13 +73,13 @@ foreach($clipboard['docs'] as $documentid) { $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } // if user is not owner send notification to owner // if ($user->getID() != $document->getOwner()->getID()) -// $notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params); +// $notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } $session->removeFromClipboard($document); @@ -120,13 +120,13 @@ foreach($clipboard['folders'] as $folderid) { $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID(); $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } // if user is not owner send notification to owner // if ($user->getID() != $folder->getOwner()->getID()) -// $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params); +// $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } $session->removeFromClipboard($folder); diff --git a/op/op.MoveDocument.php b/op/op.MoveDocument.php index d62e349d2..56c7a2515 100644 --- a/op/op.MoveDocument.php +++ b/op/op.MoveDocument.php @@ -99,13 +99,13 @@ if ($document->setFolder($targetFolder)) { $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } // if user is not owner send notification to owner // if ($user->getID() != $document->getOwner()->getID()) -// $notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params); +// $notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } } else { diff --git a/op/op.MoveFolder.php b/op/op.MoveFolder.php index 31c77a6c8..dbdad0f88 100644 --- a/op/op.MoveFolder.php +++ b/op/op.MoveFolder.php @@ -98,13 +98,13 @@ if ($folder->setParent($targetFolder)) { $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID(); $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } // if user is not owner send notification to owner //if ($user->getID() != $folder->getOwner()->getID()) - // $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params); + // $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } } else { diff --git a/op/op.OverrideContentStatus.php b/op/op.OverrideContentStatus.php index 8b79d1c0f..7525bbb5c 100644 --- a/op/op.OverrideContentStatus.php +++ b/op/op.OverrideContentStatus.php @@ -92,12 +92,12 @@ if ($overrideStatus != $overallStatus["status"]) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } -// $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params); +// $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } } } diff --git a/op/op.RemoveDocument.php b/op/op.RemoveDocument.php index 24fd3c614..9d554b335 100644 --- a/op/op.RemoveDocument.php +++ b/op/op.RemoveDocument.php @@ -98,9 +98,9 @@ if ($notifier){ $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID(); - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } diff --git a/op/op.RemoveDocumentFile.php b/op/op.RemoveDocumentFile.php index 70dd02765..dbda46a6d 100644 --- a/op/op.RemoveDocumentFile.php +++ b/op/op.RemoveDocumentFile.php @@ -78,9 +78,9 @@ if (!$document->removeDocumentFile($fileid)) { $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } diff --git a/op/op.RemoveFolder.php b/op/op.RemoveFolder.php index 53c630b03..0d0c948e3 100644 --- a/op/op.RemoveFolder.php +++ b/op/op.RemoveFolder.php @@ -94,9 +94,9 @@ if ($notifier) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$parent->getID(); - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } diff --git a/op/op.RemoveVersion.php b/op/op.RemoveVersion.php index 8f7eede93..59c5dddec 100644 --- a/op/op.RemoveVersion.php +++ b/op/op.RemoveVersion.php @@ -92,9 +92,9 @@ if (count($document->getContent())==1) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } @@ -103,25 +103,27 @@ else { /* Before deleting the content get a list of all users that should * be informed about the removal. */ - $emailUserList = array(); - $emailUserList[] = $version->getUser()->getID(); - $emailGroupList = array(); + $emailUserListR = array(); + $emailUserListA = array(); + $oldowner = $version->getUser(); + $emailGroupListR = array(); + $emailGroupListA = array(); $status = $version->getReviewStatus(); foreach ($status as $st) { if ($st["status"]==0 && !in_array($st["required"], $emailUserList)) { if($st['type'] == 0) - $emailUserList[] = $st["required"]; + $emailUserListR[] = $st["required"]; else - $emailGroupList[] = $st["required"]; + $emailGroupListR[] = $st["required"]; } } $status = $version->getApprovalStatus(); foreach ($status as $st) { if ($st["status"]==0 && !in_array($st["required"], $emailUserList)) { if($st['type'] == 0) - $emailUserList[] = $st["required"]; + $emailUserListA[] = $st["required"]; else - $emailGroupList[] = $st["required"]; + $emailGroupListA[] = $st["required"]; } } @@ -152,15 +154,25 @@ else { // Notify affected users. if ($notifier){ $nl=$document->getNotifyList(); - $userrecipients = array(); - foreach ($emailUserList as $eID) { + $userrecipientsR = array(); + foreach ($emailUserListR as $eID) { $eU = $version->getDMS()->getUser($eID); - $userrecipients[] = $eU; + $userrecipientsR[] = $eU; } - $grouprecipients = array(); - foreach ($emailGroupList as $eID) { + $grouprecipientsR = array(); + foreach ($emailGroupListR as $eID) { $eU = $version->getDMS()->getGroup($eID); - $grouprecipients[] = $eU; + $grouprecipientsR[] = $eU; + } + $userrecipientsA = array(); + foreach ($emailUserListA as $eID) { + $eU = $version->getDMS()->getUser($eID); + $userrecipientsA[] = $eU; + } + $grouprecipientsA = array(); + foreach ($emailGroupListA as $eID) { + $eU = $version->getDMS()->getGroup($eID); + $grouprecipientsA[] = $eU; } $subject = "version_deleted_email_subject"; @@ -173,13 +185,18 @@ else { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); - $notifier->toList($user, $userrecipients, $subject, $message, $params); - $notifier->toList($user, $nl["users"], $subject, $message, $params); - foreach($grouprecipients as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toIndividual($user, $oldowner, $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); + $notifier->toList($user, $userrecipientsR, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); + $notifier->toList($user, $userrecipientsA, $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); + foreach($grouprecipientsR as $grp) { + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); + } + foreach($grouprecipientsA as $grp) { + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); } foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } diff --git a/op/op.RemoveWorkflowFromDocument.php b/op/op.RemoveWorkflowFromDocument.php index 64a64eda5..ce83d2dd2 100644 --- a/op/op.RemoveWorkflowFromDocument.php +++ b/op/op.RemoveWorkflowFromDocument.php @@ -86,9 +86,9 @@ if($version->removeWorkflow($user)) { $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); // Send notification to subscribers. - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } diff --git a/op/op.ReturnFromSubWorkflow.php b/op/op.ReturnFromSubWorkflow.php index 0fb7d377d..dfcd2a221 100644 --- a/op/op.ReturnFromSubWorkflow.php +++ b/op/op.ReturnFromSubWorkflow.php @@ -100,9 +100,9 @@ if($version->returnFromSubWorkflow($user, $transition, $_POST["comment"])) { $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); // Send notification to subscribers. - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } diff --git a/op/op.ReviewDocument.php b/op/op.ReviewDocument.php index d41f07a39..07bf82884 100644 --- a/op/op.ReviewDocument.php +++ b/op/op.ReviewDocument.php @@ -114,11 +114,11 @@ if ($_POST["reviewType"] == "ind") { $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } -// $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params); +// $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } } } @@ -149,11 +149,11 @@ else if ($_POST["reviewType"] == "grp") { $params['username'] = $user->getFullName(); $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } -// $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params); +// $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } } } @@ -179,11 +179,11 @@ if ($_POST["reviewStatus"]==-1){ $params['username'] = $user->getFullName(); $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } -// $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params); +// $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } } @@ -243,9 +243,9 @@ if ($_POST["reviewStatus"]==-1){ $params['username'] = $user->getFullName(); $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } @@ -272,11 +272,11 @@ if ($_POST["reviewStatus"]==-1){ if ($dastat["type"] == 0) { $approver = $dms->getUser($dastat["required"]); - $notifier->toIndividual($document->getOwner(), $approver, $subject, $message, $params); + $notifier->toIndividual($document->getOwner(), $approver, $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); } elseif ($dastat["type"] == 1) { $group = $dms->getGroup($dastat["required"]); - $notifier->toGroup($document->getOwner(), $group, $subject, $message, $params); + $notifier->toGroup($document->getOwner(), $group, $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); } } } diff --git a/op/op.RewindWorkflow.php b/op/op.RewindWorkflow.php index 6b1648a89..d67cdc8f7 100644 --- a/op/op.RewindWorkflow.php +++ b/op/op.RewindWorkflow.php @@ -85,9 +85,9 @@ if($version->rewindWorkflow()) { $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); // Send notification to subscribers. - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } diff --git a/op/op.RunSubWorkflow.php b/op/op.RunSubWorkflow.php index 9775a5677..69c49456c 100644 --- a/op/op.RunSubWorkflow.php +++ b/op/op.RunSubWorkflow.php @@ -94,9 +94,9 @@ if($version->runSubWorkflow($subworkflow)) { $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); // Send notification to subscribers. - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); } } } diff --git a/op/op.SetReviewersApprovers.php b/op/op.SetReviewersApprovers.php index 353452b52..1abc8ed3d 100644 --- a/op/op.SetReviewersApprovers.php +++ b/op/op.SetReviewersApprovers.php @@ -144,7 +144,7 @@ foreach ($pIndRev as $p) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toIndividual($user, $docAccess["users"][$accessIndex["i"][$p]], $subject, $message, $params); + $notifier->toIndividual($user, $docAccess["users"][$accessIndex["i"][$p]], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); } } break; @@ -210,7 +210,7 @@ if (count($reviewIndex["i"]) > 0) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toIndividual($user, $docAccess["users"][$accessIndex["i"][$rx]], $subject, $message, $params); + $notifier->toIndividual($user, $docAccess["users"][$accessIndex["i"][$rx]], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); } } break; @@ -256,7 +256,7 @@ foreach ($pGrpRev as $p) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toGroup($user, $docAccess["groups"][$accessIndex["g"][$p]], $subject, $message, $params); + $notifier->toGroup($user, $docAccess["groups"][$accessIndex["g"][$p]], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); } } break; @@ -314,7 +314,7 @@ if (count($reviewIndex["g"]) > 0) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toGroup($user, $docAccess["groups"][$accessIndex["g"][$rx]], $subject, $message, $params); + $notifier->toGroup($user, $docAccess["groups"][$accessIndex["g"][$rx]], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); } } break; @@ -376,7 +376,7 @@ foreach ($pIndApp as $p) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toIndividual($user, $docAccess["users"][$accessIndex["i"][$p]], $subject, $message, $params); + $notifier->toIndividual($user, $docAccess["users"][$accessIndex["i"][$p]], $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); } } break; @@ -434,7 +434,7 @@ if (count($approvalIndex["i"]) > 0) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toIndividual($user, $docAccess["users"][$accessIndex["i"][$rx]], $subject, $message, $params); + $notifier->toIndividual($user, $docAccess["users"][$accessIndex["i"][$rx]], $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); } } break; @@ -480,7 +480,7 @@ foreach ($pGrpApp as $p) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toGroup($user, $docAccess["groups"][$accessIndex["g"][$p]], $subject, $message, $params); + $notifier->toGroup($user, $docAccess["groups"][$accessIndex["g"][$p]], $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); } } break; @@ -538,7 +538,7 @@ if (count($approvalIndex["g"]) > 0) { $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toGroup($user, $docAccess["groups"][$accessIndex["g"][$rx]], $subject, $message, $params); + $notifier->toGroup($user, $docAccess["groups"][$accessIndex["g"][$rx]], $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); } } break; diff --git a/op/op.SetWorkflow.php b/op/op.SetWorkflow.php index 006767a90..b679ab885 100644 --- a/op/op.SetWorkflow.php +++ b/op/op.SetWorkflow.php @@ -91,10 +91,10 @@ if ($notifier) { foreach($workflow->getNextTransitions($workflow->getInitState()) as $ntransition) { foreach($ntransition->getUsers() as $tuser) { - $notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params); + $notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW); } foreach($ntransition->getGroups() as $tuser) { - $notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params); + $notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW); } } } diff --git a/op/op.TransferDocument.php b/op/op.TransferDocument.php index 9072c1f9f..6d8c43461 100644 --- a/op/op.TransferDocument.php +++ b/op/op.TransferDocument.php @@ -81,9 +81,9 @@ if ($notifier){ $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } diff --git a/op/op.TriggerWorkflow.php b/op/op.TriggerWorkflow.php index f2701d004..6d4b9dac1 100644 --- a/op/op.TriggerWorkflow.php +++ b/op/op.TriggerWorkflow.php @@ -97,9 +97,9 @@ if($version->triggerWorkflowTransition($user, $transition, $_POST["comment"])) { $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); // Send notification to subscribers. - $notifier->toList($user, $nl["users"], $subject, $message, $params); + $notifier->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($nl["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } if($settings->_enableNotificationWorkflow) { @@ -122,13 +122,13 @@ if($version->triggerWorkflowTransition($user, $transition, $_POST["comment"])) { foreach($ntransition->getUsers() as $tuser) { if(!in_array($tuser->getUser()->getID(), $usersinformed)) { $usersinformed[] = $tuser->getUser()->getID(); - $notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params); + $notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WOâ–¨KFLOW); } } foreach($ntransition->getGroups() as $tuser) { if(!in_array($tuser->getGroup()->getID(), $groupsinformed)) { $groupsinformed[] = $tuser->getGroup()->getID(); - $notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params); + $notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW); } } } diff --git a/op/op.UpdateDocument.php b/op/op.UpdateDocument.php index ea2751fef..18a67d0f8 100644 --- a/op/op.UpdateDocument.php +++ b/op/op.UpdateDocument.php @@ -322,13 +322,13 @@ default: $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } // if user is not owner send notification to owner // if ($user->getID() != $document->getOwner()->getID()) -// $notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params); +// $notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); if($workflow && $settings->_enableNotificationWorkflow) { $subject = "request_workflow_action_email_subject"; @@ -346,10 +346,10 @@ default: foreach($workflow->getNextTransitions($workflow->getInitState()) as $ntransition) { foreach($ntransition->getUsers() as $tuser) { - $notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params); + $notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW); } foreach($ntransition->getGroups() as $tuser) { - $notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params); + $notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW); } } } @@ -370,10 +370,10 @@ default: $params['http_root'] = $settings->_httpRoot; foreach($reviewers['i'] as $reviewerid) { - $notifier->toIndividual($user, $dms->getUser($reviewerid), $subject, $message, $params); + $notifier->toIndividual($user, $dms->getUser($reviewerid), $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); } foreach($reviewers['g'] as $reviewergrpid) { - $notifier->toGroup($user, $dms->getGroup($reviewergrpid), $subject, $message, $params); + $notifier->toGroup($user, $dms->getGroup($reviewergrpid), $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER); } } @@ -391,10 +391,10 @@ default: $params['http_root'] = $settings->_httpRoot; foreach($approvers['i'] as $approverid) { - $notifier->toIndividual($user, $dms->getUser($approverid), $subject, $message, $params); + $notifier->toIndividual($user, $dms->getUser($approverid), $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); } foreach($approvers['g'] as $approvergrpid) { - $notifier->toGroup($user, $dms->getGroup($approvergrpid), $subject, $message, $params); + $notifier->toGroup($user, $dms->getGroup($approvergrpid), $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER); } } } @@ -410,9 +410,9 @@ default: $params['url'] = getBaseUrl().$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); + $notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); foreach ($notifyList["groups"] as $grp) { - $notifier->toGroup($user, $grp, $subject, $message, $params); + $notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION); } } } diff --git a/op/op.UsrMgr.php b/op/op.UsrMgr.php index fe9f9035b..f0f919cd9 100644 --- a/op/op.UsrMgr.php +++ b/op/op.UsrMgr.php @@ -296,7 +296,7 @@ else if ($action == "sendlogindata" && $settings->_enableEmail) { $params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewFolder.php"; $params['sitename'] = $settings->_siteName; $params['http_root'] = $settings->_httpRoot; - $notifier->toIndividual($user, $newuser, $subject, $message, $params); + $notifier->toIndividual($user, $newuser, $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } add_log_line(".php&action=sendlogindata&userid=".$userid); From 3655f4b08c99098469ca26cf8f4c15af2a17bc5b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 29 Jan 2021 09:52:34 +0100 Subject: [PATCH 8/8] add note about modified notification service --- CHANGELOG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 277d42749..7832181d9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,8 @@ - fix possible csrf attacks due to missing form token - show an error msg on the documents detail page if the checksum of version mismatch +- overhaul notifications, type of receiver is now passed to notification + service which allows a more fine grained filtering -------------------------------------------------------------------------------- Changes in version 5.1.21