mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-11 16:35:38 +00:00
add sendApprovalRequestMail() and sendReviewRequestMail()
This commit is contained in:
parent
aadcbbd979
commit
cd10bcaea3
|
@ -147,8 +147,12 @@ class SeedDMS_NotificationService {
|
|||
|
||||
/**
|
||||
* This notification is sent when a review or approval is needed.
|
||||
* The method is only called by sendNewDocumentMail() and sendNewDocumentVersionMail().
|
||||
* It does not care about the current status of an approval or review, but
|
||||
* informs an reviewer and approver. Hence, it should only be called
|
||||
* right after a new document version was created.
|
||||
*/
|
||||
public function sendRequestRevAppActionMail($content, $user) { /* {{{ */
|
||||
private function sendRequestRevAppActionMail($content, $user) { /* {{{ */
|
||||
$document = $content->getDocument();
|
||||
$folder = $document->getFolder();
|
||||
|
||||
|
@ -200,6 +204,88 @@ class SeedDMS_NotificationService {
|
|||
}
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* This notification is sent when a review is needed.
|
||||
* In opposite to sendRequestRevAppActionMail() this method checks review status
|
||||
* and informs only those reviewers about a required review who have not
|
||||
* reviewed the document yet.
|
||||
*/
|
||||
public function sendReviewRequestMail($content, $user) { /* {{{ */
|
||||
$document = $content->getDocument();
|
||||
$dms = $document->getDMS();
|
||||
$folder = $document->getFolder();
|
||||
|
||||
if($this->settings->_enableNotificationAppRev) {
|
||||
$subject = "review_request_email_subject";
|
||||
$message = "review_request_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $document->getComment();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID()."¤ttab=revapp";
|
||||
$params['sitename'] = $this->settings->_siteName;
|
||||
$params['http_root'] = $this->settings->_httpRoot;
|
||||
|
||||
$reviewStatus = $content->getReviewStatus();
|
||||
foreach($reviewStatus as $dastat) {
|
||||
if ($dastat["status"] == 0) {
|
||||
if ($dastat["type"] == 0) {
|
||||
|
||||
$reviewer = $dms->getUser($dastat["required"]);
|
||||
$this->toIndividual($document->getOwner(), $reviewer, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER);
|
||||
} elseif ($dastat["type"] == 1) {
|
||||
|
||||
$group = $dms->getGroup($dastat["required"]);
|
||||
$this->toGroup($document->getOwner(), $group, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* This notification is sent when a review is needed.
|
||||
* In opposite to sendRequestRevAppActionMail() this method checks the approval status
|
||||
* and informs only those reviewers about a required approval who have not
|
||||
* approved the document yet.
|
||||
*/
|
||||
public function sendApprovalRequestMail($content, $user) { /* {{{ */
|
||||
$document = $content->getDocument();
|
||||
$dms = $document->getDMS();
|
||||
$folder = $document->getFolder();
|
||||
|
||||
if($this->settings->_enableNotificationAppRev) {
|
||||
$subject = "approval_request_email_subject";
|
||||
$message = "approval_request_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $document->getComment();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID()."¤ttab=revapp";
|
||||
$params['sitename'] = $this->settings->_siteName;
|
||||
$params['http_root'] = $this->settings->_httpRoot;
|
||||
|
||||
$approvalStatus = $content->getApprovalStatus();
|
||||
foreach($approvalStatus as $dastat) {
|
||||
if ($dastat["status"] == 0) {
|
||||
if ($dastat["type"] == 0) {
|
||||
|
||||
$approver = $dms->getUser($dastat["required"]);
|
||||
$this->toIndividual($document->getOwner(), $approver, $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER);
|
||||
} elseif ($dastat["type"] == 1) {
|
||||
|
||||
$group = $dms->getGroup($dastat["required"]);
|
||||
$this->toGroup($document->getOwner(), $group, $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* This notification is sent when a new document is created.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user