mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
move sending mails into inc.ClassNotificationService.php
This commit is contained in:
parent
ad84609a49
commit
aae9422e30
|
@ -95,28 +95,8 @@ if(!$controller->run()) {
|
|||
|
||||
if ($_POST["receiptType"] == "ind" || $_POST["receiptType"] == "grp") {
|
||||
if($notifier) {
|
||||
$nl=$document->getNotifyList();
|
||||
$subject = "receipt_submit_email_subject";
|
||||
$message = "receipt_submit_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['version'] = $version;
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['status'] = getReceiptStatusText($_POST["receiptStatus"]);
|
||||
$params['comment'] = strip_tags($_POST['comment']);
|
||||
$params['username'] = $user->getFullName();
|
||||
$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, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
foreach ($nl["groups"] as $grp) {
|
||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
}
|
||||
/* Send mail to owner only if the currently logged in user is not the
|
||||
* owner and the owner is not already in the list of notifiers.
|
||||
*/
|
||||
// if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users']))
|
||||
// $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||
$receiptlog = $latestContent->getReceiptLog();
|
||||
$notifier->sendSubmittedReceiptMail($latestContent, $user, $receiptlog ? $receiptlog[0] : false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,64 +93,26 @@ $controller->setParam('group', $group);
|
|||
$controller->setParam('comment', $_POST["comment"]);
|
||||
$controller->setParam('onevotereject', $settings->_enableRevisionOneVoteReject);
|
||||
if(!$controller->run()) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText($controller->getErrorMsg()));
|
||||
$err = $controller->getErrorMsg();
|
||||
if(is_string($err))
|
||||
$errmsg = getMLText($err);
|
||||
elseif(is_array($err)) {
|
||||
$errmsg = getMLText($err[0], $err[1]);
|
||||
} else {
|
||||
$errmsg = $err;
|
||||
}
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText($errmsg));
|
||||
}
|
||||
|
||||
if ($_POST["revisionType"] == "ind" || $_POST["revisionType"] == "grp") {
|
||||
if($notifier) {
|
||||
$nl=$document->getNotifyList();
|
||||
$subject = "revision_submit_email_subject";
|
||||
$message = "revision_submit_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['version'] = $version;
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['status'] = getRevisionStatusText($_POST["revisionStatus"]);
|
||||
$params['comment'] = strip_tags($_POST['comment']);
|
||||
$params['username'] = $user->getFullName();
|
||||
$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, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
foreach ($nl["groups"] as $grp) {
|
||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
if($notifier) {
|
||||
if ($_POST["revisionType"] == "ind" || $_POST["revisionType"] == "grp") {
|
||||
$revisionlog = $latestContent->getRevisionLog();
|
||||
$notifier->sendSubmittedRevisionMail($latestContent, $user, $revisionlog ? $revisionlog[0] : false);
|
||||
}
|
||||
/* Send mail to owner only if the currently logged in user is not the
|
||||
* owner and the owner is not already in the list of notifiers.
|
||||
*/
|
||||
// if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users']))
|
||||
// $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send notification about status change only if status has actually changed */
|
||||
$newdocstatus = $content->getStatus();
|
||||
if($olddocstatus['status'] != $newdocstatus['status']) {
|
||||
// Send notification to subscribers.
|
||||
if($notifier) {
|
||||
$nl=$document->getNotifyList();
|
||||
$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($olddocstatus['status']).' → '.getOverallStatusText($newdocstatus['status']);
|
||||
$params['new_status_code'] = $newdocstatus['status'];
|
||||
$params['old_status_code'] = $olddocstatus['status'];
|
||||
$params['username'] = $user->getFullName();
|
||||
$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, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
foreach ($nl["groups"] as $grp) {
|
||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||
}
|
||||
/* Send mail to owner only if the currently logged in user is not the
|
||||
* owner and the owner is not already in the list of notifiers.
|
||||
*/
|
||||
// if($user->getID() != $document->getOwner()->getID() && false === SeedDMS_Core_DMS::inList($document->getOwner(), $nl['users']))
|
||||
// $notifier->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||
}
|
||||
/* Send notification about status change only if status has actually changed */
|
||||
if($controller->oldstatus != $controller->newstatus)
|
||||
$notifier->sendChangedDocumentStatusMail($latestContent, $user, $controller->oldstatus);
|
||||
}
|
||||
|
||||
header("Location:../out/out.ViewDocument.php?documentid=".$documentid."¤ttab=revision");
|
||||
|
|
|
@ -140,20 +140,7 @@ foreach ($pIndRev as $p) {
|
|||
// Send an email notification to the new recipient.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "receipt_request_email_subject";
|
||||
$message = "receipt_request_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['recipient'] = $accessIndex["i"][$p]->getFullName();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toIndividual($user, $accessIndex["i"][$p], $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
|
||||
$notifier->sendAddReceiptMail($content, $user, $accessIndex["i"][$p]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -187,20 +174,7 @@ if (count($receiptIndex["i"]) > 0) {
|
|||
// Send an email notification to the recipients.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "receipt_deletion_email_subject";
|
||||
$message = "receipt_deletion_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['recipient'] = $accessIndex["i"][$rx]->getFullName();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toIndividual($user, $accessIndex["i"][$rx], $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
|
||||
$notifier->sendDeleteReceiptMail($content, $user, $accessIndex["i"][$rx]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -247,20 +221,7 @@ foreach ($pGrpRev as $p) {
|
|||
// Send an email notification to the new recipient.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "receipt_request_email_subject";
|
||||
$message = "receipt_request_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['recipient'] = $accessIndex["g"][$p]->getName();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toGroup($user, $accessIndex["g"][$p], $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
|
||||
$notifier->sendAddReceiptMail($content, $user, $accessIndex["g"][$p]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -290,20 +251,7 @@ if (count($receiptIndex["g"]) > 0) {
|
|||
// Send an email notification to the recipients group.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "receipt_deletion_email_subject";
|
||||
$message = "receipt_deletion_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['recipient'] = $accessIndex["g"][$rx]->getName();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toGroup($user, $accessIndex["g"][$rx], $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
|
||||
$notifier->sendDeleteReceiptMail($content, $user, $accessIndex["g"][$rx]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -127,20 +127,7 @@ foreach ($pIndRev as $p) {
|
|||
// Send an email notification to the new recipient.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "revision_request_email_subject";
|
||||
$message = "revision_request_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['revisor'] = $accessIndex["i"][$p]->getFullName();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toIndividual($user, $accessIndex["i"][$p], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
|
||||
$notifier->sendAddRevisionMail($content, $user, $accessIndex["i"][$p]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -186,20 +173,7 @@ if (count($revisionIndex["i"]) > 0) {
|
|||
// Send an email notification to the recipients.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "revision_deletion_email_subject";
|
||||
$message = "revision_deletion_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['revisor'] = $accessIndex["i"][$rx]->getFullName();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toIndividual($user, $accessIndex["i"][$rx], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
|
||||
$notifier->sendDeleteRevisionMail($content, $user, $accessIndex["i"][$rx]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -234,20 +208,7 @@ foreach ($pGrpRev as $p) {
|
|||
// Send an email notification to the new recipient.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "revision_request_email_subject";
|
||||
$message = "revision_request_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['revisor'] = $accessIndex["g"][$p]->getName();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toGroup($user, $accessIndex["g"][$p], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
|
||||
$notifier->sendAddRevisionMail($content, $user, $accessIndex["g"][$p]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -289,20 +250,7 @@ if (count($revisionIndex["g"]) > 0) {
|
|||
// Send an email notification to the recipients group.
|
||||
if($settings->_enableNotificationAppRev) {
|
||||
if ($notifier) {
|
||||
$subject = "revision_deletion_email_subject";
|
||||
$message = "revision_deletion_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['revisor'] = $accessIndex["g"][$rx]->getName();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
|
||||
$notifier->toGroup($user, $accessIndex["g"][$rx], $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
|
||||
$notifier->sendDeleteRevisionMail($content, $user, $accessIndex["g"][$rx]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue
Block a user