mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
move notification emails into notification service
This commit is contained in:
parent
24be00ccd1
commit
5028f37acc
|
@ -811,8 +811,8 @@ class SeedDMS_NotificationService {
|
|||
}
|
||||
} /* }}} */
|
||||
|
||||
public function sendChangedDocumentStatusMail($document, $user, $oldstatus) { /* {{{ */
|
||||
$content = $document->getLatestContent();
|
||||
public function sendChangedDocumentStatusMail($content, $user, $oldstatus) { /* {{{ */
|
||||
$document = $content->getDocument();
|
||||
$overallStatus = $content->getStatus();
|
||||
$nl = $document->getNotifyList();
|
||||
$folder = $document->getFolder();
|
||||
|
@ -907,5 +907,52 @@ class SeedDMS_NotificationService {
|
|||
$notifier->toGroup($user, $obj, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
} /* }}} */
|
||||
|
||||
public function sendSubmittedReviewMail($content, $user, $reviewlog) { /* {{{ */
|
||||
$document = $content->getDocument();
|
||||
$nl=$document->getNotifyList();
|
||||
$folder = $document->getFolder();
|
||||
$subject = "review_submit_email_subject";
|
||||
$message = "review_submit_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['status'] = getReviewStatusText($reviewlog["status"]);
|
||||
$params['comment'] = $reviewlog['comment'];
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $this->settings->_siteName;
|
||||
$params['http_root'] = $this->settings->_httpRoot;
|
||||
$this->toList($user, $nl["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
foreach ($nl["groups"] as $grp) {
|
||||
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
}
|
||||
// $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||
} /* }}} */
|
||||
|
||||
public function sendSubmittedApprovalMail($content, $user, $approvelog) { /* {{{ */
|
||||
$document = $content->getDocument();
|
||||
$nl=$document->getNotifyList();
|
||||
$folder = $document->getFolder();
|
||||
$subject = "approval_submit_email_subject";
|
||||
$message = "approval_submit_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['status'] = getApprovalStatusText($approvelog["status"]);
|
||||
$params['comment'] = $approvelog['comment'];
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['sitename'] = $this->settings->_siteName;
|
||||
$params['http_root'] = $this->settings->_httpRoot;
|
||||
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID()."¤ttab=revapp";
|
||||
|
||||
$this->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);
|
||||
// $this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||
|
||||
} /* }}} */
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -100,29 +100,10 @@ if ($_POST["approvalType"] == "ind") {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("approval_update_failed"));
|
||||
}
|
||||
else {
|
||||
// Send an email notification to the document updater.
|
||||
if($notifier) {
|
||||
$subject = "approval_submit_email_subject";
|
||||
$message = "approval_submit_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['version'] = $version;
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['status'] = getApprovalStatusText($_POST["approvalStatus"]);
|
||||
$params['comment'] = $comment;
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID()."¤ttab=revapp";
|
||||
|
||||
$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, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
foreach ($nl["groups"] as $grp) {
|
||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
}
|
||||
$approvelog = $latestContent->getApproveLog();
|
||||
$notifier->sendSubmittedApprovalMail($latestContent, $user, $approvelog ? $approvelog[0] : false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,29 +119,10 @@ else if ($_POST["approvalType"] == "grp") {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("approval_update_failed"));
|
||||
}
|
||||
else {
|
||||
// Send an email notification to the document updater.
|
||||
if($notifier) {
|
||||
$subject = "approval_submit_email_subject";
|
||||
$message = "approval_submit_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['version'] = $version;
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['status'] = getApprovalStatusText($_POST["approvalStatus"]);
|
||||
$params['comment'] = $comment;
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID()."¤ttab=revapp";
|
||||
|
||||
$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, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
foreach ($nl["groups"] as $grp) {
|
||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
}
|
||||
$approvelog = $latestContent->getApproveLog();
|
||||
$notifier->sendSubmittedApprovalMail($latestContent, $user, $approvelog ? $approvelog[0] : false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -170,29 +132,12 @@ else if ($_POST["approvalType"] == "grp") {
|
|||
// updated.
|
||||
//
|
||||
|
||||
$overallStatus = $content->getStatus();
|
||||
if ($_POST["approvalStatus"]==-1){
|
||||
if($content->setStatus(S_REJECTED,$comment,$user)) {
|
||||
// Send notification to subscribers.
|
||||
if($notifier) {
|
||||
$nl=$document->getNotifyList();
|
||||
$folder = $document->getFolder();
|
||||
$subject = "document_status_changed_email_subject";
|
||||
$message = "document_status_changed_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['status'] = getOverallStatusText(S_REJECTED);
|
||||
$params['new_status_code'] = S_REJECTED;
|
||||
$params['comment'] = $document->getComment();
|
||||
$params['username'] = $user->getFullName();
|
||||
$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, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
foreach ($nl["groups"] as $grp) {
|
||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
}
|
||||
$notifier->sendChangedDocumentStatusMail($content, $user, $overallStatus["status"]);
|
||||
}
|
||||
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['approveDocument'])) {
|
||||
|
@ -227,25 +172,7 @@ if ($_POST["approvalStatus"]==-1){
|
|||
if($content->setStatus($newStatus, getMLText("automatic_status_update"), $user)) {
|
||||
// Send notification to subscribers.
|
||||
if($notifier) {
|
||||
$nl=$document->getNotifyList();
|
||||
$folder = $document->getFolder();
|
||||
$subject = "document_status_changed_email_subject";
|
||||
$message = "document_status_changed_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['status'] = getOverallStatusText($newStatus);
|
||||
$params['new_status_code'] = $newStatus;
|
||||
$params['comment'] = $document->getComment();
|
||||
$params['username'] = $user->getFullName();
|
||||
$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, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
foreach ($nl["groups"] as $grp) {
|
||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
}
|
||||
$notifier->sendChangedDocumentStatusMail($content, $user, $overallStatus["status"]);
|
||||
}
|
||||
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['approveDocument'])) {
|
||||
|
|
|
@ -80,7 +80,7 @@ if ($overrideStatus != $overallStatus["status"]) {
|
|||
} else {
|
||||
// Send notification to subscribers.
|
||||
if($notifier) {
|
||||
$notifier->sendChangedDocumentStatusMail($document, $user, $overallStatus["status"]);
|
||||
$notifier->sendChangedDocumentStatusMail($content, $user, $overallStatus["status"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,25 +100,8 @@ if ($_POST["reviewType"] == "ind") {
|
|||
else {
|
||||
// Send an email notification to the document updater.
|
||||
if($notifier) {
|
||||
$nl=$document->getNotifyList();
|
||||
$folder = $document->getFolder();
|
||||
$subject = "review_submit_email_subject";
|
||||
$message = "review_submit_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['version'] = $version;
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['status'] = getReviewStatusText($_POST["reviewStatus"]);
|
||||
$params['comment'] = $comment;
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID()."¤ttab=revapp";
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
$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);
|
||||
}
|
||||
// $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||
$reviewlog = $latestContent->getReviewLog();
|
||||
$notifier->sendSubmittedReviewMail($latestContent, $user, $reviewlog ? $reviewlog[0] : false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -136,24 +119,8 @@ else if ($_POST["reviewType"] == "grp") {
|
|||
else {
|
||||
// Send an email notification to the document updater.
|
||||
if($notifier) {
|
||||
$nl=$document->getNotifyList();
|
||||
$folder = $document->getFolder();
|
||||
$subject = "review_submit_email_subject";
|
||||
$message = "review_submit_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['version'] = $version;
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['status'] = getReviewStatusText($_POST["reviewStatus"]);
|
||||
$params['comment'] = $comment;
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
$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);
|
||||
}
|
||||
// $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||
$reviewlog = $latestContent->getReviewLog();
|
||||
$notifier->sendSubmittedReviewMail($latestContent, $user, $reviewlog ? $reviewlog[0] : false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user