set mail to list of user and group reviewers/approvers

not just users
This commit is contained in:
Uwe Steinmann 2015-03-16 08:57:29 +01:00
parent 53697b37ff
commit b4195171f9

View File

@ -109,18 +109,24 @@ else {
/* Before deleting the content get a list of all users that should /* Before deleting the content get a list of all users that should
* be informed about the removal. * be informed about the removal.
*/ */
$emailList = array(); $emailUserList = array();
$emailList[] = $version->_userID; $emailUserList[] = $version->_userID;
$status = $version->getReviewStatus(); $status = $version->getReviewStatus();
foreach ($status as $st) { foreach ($status as $st) {
if ($st["status"]==0 && !in_array($st["required"], $emailList)) { if ($st["status"]==0 && !in_array($st["required"], $emailUserList)) {
$emailList[] = $st["required"]; if($st['type'] == 0)
$emailUserList[] = $st["required"];
else
$emailGroupList[] = $st["required"];
} }
} }
$status = $version->getApprovalStatus(); $status = $version->getApprovalStatus();
foreach ($status as $st) { foreach ($status as $st) {
if ($st["status"]==0 && !in_array($st["required"], $emailList)) { if ($st["status"]==0 && !in_array($st["required"], $emailUserList)) {
$emailList[] = $st["required"]; if($st['type'] == 0)
$emailUserList[] = $st["required"];
else
$emailGroupList[] = $st["required"];
} }
} }
@ -130,16 +136,21 @@ else {
// Notify affected users. // Notify affected users.
if ($notifier){ if ($notifier){
$nl=$document->getNotifyList(); $nl=$document->getNotifyList();
$recipients = array(); $userrecipients = array();
foreach ($emailList as $eID) { foreach ($emailUserList as $eID) {
$eU = $version->_document->_dms->getUser($eID); $eU = $version->_document->_dms->getUser($eID);
$recipients[] = $eU; $userrecipients[] = $eU;
}
$grouprecipients = array();
foreach ($emailGroupList as $eID) {
$eU = $version->_document->_dms->getGroup($eID);
$grouprecipients[] = $eU;
} }
/* /*
$subject = "###SITENAME###: ".$document->getName().", v.".$version->_version." - ".getMLText("version_deleted_email"); $subject = "###SITENAME###: ".$document->getName().", v.".$version->_version." - ".getMLText("version_deleted_email");
$message = getMLText("version_deleted_email")."\r\n"; $message = getMLText("version_deleted_email")."\r\n";
$message .= $message .=
getMLText("document").": ".$document->getName()."\r\n". getMLText("document").": "User.$document->getName()."\r\n".
getMLText("version").": ".$version->_version."\r\n". getMLText("version").": ".$version->_version."\r\n".
getMLText("comment").": ".$version->getComment()."\r\n". getMLText("comment").": ".$version->getComment()."\r\n".
getMLText("user").": ".$user->getFullName()." <". $user->getEmail() ."> "; getMLText("user").": ".$user->getFullName()." <". $user->getEmail() ."> ";
@ -162,8 +173,11 @@ else {
$params['username'] = $user->getFullName(); $params['username'] = $user->getFullName();
$params['sitename'] = $settings->_siteName; $params['sitename'] = $settings->_siteName;
$params['http_root'] = $settings->_httpRoot; $params['http_root'] = $settings->_httpRoot;
$notifier->toList($user, $recipients, $subject, $message, $params); $notifier->toList($user, $userrecipients, $subject, $message, $params);
$notifier->toList($user, $nl["users"], $subject, $message, $params); $notifier->toList($user, $nl["users"], $subject, $message, $params);
foreach($grouprecipients as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params);
}
foreach ($nl["groups"] as $grp) { foreach ($nl["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params); $notifier->toGroup($user, $grp, $subject, $message, $params);
} }