add new notification receiver types, pass recv type to notif. service

This commit is contained in:
Uwe Steinmann 2021-01-29 10:12:42 +01:00
parent 8c2aac4d98
commit 6a3939158b
6 changed files with 27 additions and 25 deletions

View File

@ -45,6 +45,8 @@ class SeedDMS_NotificationService {
const RECV_REVIEWER = 3;
const RECV_APPROVER = 4;
const RECV_WORKFLOW = 5;
const RECV_REVISOR = 6;
const RECV_RECIPIENT = 7;
public function __construct($logger = null) {
$this->services = array();

View File

@ -284,9 +284,9 @@ else
$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($workflow && $settings->_enableNotificationWorkflow) {
@ -305,10 +305,10 @@ else
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);
}
}
}
@ -329,10 +329,10 @@ else
$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);
}
}
@ -350,10 +350,10 @@ else
$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);
}
}
}
@ -418,9 +418,9 @@ else
$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);
}
}
} else {

View File

@ -123,7 +123,7 @@ if ($_POST["reviewType"] == "ind" || $_POST["reviewType"] == "grp") {
$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, SeedDMS_NotificationService::RECV_NOTIFICATION);
}

View File

@ -112,11 +112,11 @@ if ($_POST["revisionType"] == "ind" || $_POST["revisionType"] == "grp") {
$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);
}
}
@ -136,11 +136,11 @@ if($olddocstatus['status'] != $newdocstatus['status']) {
$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);
}
}

View File

@ -141,7 +141,7 @@ foreach ($pIndRev as $p) {
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toIndividual($user, $accessIndex["i"][$p], $subject, $message, $params);
$notifier->toIndividual($user, $accessIndex["i"][$p], $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
}
}
break;
@ -200,7 +200,7 @@ if (count($receiptIndex["i"]) > 0) {
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toIndividual($user, $accessIndex["i"][$rx], $subject, $message, $params);
$notifier->toIndividual($user, $accessIndex["i"][$rx], $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
}
}
break;
@ -248,7 +248,7 @@ foreach ($pGrpRev as $p) {
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toGroup($user, $accessIndex["g"][$p], $subject, $message, $params);
$notifier->toGroup($user, $accessIndex["g"][$p], $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
}
}
break;
@ -303,7 +303,7 @@ if (count($receiptIndex["g"]) > 0) {
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toGroup($user, $accessIndex["g"][$rx], $subject, $message, $params);
$notifier->toGroup($user, $accessIndex["g"][$rx], $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
}
}
break;

View File

@ -139,7 +139,7 @@ foreach ($pIndRev as $p) {
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toIndividual($user, $accessIndex["i"][$p], $subject, $message, $params);
$notifier->toIndividual($user, $accessIndex["i"][$p], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
}
}
break;
@ -198,7 +198,7 @@ if (count($revisionIndex["i"]) > 0) {
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toIndividual($user, $accessIndex["i"][$rx], $subject, $message, $params);
$notifier->toIndividual($user, $accessIndex["i"][$rx], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
}
}
break;
@ -246,7 +246,7 @@ foreach ($pGrpRev as $p) {
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toGroup($user, $accessIndex["g"][$p], $subject, $message, $params);
$notifier->toGroup($user, $accessIndex["g"][$p], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
}
}
break;
@ -301,7 +301,7 @@ if (count($revisionIndex["g"]) > 0) {
$params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot;
$notifier->toGroup($user, $accessIndex["g"][$rx], $subject, $message, $params);
$notifier->toGroup($user, $accessIndex["g"][$rx], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
}
}
break;