mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
add functions to send mail on revision/receipt add/delete
This commit is contained in:
parent
0b4afff149
commit
ad84609a49
|
@ -1177,6 +1177,80 @@ class SeedDMS_NotificationService {
|
|||
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
|
||||
} /* }}} */
|
||||
|
||||
public function sendSubmittedReceiptMail($content, $user, $receiptlog) { /* {{{ */
|
||||
$document = $content->getDocument();
|
||||
$nl=$document->getNotifyList();
|
||||
$folder = $document->getFolder();
|
||||
$subject = "receipt_submit_email_subject";
|
||||
$message = "receipt_submit_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['document_id'] = $document->getId();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['status'] = getReceiptStatusText($receiptlog["status"]);
|
||||
$params['comment'] = $receiptlog['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);
|
||||
}
|
||||
/* 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']))
|
||||
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||
*/
|
||||
|
||||
/* Send mail to uploader of version only if the uploader is not the owner and
|
||||
* the currently logged in user is not the
|
||||
* owner and the owner is not already in the list of notifiers.
|
||||
*/
|
||||
if($user->getID() != $content->getUser()->getID() /* && $content->getUser()->getID() != $document->getOwner()->getID() */ && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
|
||||
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
|
||||
} /* }}} */
|
||||
|
||||
public function sendSubmittedRevisionMail($content, $user, $revisionlog) { /* {{{ */
|
||||
$document = $content->getDocument();
|
||||
$nl=$document->getNotifyList();
|
||||
$folder = $document->getFolder();
|
||||
$subject = "revision_submit_email_subject";
|
||||
$message = "revision_submit_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['document_id'] = $document->getId();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['status'] = getRevisionStatusText($revisionlog["status"]);
|
||||
$params['comment'] = $revisionlog['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);
|
||||
}
|
||||
/* 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']))
|
||||
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||
*/
|
||||
|
||||
/* Send mail to uploader of version only if the uploader is not the owner and
|
||||
* the currently logged in user is not the
|
||||
* owner and the owner is not already in the list of notifiers.
|
||||
*/
|
||||
if($user->getID() != $content->getUser()->getID() /* && $content->getUser()->getID() != $document->getOwner()->getID() */ && false === SeedDMS_Core_DMS::inList($content->getUser(), $nl['users']))
|
||||
$this->toIndividual($user, $content->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_UPLOADER);
|
||||
} /* }}} */
|
||||
|
||||
public function sendDeleteApprovalMail($content, $user, $approver) { /* {{{ */
|
||||
$document = $content->getDocument();
|
||||
$folder = $document->getFolder();
|
||||
|
@ -1210,7 +1284,11 @@ class SeedDMS_NotificationService {
|
|||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $content->getComment();
|
||||
$params['username'] = $user->getFullName();
|
||||
if($reviewer->isType('user'))
|
||||
$params['reviewer'] = $reviewer->getFullName();
|
||||
elseif($reviewer->isType('group'))
|
||||
$params['reviewer'] = $reviewer->getName();
|
||||
$params['username'] = $user->getName();
|
||||
$params['sitename'] = $this->settings->_siteName;
|
||||
$params['http_root'] = $this->settings->_httpRoot;
|
||||
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
|
@ -1221,6 +1299,58 @@ class SeedDMS_NotificationService {
|
|||
$this->toGroup($user, $reviewer, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER);
|
||||
} /* }}} */
|
||||
|
||||
public function sendDeleteRevisionMail($content, $user, $revisor) { /* {{{ */
|
||||
$document = $content->getDocument();
|
||||
$folder = $document->getFolder();
|
||||
$subject = "revision_deletion_email_subject";
|
||||
$message = "revision_deletion_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['document_id'] = $document->getId();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $content->getComment();
|
||||
if($revisor->isType('user'))
|
||||
$params['revisor'] = $revisor->getFullName();
|
||||
elseif($revisor->isType('group'))
|
||||
$params['revisor'] = $revisor->getName();
|
||||
$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();
|
||||
|
||||
if($revisor->isType('user'))
|
||||
$this->toIndividual($user, $revisor, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
|
||||
elseif($revisor->isType('group'))
|
||||
$this->toGroup($user, $revisor, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
|
||||
} /* }}} */
|
||||
|
||||
public function sendDeleteReceiptMail($content, $user, $recipient) { /* {{{ */
|
||||
$document = $content->getDocument();
|
||||
$folder = $document->getFolder();
|
||||
$subject = "receipt_deletion_email_subject";
|
||||
$message = "receipt_deletion_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['document_id'] = $document->getId();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $content->getComment();
|
||||
if($recipient->isType('user'))
|
||||
$params['recipient'] = $recipient->getFullName();
|
||||
elseif($recipient->isType('group'))
|
||||
$params['recipient'] = $recipient->getName();
|
||||
$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();
|
||||
|
||||
if($recipient->isType('user'))
|
||||
$this->toIndividual($user, $recipient, $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
|
||||
elseif($recipient->isType('group'))
|
||||
$this->toGroup($user, $recipient, $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* This notification is send if a new approver is added.
|
||||
*
|
||||
|
@ -1272,6 +1402,10 @@ class SeedDMS_NotificationService {
|
|||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $content->getComment();
|
||||
if($reviewer->isType('user'))
|
||||
$params['reviewer'] = $reviewer->getFullName();
|
||||
elseif($reviewer->isType('group'))
|
||||
$params['reviewer'] = $reviewer->getName();
|
||||
$params['username'] = $user->getFullName();
|
||||
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
||||
$params['sitename'] = $this->settings->_siteName;
|
||||
|
@ -1283,6 +1417,60 @@ class SeedDMS_NotificationService {
|
|||
$this->toGroup($user, $reviewer, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER);
|
||||
} /* }}} */
|
||||
|
||||
public function sendAddRevisionMail($content, $user, $revisor) { /* {{{ */
|
||||
$document = $content->getDocument();
|
||||
$folder = $document->getFolder();
|
||||
|
||||
$subject = "revision_request_email_subject";
|
||||
$message = "revision_request_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['document_id'] = $document->getId();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $content->getComment();
|
||||
if($revisor->isType('user'))
|
||||
$params['revisor'] = $revisor->getFullName();
|
||||
elseif($revisor->isType('group'))
|
||||
$params['revisor'] = $user->getName();
|
||||
$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;
|
||||
|
||||
if($revisor->isType('user'))
|
||||
$this->toIndividual($user, $revisor, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
|
||||
elseif($revisor->isType('group'))
|
||||
$this->toGroup($user, $revisor, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVISOR);
|
||||
} /* }}} */
|
||||
|
||||
public function sendAddReceiptMail($content, $user, $recipient) { /* {{{ */
|
||||
$document = $content->getDocument();
|
||||
$folder = $document->getFolder();
|
||||
|
||||
$subject = "receipt_request_email_subject";
|
||||
$message = "receipt_request_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['document_id'] = $document->getId();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['version'] = $content->getVersion();
|
||||
$params['comment'] = $content->getComment();
|
||||
if($recipient->isType('user'))
|
||||
$params['recipient'] = $recipient->getFullName();
|
||||
elseif($recipient->isType('group'))
|
||||
$params['recipient'] = $user->getName();
|
||||
$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;
|
||||
|
||||
if($recipient->isType('user'))
|
||||
$this->toIndividual($user, $recipient, $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
|
||||
elseif($recipient->isType('group'))
|
||||
$this->toGroup($user, $recipient, $subject, $message, $params, SeedDMS_NotificationService::RECV_RECIPIENT);
|
||||
} /* }}} */
|
||||
|
||||
public function sendChangedDocumentOwnerMail($document, $user, $oldowner) { /* {{{ */
|
||||
if($oldowner->getID() != $document->getOwner()->getID()) {
|
||||
$notifyList = $document->getNotifyList();
|
||||
|
|
Loading…
Reference in New Issue
Block a user