mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
447c035065
|
@ -3944,6 +3944,35 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
return M_NONE;
|
return M_NONE;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a list of all reviewers separated by individuals and groups
|
||||||
|
*
|
||||||
|
* @return array|bool|null
|
||||||
|
*/
|
||||||
|
function getReviewers() { /* {{{ */
|
||||||
|
$dms = $this->_document->getDMS();
|
||||||
|
$db = $dms->getDB();
|
||||||
|
|
||||||
|
$queryStr=
|
||||||
|
"SELECT * FROM `tblDocumentReviewers` WHERE `version`='".$this->_version
|
||||||
|
."' AND `documentID` = '". $this->_document->getID() ."' ";
|
||||||
|
|
||||||
|
$recs = $db->getResultArray($queryStr);
|
||||||
|
if (is_bool($recs))
|
||||||
|
return false;
|
||||||
|
$reviewers = array('i'=>array(), 'g'=>array());
|
||||||
|
foreach($recs as $rec) {
|
||||||
|
if($rec['type'] == 0) {
|
||||||
|
if($u = $dms->getUser($rec['required']))
|
||||||
|
$reviewers['i'][] = $u;
|
||||||
|
} elseif($rec['type'] == 1) {
|
||||||
|
if($g = $dms->getGroup($rec['required']))
|
||||||
|
$reviewers['g'][] = $g;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $reviewers;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current review status of the document content
|
* Get the current review status of the document content
|
||||||
* The review status is a list of reviews and its current status
|
* The review status is a list of reviews and its current status
|
||||||
|
@ -4072,6 +4101,35 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
return true;
|
return true;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a list of all approvers separated by individuals and groups
|
||||||
|
*
|
||||||
|
* @return array|bool|null
|
||||||
|
*/
|
||||||
|
function getApprovers() { /* {{{ */
|
||||||
|
$dms = $this->_document->getDMS();
|
||||||
|
$db = $dms->getDB();
|
||||||
|
|
||||||
|
$queryStr=
|
||||||
|
"SELECT * FROM `tblDocumentApprovers` WHERE `version`='".$this->_version
|
||||||
|
."' AND `documentID` = '". $this->_document->getID() ."' ";
|
||||||
|
|
||||||
|
$recs = $db->getResultArray($queryStr);
|
||||||
|
if (is_bool($recs))
|
||||||
|
return false;
|
||||||
|
$approvers = array('i'=>array(), 'g'=>array());
|
||||||
|
foreach($recs as $rec) {
|
||||||
|
if($rec['type'] == 0) {
|
||||||
|
if($u = $dms->getUser($rec['required']))
|
||||||
|
$approvers['i'][] = $u;
|
||||||
|
} elseif($rec['type'] == 1) {
|
||||||
|
if($g = $dms->getGroup($rec['required']))
|
||||||
|
$approvers['g'][] = $g;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $approvers;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current approval status of the document content
|
* Get the current approval status of the document content
|
||||||
* The approval status is a list of approvals and its current status
|
* The approval status is a list of approvals and its current status
|
||||||
|
|
|
@ -1902,6 +1902,7 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
|
||||||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||||
<notes>
|
<notes>
|
||||||
- SeedDMS_Core_DMS::getTimeline() uses status log instead of document content
|
- SeedDMS_Core_DMS::getTimeline() uses status log instead of document content
|
||||||
|
- add methods SeedDMS_Core_DocumentContent::getReviewers() and SeedDMS_Core_DocumentContent::getApprovers()
|
||||||
</notes>
|
</notes>
|
||||||
</release>
|
</release>
|
||||||
<release>
|
<release>
|
||||||
|
|
|
@ -36,6 +36,11 @@ class SeedDMS_NotificationService {
|
||||||
*/
|
*/
|
||||||
protected $logger;
|
protected $logger;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Configuration
|
||||||
|
*/
|
||||||
|
protected $settings;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Possible types of receivers
|
* Possible types of receivers
|
||||||
*/
|
*/
|
||||||
|
@ -48,28 +53,29 @@ class SeedDMS_NotificationService {
|
||||||
const RECV_REVISOR = 6;
|
const RECV_REVISOR = 6;
|
||||||
const RECV_RECIPIENT = 7;
|
const RECV_RECIPIENT = 7;
|
||||||
|
|
||||||
public function __construct($logger = null) {
|
public function __construct($logger = null, $settings = null) { /* {{{ */
|
||||||
$this->services = array();
|
$this->services = array();
|
||||||
$this->errors = array();
|
$this->errors = array();
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
}
|
$this->settings = $settings;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
public function addService($service, $name='') {
|
public function addService($service, $name='') { /* {{{ */
|
||||||
if(!$name)
|
if(!$name)
|
||||||
$name = md5(uniqid());
|
$name = md5(uniqid());
|
||||||
$this->services[$name] = $service;
|
$this->services[$name] = $service;
|
||||||
$this->errors[$name] = true;
|
$this->errors[$name] = true;
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
public function getServices() {
|
public function getServices() { /* {{{ */
|
||||||
return $this->services;
|
return $this->services;
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
public function getErrors() {
|
public function getErrors() { /* {{{ */
|
||||||
return $this->errors;
|
return $this->errors;
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
public function toIndividual($sender, $recipient, $subject, $message, $params=array(), $recvtype=0) {
|
public function toIndividual($sender, $recipient, $subject, $message, $params=array(), $recvtype=0) { /* {{{ */
|
||||||
$error = true;
|
$error = true;
|
||||||
foreach($this->services as $name => $service) {
|
foreach($this->services as $name => $service) {
|
||||||
/* Set $to to email address of user or the string passed in $recipient
|
/* Set $to to email address of user or the string passed in $recipient
|
||||||
|
@ -98,26 +104,23 @@ class SeedDMS_NotificationService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $error;
|
return $error;
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a notification to each user of a group
|
* Send a notification to each user of a group
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function toGroup($sender, $groupRecipient, $subject, $message, $params=array(), $recvtype=0) {
|
public function toGroup($sender, $groupRecipient, $subject, $message, $params=array(), $recvtype=0) { /* {{{ */
|
||||||
$error = true;
|
$error = true;
|
||||||
foreach($this->services as $name => $service) {
|
$ret = true;
|
||||||
$ret = true;
|
foreach ($groupRecipient->getUsers() as $recipient) {
|
||||||
foreach ($groupRecipient->getUsers() as $recipient) {
|
$ret &= $this->toIndividual($sender, $recipient, $subject, $message, $params, $recvtype);
|
||||||
$ret &= $this->toIndividual($sender, $recipient, $subject, $message, $params, $recvtype);
|
}
|
||||||
}
|
if(!$ret) {
|
||||||
$this->errors[$name] = $ret;
|
$error = false;
|
||||||
if(!$ret) {
|
|
||||||
$error = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $error;
|
return $error;
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a notification to a list of recipients
|
* Send a notification to a list of recipients
|
||||||
|
@ -132,20 +135,526 @@ class SeedDMS_NotificationService {
|
||||||
* @param int $recvtype type of receiver
|
* @param int $recvtype type of receiver
|
||||||
* @return boolean true on success, otherwise false
|
* @return boolean true on success, otherwise false
|
||||||
*/
|
*/
|
||||||
public function toList($sender, $recipients, $subject, $message, $params=array(), $recvtype=0) {
|
public function toList($sender, $recipients, $subject, $message, $params=array(), $recvtype=0) { /* {{{ */
|
||||||
$error = true;
|
$error = true;
|
||||||
foreach($this->services as $name => $service) {
|
$ret = true;
|
||||||
$ret = true;
|
foreach ($recipients as $recipient) {
|
||||||
foreach ($recipients as $recipient) {
|
$ret &= $this->toIndividual($sender, $recipient, $subject, $message, $params, $recvtype);
|
||||||
$ret &= $this->toIndividual($sender, $recipient, $subject, $message, $params, $recvtype);
|
}
|
||||||
}
|
if(!$ret) {
|
||||||
$this->errors[$name] = $ret;
|
$error = false;
|
||||||
if(!$ret) {
|
|
||||||
$error = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $error;
|
return $error;
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This notification is sent when a workflow action is needed.
|
||||||
|
*/
|
||||||
|
public function sendRequestWorkflowActionMail($content, $user) { /* {{{ */
|
||||||
|
$document = $content->getDocument();
|
||||||
|
$folder = $document->getFolder();
|
||||||
|
|
||||||
|
/* Send mail only if enabled in the configuration */
|
||||||
|
if($this->settings->_enableNotificationWorkflow && ($workflow = $content->getWorkflow())) {
|
||||||
|
$subject = "request_workflow_action_email_subject";
|
||||||
|
$message = "request_workflow_action_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $document->getName();
|
||||||
|
$params['version'] = $content->getVersion();
|
||||||
|
$params['workflow'] = $workflow->getName();
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$params['current_state'] = $workflow->getInitState()->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();
|
||||||
|
|
||||||
|
foreach($workflow->getNextTransitions($workflow->getInitState()) as $ntransition) {
|
||||||
|
foreach($ntransition->getUsers() as $tuser) {
|
||||||
|
$this->toIndividual($user, $tuser->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW);
|
||||||
|
}
|
||||||
|
foreach($ntransition->getGroups() as $tuser) {
|
||||||
|
$this->toGroup($user, $tuser->getGroup(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This notification is sent when a review or approval is needed.
|
||||||
|
*/
|
||||||
|
public function sendRequestRevAppActionMail($content, $user) { /* {{{ */
|
||||||
|
$document = $content->getDocument();
|
||||||
|
$folder = $document->getFolder();
|
||||||
|
|
||||||
|
if($this->settings->_enableNotificationAppRev) {
|
||||||
|
/* Reviewers and approvers will be informed about the new document */
|
||||||
|
$reviewers = $content->getReviewers(); //$controller->getParam('reviewers');
|
||||||
|
$approvers = $content->getApprovers(); //$controller->getParam('approvers');
|
||||||
|
if($reviewers['i'] || $reviewers['g']) {
|
||||||
|
$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();
|
||||||
|
$params['sitename'] = $this->settings->_siteName;
|
||||||
|
$params['http_root'] = $this->settings->_httpRoot;
|
||||||
|
|
||||||
|
foreach($reviewers['i'] as $reviewer) {
|
||||||
|
$this->toIndividual($user, $reviewer, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER);
|
||||||
|
}
|
||||||
|
foreach($reviewers['g'] as $reviewergrp) {
|
||||||
|
$this->toGroup($user, $reviewergrp, $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
elseif($approvers['i'] || $approvers['g']) {
|
||||||
|
$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();
|
||||||
|
$params['sitename'] = $this->settings->_siteName;
|
||||||
|
$params['http_root'] = $this->settings->_httpRoot;
|
||||||
|
|
||||||
|
foreach($approvers['i'] as $approver) {
|
||||||
|
$this->toIndividual($user, $approver, $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER);
|
||||||
|
}
|
||||||
|
foreach($approvers['g'] as $approvergrp) {
|
||||||
|
$this->toGroup($user, $approvergrp, $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This notification is sent when a new document is created.
|
||||||
|
*/
|
||||||
|
public function sendNewDocumentMail($document, $user) { /* {{{ */
|
||||||
|
$folder = $document->getFolder();
|
||||||
|
$fnl = $folder->getNotifyList();
|
||||||
|
$dnl = $document->getNotifyList();
|
||||||
|
$nl = array(
|
||||||
|
'users'=>array_unique(array_merge($dnl['users'], $fnl['users']), SORT_REGULAR),
|
||||||
|
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
|
||||||
|
);
|
||||||
|
|
||||||
|
$lc = $document->getLatestContent();
|
||||||
|
$subject = "new_document_email_subject";
|
||||||
|
$message = "new_document_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $document->getName();
|
||||||
|
$params['folder_name'] = $folder->getName();
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$params['username'] = $user->getFullName();
|
||||||
|
$params['comment'] = $document->getComment();
|
||||||
|
$params['version_comment'] = $lc->getComment();
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->sendRequestWorkflowActionMail($lc, $user);
|
||||||
|
|
||||||
|
$this->sendRequestRevAppActionMail($lc, $user);
|
||||||
|
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This notification is sent when a new document version is created.
|
||||||
|
*/
|
||||||
|
public function sendNewDocumentVersionMail($document, $user) { /* {{{ */
|
||||||
|
$lc = $document->getLatestContent();
|
||||||
|
$folder = $document->getFolder();
|
||||||
|
$notifyList = $document->getNotifyList();
|
||||||
|
|
||||||
|
$subject = "document_updated_email_subject";
|
||||||
|
$message = "document_updated_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $document->getName();
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$params['username'] = $user->getFullName();
|
||||||
|
$params['comment'] = $document->getComment();
|
||||||
|
$params['version_comment'] = $lc->getComment();
|
||||||
|
$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, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
foreach ($notifyList["groups"] as $grp) {
|
||||||
|
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
}
|
||||||
|
// if user is not owner send notification to owner
|
||||||
|
// if ($user->getID() != $document->getOwner()->getID())
|
||||||
|
// $this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||||
|
|
||||||
|
$this->sendRequestWorkflowActionMail($lc, $user);
|
||||||
|
|
||||||
|
$this->sendRequestRevAppActionMail($lc, $user);
|
||||||
|
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This notification is sent when a document is deleted.
|
||||||
|
* Keep in mind that $document refers to a document which has just been
|
||||||
|
* deleted from the database, but all the data needed is still in the
|
||||||
|
* object.
|
||||||
|
*/
|
||||||
|
public function sendDeleteDocumentMail($document, $user) { /* {{{ */
|
||||||
|
$folder = $document->getFolder();
|
||||||
|
$dnl = $document->getNotifyList();
|
||||||
|
$fnl = $folder->getNotifyList();
|
||||||
|
$nl = array(
|
||||||
|
'users'=>array_unique(array_merge($dnl['users'], $fnl['users']), SORT_REGULAR),
|
||||||
|
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
|
||||||
|
);
|
||||||
|
$subject = "document_deleted_email_subject";
|
||||||
|
$message = "document_deleted_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $document->getName();
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$params['username'] = $user->getFullName();
|
||||||
|
$params['sitename'] = $this->settings->_siteName;
|
||||||
|
$params['http_root'] = $this->settings->_httpRoot;
|
||||||
|
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID();
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This notification is sent when a new folder is created.
|
||||||
|
*/
|
||||||
|
public function sendNewFolderMail($folder, $user) { /* {{{ */
|
||||||
|
$parent = $folder->getParent();
|
||||||
|
$fnl = $parent->getNotifyList();
|
||||||
|
$snl = $folder->getNotifyList();
|
||||||
|
$nl = array(
|
||||||
|
'users'=>array_unique(array_merge($snl['users'], $fnl['users']), SORT_REGULAR),
|
||||||
|
'groups'=>array_unique(array_merge($snl['groups'], $fnl['groups']), SORT_REGULAR)
|
||||||
|
);
|
||||||
|
|
||||||
|
$subject = "new_subfolder_email_subject";
|
||||||
|
$message = "new_subfolder_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $folder->getName();
|
||||||
|
$params['folder_name'] = $parent->getName();
|
||||||
|
$params['folder_path'] = $parent->getFolderPathPlain();
|
||||||
|
$params['username'] = $user->getFullName();
|
||||||
|
$params['comment'] = $folder->getComment();
|
||||||
|
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->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);
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This notification is sent when a folder is deleted.
|
||||||
|
* Keep in mind that $folder refers to a folder which has just been
|
||||||
|
* deleted from the database, but all the data needed is still in the
|
||||||
|
* object.
|
||||||
|
*/
|
||||||
|
public function sendDeleteFolderMail($folder, $user) { /* {{{ */
|
||||||
|
$parent = $folder->getParent();
|
||||||
|
$fnl = $folder->getNotifyList();
|
||||||
|
$pnl = $parent->getNotifyList();
|
||||||
|
$nl = array(
|
||||||
|
'users'=>array_unique(array_merge($fnl['users'], $pnl['users']), SORT_REGULAR),
|
||||||
|
'groups'=>array_unique(array_merge($fnl['groups'], $pnl['groups']), SORT_REGULAR)
|
||||||
|
);
|
||||||
|
|
||||||
|
$subject = "folder_deleted_email_subject";
|
||||||
|
$message = "folder_deleted_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $folder->getName();
|
||||||
|
$params['folder_path'] = $parent->getFolderPathPlain();
|
||||||
|
$params['username'] = $user->getFullName();
|
||||||
|
$params['sitename'] = $this->settings->_siteName;
|
||||||
|
$params['http_root'] = $this->settings->_httpRoot;
|
||||||
|
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewFolder.php?folderid=".$parent->getID();
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This notification is sent when a new attachment is created.
|
||||||
|
*/
|
||||||
|
public function sendNewFileMail($file, $user) { /* {{{ */
|
||||||
|
$document = $file->getDocument();
|
||||||
|
$folder = $document->getFolder();
|
||||||
|
$notifyList = $document->getNotifyList();
|
||||||
|
|
||||||
|
$subject = "new_file_email_subject";
|
||||||
|
$message = "new_file_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $file->getName();
|
||||||
|
$params['document'] = $document->getName();
|
||||||
|
$params['folder_name'] = $folder->getName();
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$params['username'] = $user->getFullName();
|
||||||
|
$params['comment'] = $file->getComment();
|
||||||
|
$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 user is not owner and owner not already in list of notifiers, then
|
||||||
|
// send notification to owner
|
||||||
|
if ($user->getID() != $document->getOwner()->getID() &&
|
||||||
|
false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) {
|
||||||
|
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||||
|
}
|
||||||
|
$this->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
foreach ($notifyList["groups"] as $grp) {
|
||||||
|
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
public function sendChangedExpiryMail($document, $user, $oldexpires) { /* {{{ */
|
||||||
|
$folder = $document->getFolder();
|
||||||
|
$notifyList = $document->getNotifyList();
|
||||||
|
|
||||||
|
if($oldexpires != $document->getExpires()) {
|
||||||
|
// Send notification to subscribers.
|
||||||
|
$subject = "expiry_changed_email_subject";
|
||||||
|
$message = "expiry_changed_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $document->getName();
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$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 user is not owner and owner not already in list of notifiers, then
|
||||||
|
// send notification to owner
|
||||||
|
if ($user->getID() != $document->getOwner()->getID() &&
|
||||||
|
false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) {
|
||||||
|
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||||
|
}
|
||||||
|
$this->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
foreach ($notifyList["groups"] as $grp) {
|
||||||
|
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
public function sendChangedAttributesMail($document, $user, $oldattributes) { /* {{{ */
|
||||||
|
$folder = $document->getFolder();
|
||||||
|
$notifyList = $document->getNotifyList();
|
||||||
|
|
||||||
|
$newattributes = $document->getAttributes();
|
||||||
|
if($oldattributes) {
|
||||||
|
foreach($oldattributes as $attrdefid=>$attribute) {
|
||||||
|
if(!isset($newattributes[$attrdefid]) || $newattributes[$attrdefid]->getValueAsArray() !== $oldattributes[$attrdefid]->getValueAsArray()) {
|
||||||
|
$subject = "document_attribute_changed_email_subject";
|
||||||
|
$message = "document_attribute_changed_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $document->getName();
|
||||||
|
$params['attribute_name'] = $attribute->getAttributeDefinition()->getName();
|
||||||
|
$params['attribute_old_value'] = $oldattributes[$attrdefid]->getValue();
|
||||||
|
$params['attribute_new_value'] = isset($newattributes[$attrdefid]) ? $newattributes[$attrdefid]->getValue() : '';
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$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, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
foreach ($notifyList["groups"] as $grp) {
|
||||||
|
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Check for new attributes which didn't have a value before */
|
||||||
|
if($newattributes) {
|
||||||
|
foreach($newattributes as $attrdefid=>$attribute) {
|
||||||
|
if(!isset($oldattributes[$attrdefid]) && $attribute) {
|
||||||
|
$subject = "document_attribute_changed_email_subject";
|
||||||
|
$message = "document_attribute_changed_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $document->getName();
|
||||||
|
$params['attribute_name'] = $dms->getAttributeDefinition($attrdefid)->getName();
|
||||||
|
$params['attribute_old_value'] = '';
|
||||||
|
$params['attribute_new_value'] = $attribute->getValue();
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$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, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
foreach ($notifyList["groups"] as $grp) {
|
||||||
|
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
public function sendChangedCommentMail($document, $user, $oldcomment) { /* {{{ */
|
||||||
|
if($oldcomment != $document->getComment()) {
|
||||||
|
$notifyList = $document->getNotifyList();
|
||||||
|
$folder = $document->getFolder();
|
||||||
|
$subject = "document_comment_changed_email_subject";
|
||||||
|
$message = "document_comment_changed_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $document->getName();
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$params['old_comment'] = $oldcomment;
|
||||||
|
$params['new_comment'] = $document->getComment();
|
||||||
|
$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 user is not owner send notification to owner
|
||||||
|
if ($user->getID() != $document->getOwner()->getID() &&
|
||||||
|
false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) {
|
||||||
|
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||||
|
}
|
||||||
|
$this->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
foreach ($notifyList["groups"] as $grp) {
|
||||||
|
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
public function sendChangedVersionCommentMail($content, $user, $oldcomment) { /* {{{ */
|
||||||
|
// FIXME: use extra mail template which includes the version
|
||||||
|
if($oldcomment != $content->getComment()) {
|
||||||
|
$document = $content->getDocument();
|
||||||
|
$notifyList = $document->getNotifyList();
|
||||||
|
$folder = $document->getFolder();
|
||||||
|
$subject = "document_comment_changed_email_subject";
|
||||||
|
$message = "document_comment_changed_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $document->getName();
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$params['old_comment'] = $oldcomment;
|
||||||
|
$params['new_comment'] = $content->getComment();
|
||||||
|
$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 user is not owner send notification to owner
|
||||||
|
if ($user->getID() != $document->getOwner()->getID() &&
|
||||||
|
false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) {
|
||||||
|
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||||
|
}
|
||||||
|
$this->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
foreach ($notifyList["groups"] as $grp) {
|
||||||
|
$this->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
public function sendChangedNameMail($document, $user, $oldname) { /* {{{ */
|
||||||
|
if($oldname != $document->getName()) {
|
||||||
|
$notifyList = $document->getNotifyList();
|
||||||
|
$folder = $document->getFolder();
|
||||||
|
$subject = "document_renamed_email_subject";
|
||||||
|
$message = "document_renamed_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $document->getName();
|
||||||
|
$params['old_name'] = $oldname;
|
||||||
|
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||||
|
$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 user is not owner send notification to owner
|
||||||
|
if ($user->getID() != $document->getOwner()->getID() &&
|
||||||
|
false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) {
|
||||||
|
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||||
|
}
|
||||||
|
$this->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
foreach ($notifyList["groups"] as $grp) {
|
||||||
|
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
public function sendMovedDocumentMail($document, $user, $oldfolder) { /* {{{ */
|
||||||
|
$targetfolder = $document->getFolder();
|
||||||
|
if($targetfolder->getId() == $oldfolder->getId())
|
||||||
|
return;
|
||||||
|
|
||||||
|
$nl1 = $oldfolder->getNotifyList();
|
||||||
|
$nl2 = $document->getNotifyList();
|
||||||
|
$nl3 = $targetfolder->getNotifyList();
|
||||||
|
$nl = array(
|
||||||
|
'users'=>array_unique(array_merge($nl1['users'], $nl2['users'], $nl3['users']), SORT_REGULAR),
|
||||||
|
'groups'=>array_unique(array_merge($nl1['groups'], $nl2['groups'], $nl3['groups']), SORT_REGULAR)
|
||||||
|
);
|
||||||
|
$subject = "document_moved_email_subject";
|
||||||
|
$message = "document_moved_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $document->getName();
|
||||||
|
$params['old_folder_path'] = $oldfolder->getFolderPathPlain();
|
||||||
|
$params['new_folder_path'] = $targetfolder->getFolderPathPlain();
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
// if user is not owner send notification to owner
|
||||||
|
if ($user->getID() != $document->getOwner()->getID() &&
|
||||||
|
false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) {
|
||||||
|
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
public function sendMovedFolderMail($folder, $user, $oldfolder) { /* {{{ */
|
||||||
|
$targetfolder = $folder->getParent();
|
||||||
|
if($targetfolder->getId() == $oldfolder->getId())
|
||||||
|
return;
|
||||||
|
|
||||||
|
$nl1 = $oldfolder->getNotifyList();
|
||||||
|
$nl2 = $folder->getNotifyList();
|
||||||
|
$nl3 = $targetfolder->getNotifyList();
|
||||||
|
$nl = array(
|
||||||
|
'users'=>array_unique(array_merge($nl1['users'], $nl2['users'], $nl3['users']), SORT_REGULAR),
|
||||||
|
'groups'=>array_unique(array_merge($nl1['groups'], $nl2['groups'], $nl3['groups']), SORT_REGULAR)
|
||||||
|
);
|
||||||
|
$subject = "folder_moved_email_subject";
|
||||||
|
$message = "folder_moved_email_body";
|
||||||
|
$params = array();
|
||||||
|
$params['name'] = $folder->getName();
|
||||||
|
$params['old_folder_path'] = $oldfolder->getFolderPathPlain();
|
||||||
|
$params['new_folder_path'] = $targetfolder->getFolderPathPlain();
|
||||||
|
$params['username'] = $user->getFullName();
|
||||||
|
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->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);
|
||||||
|
}
|
||||||
|
// if user is not owner send notification to owner
|
||||||
|
if ($user->getID() != $folder->getOwner()->getID() &&
|
||||||
|
false === SeedDMS_Core_DMS::inList($folder->getOwner(), $notifyList['users'])) {
|
||||||
|
$this->toIndividual($user, $folder->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -344,7 +344,7 @@ function getAttributeValidationError($error, $attrname='', $attrvalue='', $regex
|
||||||
case 10:
|
case 10:
|
||||||
return array("attr_not_in_valueset", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
return array("attr_not_in_valueset", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 9:
|
||||||
return array("attr_malformed_date", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
return array("attr_malformed_date", array('attrname'=>$attrname, 'value'=>$attrvalue));
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $logger;
|
global $logger;
|
||||||
$notifier = new SeedDMS_NotificationService($logger);
|
$notifier = new SeedDMS_NotificationService($logger, $settings);
|
||||||
|
|
||||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
|
||||||
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {
|
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {
|
||||||
|
|
|
@ -455,105 +455,7 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
|
||||||
} else {
|
} else {
|
||||||
// Send notification to subscribers of folder.
|
// Send notification to subscribers of folder.
|
||||||
if($notifier) {
|
if($notifier) {
|
||||||
$fnl = $folder->getNotifyList();
|
$notifier->sendNewDocumentMail($document, $user);
|
||||||
$dnl = $document->getNotifyList();
|
|
||||||
$nl = array(
|
|
||||||
'users'=>array_unique(array_merge($dnl['users'], $fnl['users']), SORT_REGULAR),
|
|
||||||
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
|
|
||||||
);
|
|
||||||
|
|
||||||
$subject = "new_document_email_subject";
|
|
||||||
$message = "new_document_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $name;
|
|
||||||
$params['folder_name'] = $folder->getName();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$params['username'] = $user->getFullName();
|
|
||||||
$params['comment'] = $comment;
|
|
||||||
$params['version_comment'] = $version_comment;
|
|
||||||
$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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get workflow from controller in case it was modified in a hook */
|
|
||||||
$workflow = $controller->getParam('workflow');
|
|
||||||
if($workflow && $settings->_enableNotificationWorkflow) {
|
|
||||||
$subject = "request_workflow_action_email_subject";
|
|
||||||
$message = "request_workflow_action_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['version'] = $reqversion;
|
|
||||||
$params['workflow'] = $workflow->getName();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$params['current_state'] = $workflow->getInitState()->getName();
|
|
||||||
$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();
|
|
||||||
|
|
||||||
foreach($workflow->getNextTransitions($workflow->getInitState()) as $ntransition) {
|
|
||||||
foreach($ntransition->getUsers() as $tuser) {
|
|
||||||
$notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW);
|
|
||||||
}
|
|
||||||
foreach($ntransition->getGroups() as $tuser) {
|
|
||||||
$notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($settings->_enableNotificationAppRev) {
|
|
||||||
/* Reviewers and approvers will be informed about the new document */
|
|
||||||
/* Get reviewers and approvers from controller in case it was
|
|
||||||
* modified in a hook
|
|
||||||
*/
|
|
||||||
$reviewers = $controller->getParam('reviewers');
|
|
||||||
$approvers = $controller->getParam('approvers');
|
|
||||||
if($reviewers['i'] || $reviewers['g']) {
|
|
||||||
$subject = "review_request_email_subject";
|
|
||||||
$message = "review_request_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$params['version'] = $reqversion;
|
|
||||||
$params['comment'] = $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;
|
|
||||||
|
|
||||||
foreach($reviewers['i'] as $reviewerid) {
|
|
||||||
$notifier->toIndividual($user, $dms->getUser($reviewerid), $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER);
|
|
||||||
}
|
|
||||||
foreach($reviewers['g'] as $reviewergrpid) {
|
|
||||||
$notifier->toGroup($user, $dms->getGroup($reviewergrpid), $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
elseif($approvers['i'] || $approvers['g']) {
|
|
||||||
$subject = "approval_request_email_subject";
|
|
||||||
$message = "approval_request_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$params['version'] = $reqversion;
|
|
||||||
$params['comment'] = $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;
|
|
||||||
|
|
||||||
foreach($approvers['i'] as $approverid) {
|
|
||||||
$notifier->toIndividual($user, $dms->getUser($approverid), $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER);
|
|
||||||
}
|
|
||||||
foreach($approvers['g'] as $approvergrpid) {
|
|
||||||
$notifier->toGroup($user, $dms->getGroup($approvergrpid), $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if($settings->_removeFromDropFolder) {
|
if($settings->_removeFromDropFolder) {
|
||||||
if(file_exists($userfiletmp)) {
|
if(file_exists($userfiletmp)) {
|
||||||
|
|
|
@ -111,22 +111,7 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
|
||||||
} else {
|
} else {
|
||||||
// Send notification to subscribers.
|
// Send notification to subscribers.
|
||||||
if($notifier) {
|
if($notifier) {
|
||||||
$notifyList = $document->getNotifyList();
|
$notifier->sendNewFileMail($res, $user);
|
||||||
|
|
||||||
$subject = "new_file_email_subject";
|
|
||||||
$message = "new_file_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $name;
|
|
||||||
$params['document'] = $document->getName();
|
|
||||||
$params['username'] = $user->getFullName();
|
|
||||||
$params['comment'] = $comment;
|
|
||||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
|
||||||
$params['sitename'] = $settings->_siteName;
|
|
||||||
$params['http_root'] = $settings->_httpRoot;
|
|
||||||
$notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
foreach ($notifyList["groups"] as $grp) {
|
|
||||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,5 +120,4 @@ add_log_line("?name=".$name."&documentid=".$documentid);
|
||||||
|
|
||||||
header("Location:../out/out.ViewDocument.php?documentid=".$documentid."¤ttab=attachments");
|
header("Location:../out/out.ViewDocument.php?documentid=".$documentid."¤ttab=attachments");
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -121,6 +121,8 @@ if(!$subFolder = $controller->run()) {
|
||||||
} else {
|
} else {
|
||||||
// Send notification to subscribers.
|
// Send notification to subscribers.
|
||||||
if($notifier) {
|
if($notifier) {
|
||||||
|
$notifier->sendNewFolderMail($subFolder, $user);
|
||||||
|
/*
|
||||||
$fnl = $folder->getNotifyList();
|
$fnl = $folder->getNotifyList();
|
||||||
$snl = $subFolder->getNotifyList();
|
$snl = $subFolder->getNotifyList();
|
||||||
$nl = array(
|
$nl = array(
|
||||||
|
@ -143,6 +145,7 @@ if(!$subFolder = $controller->run()) {
|
||||||
foreach ($nl["groups"] as $grp) {
|
foreach ($nl["groups"] as $grp) {
|
||||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
151
op/op.Ajax.php
151
op/op.Ajax.php
|
@ -69,7 +69,7 @@ if (isset($_COOKIE["mydms_session"])) {
|
||||||
$dms->noReadForStatus = $role->getNoAccess();
|
$dms->noReadForStatus = $role->getNoAccess();
|
||||||
|
|
||||||
global $logger;
|
global $logger;
|
||||||
$notifier = new SeedDMS_NotificationService($logger);
|
$notifier = new SeedDMS_NotificationService($logger, $settings);
|
||||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
|
||||||
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {
|
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {
|
||||||
if(method_exists($notificationObj, 'preAddService')) {
|
if(method_exists($notificationObj, 'preAddService')) {
|
||||||
|
@ -79,7 +79,7 @@ if (isset($_COOKIE["mydms_session"])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if($settings->_enableEmail) {
|
if($settings->_enableEmail) {
|
||||||
$notifier->addService(new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword));
|
$notifier->addService(new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword), 'email');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
|
||||||
|
@ -322,7 +322,11 @@ switch($command) {
|
||||||
if ($mfolder->getAccessMode($user, 'moveFolder') >= M_READWRITE) {
|
if ($mfolder->getAccessMode($user, 'moveFolder') >= M_READWRITE) {
|
||||||
if($folder = $dms->getFolder($_REQUEST['targetfolderid'])) {
|
if($folder = $dms->getFolder($_REQUEST['targetfolderid'])) {
|
||||||
if($folder->getAccessMode($user, 'moveFolder') >= M_READWRITE) {
|
if($folder->getAccessMode($user, 'moveFolder') >= M_READWRITE) {
|
||||||
|
$oldFolder = $mfolder->getParent();
|
||||||
if($mfolder->setParent($folder)) {
|
if($mfolder->setParent($folder)) {
|
||||||
|
if($notifier) {
|
||||||
|
$notifier->sendMovedFolderMail($mfolder, $user, $oldFolder);
|
||||||
|
}
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_move_folder'), 'data'=>''));
|
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_move_folder'), 'data'=>''));
|
||||||
add_log_line();
|
add_log_line();
|
||||||
|
@ -361,10 +365,14 @@ switch($command) {
|
||||||
if ($mdocument->getAccessMode($user, 'moveDocument') >= M_READWRITE) {
|
if ($mdocument->getAccessMode($user, 'moveDocument') >= M_READWRITE) {
|
||||||
if($folder = $dms->getFolder($_REQUEST['targetfolderid'])) {
|
if($folder = $dms->getFolder($_REQUEST['targetfolderid'])) {
|
||||||
if($folder->getAccessMode($user, 'moveDocument') >= M_READWRITE) {
|
if($folder->getAccessMode($user, 'moveDocument') >= M_READWRITE) {
|
||||||
|
$oldFolder = $mdocument->getFolder();
|
||||||
if($mdocument->setFolder($folder)) {
|
if($mdocument->setFolder($folder)) {
|
||||||
if(isset($_REQUEST['sequence'])) {
|
if(isset($_REQUEST['sequence'])) {
|
||||||
$mdocument->setSequence((float) $_REQUEST['sequence']);
|
$mdocument->setSequence((float) $_REQUEST['sequence']);
|
||||||
}
|
}
|
||||||
|
if($notifier) {
|
||||||
|
$notifier->sendMovedDocumentMail($mdocument, $user, $oldFolder);
|
||||||
|
}
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_move_document'), 'data'=>''));
|
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_move_document'), 'data'=>''));
|
||||||
add_log_line();
|
add_log_line();
|
||||||
|
@ -511,19 +519,7 @@ switch($command) {
|
||||||
|
|
||||||
if($folder->remove()) {
|
if($folder->remove()) {
|
||||||
if ($notifier) {
|
if ($notifier) {
|
||||||
$subject = "folder_deleted_email_subject";
|
$notifier->sendDeleteFolderMail($folder, $user);
|
||||||
$message = "folder_deleted_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $foldername;
|
|
||||||
$params['folder_path'] = $parent->getFolderPathPlain();
|
|
||||||
$params['username'] = $user->getFullName();
|
|
||||||
$params['sitename'] = $settings->_siteName;
|
|
||||||
$params['http_root'] = $settings->_httpRoot;
|
|
||||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$parent->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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>''));
|
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>''));
|
||||||
|
@ -557,10 +553,6 @@ switch($command) {
|
||||||
/* Get the notify list before removing the document */
|
/* Get the notify list before removing the document */
|
||||||
$dnl = $document->getNotifyList();
|
$dnl = $document->getNotifyList();
|
||||||
$fnl = $folder->getNotifyList();
|
$fnl = $folder->getNotifyList();
|
||||||
$nl = array(
|
|
||||||
'users'=>array_unique(array_merge($dnl['users'], $fnl['users']), SORT_REGULAR),
|
|
||||||
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
|
|
||||||
);
|
|
||||||
$docname = $document->getName();
|
$docname = $document->getName();
|
||||||
|
|
||||||
$controller = Controller::factory('RemoveDocument', array('dms'=>$dms, 'user'=>$user));
|
$controller = Controller::factory('RemoveDocument', array('dms'=>$dms, 'user'=>$user));
|
||||||
|
@ -568,18 +560,10 @@ switch($command) {
|
||||||
$controller->setParam('fulltextservice', $fulltextservice);
|
$controller->setParam('fulltextservice', $fulltextservice);
|
||||||
if($controller->run()) {
|
if($controller->run()) {
|
||||||
if ($notifier){
|
if ($notifier){
|
||||||
$subject = "document_deleted_email_subject";
|
/* $document still has the data from the just deleted document,
|
||||||
$message = "document_deleted_email_body";
|
* which is just enough to send the email.
|
||||||
$params = array();
|
*/
|
||||||
$params['name'] = $docname;
|
$notifier->sendDeleteDocumentMail($document, $user);
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
@ -646,10 +630,14 @@ switch($command) {
|
||||||
$document = $dms->getDocument($_REQUEST['id']);
|
$document = $dms->getDocument($_REQUEST['id']);
|
||||||
if($document) {
|
if($document) {
|
||||||
if ($document->getAccessMode($user) >= M_READWRITE) {
|
if ($document->getAccessMode($user) >= M_READWRITE) {
|
||||||
|
$oldname = $document->getName();
|
||||||
if (!$document->setName($_REQUEST['name'])) {
|
if (!$document->setName($_REQUEST['name'])) {
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>false, 'message'=>'Error setting name', 'data'=>''));
|
echo json_encode(array('success'=>false, 'message'=>'Error setting name', 'data'=>''));
|
||||||
} else {
|
} else {
|
||||||
|
if($notifier) {
|
||||||
|
$notifier->sendChangedNameMail($document, $user, $oldname);
|
||||||
|
}
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_name_changed'), 'data'=>''));
|
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_name_changed'), 'data'=>''));
|
||||||
add_log_line();
|
add_log_line();
|
||||||
|
@ -831,106 +819,7 @@ switch($command) {
|
||||||
} else {
|
} else {
|
||||||
// Send notification to subscribers of folder.
|
// Send notification to subscribers of folder.
|
||||||
if($notifier) {
|
if($notifier) {
|
||||||
$fnl = $folder->getNotifyList();
|
$notifier->sendNewDocumentMail($document, $user);
|
||||||
$dnl = $document->getNotifyList();
|
|
||||||
$nl = array(
|
|
||||||
'users'=>array_unique(array_merge($dnl['users'], $fnl['users']), SORT_REGULAR),
|
|
||||||
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
|
|
||||||
);
|
|
||||||
|
|
||||||
$subject = "new_document_email_subject";
|
|
||||||
$message = "new_document_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $name;
|
|
||||||
$params['folder_name'] = $folder->getName();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$params['username'] = $user->getFullName();
|
|
||||||
$params['comment'] = '';
|
|
||||||
$params['version_comment'] = '';
|
|
||||||
$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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get workflow from controller in case it was modified in a hook */
|
|
||||||
$workflow = $controller->getParam('workflow');
|
|
||||||
if($workflow && $settings->_enableNotificationWorkflow) {
|
|
||||||
$subject = "request_workflow_action_email_subject";
|
|
||||||
$message = "request_workflow_action_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['version'] = 1;
|
|
||||||
$params['workflow'] = $workflow->getName();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$params['current_state'] = $workflow->getInitState()->getName();
|
|
||||||
$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();
|
|
||||||
|
|
||||||
foreach($workflow->getNextTransitions($workflow->getInitState()) as $ntransition) {
|
|
||||||
foreach($ntransition->getUsers() as $tuser) {
|
|
||||||
$notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW);
|
|
||||||
}
|
|
||||||
foreach($ntransition->getGroups() as $tuser) {
|
|
||||||
$notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($settings->_enableNotificationAppRev) {
|
|
||||||
/* Reviewers and approvers will be informed about the new document */
|
|
||||||
/* Get reviewers and approvers from controller in case it was
|
|
||||||
* modified in a hook
|
|
||||||
*/
|
|
||||||
$reviewers = $controller->getParam('reviewers');
|
|
||||||
$approvers = $controller->getParam('approvers');
|
|
||||||
if($reviewers['i'] || $reviewers['g']) {
|
|
||||||
$subject = "review_request_email_subject";
|
|
||||||
$message = "review_request_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$params['version'] = 1;
|
|
||||||
$params['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;
|
|
||||||
|
|
||||||
foreach($reviewers['i'] as $reviewerid) {
|
|
||||||
$notifier->toIndividual($user, $dms->getUser($reviewerid), $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER);
|
|
||||||
}
|
|
||||||
foreach($reviewers['g'] as $reviewergrpid) {
|
|
||||||
$notifier->toGroup($user, $dms->getGroup($reviewergrpid), $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
elseif($approvers['i'] || $approvers['g']) {
|
|
||||||
$subject = "approval_request_email_subject";
|
|
||||||
$message = "approval_request_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$params['version'] = 1;
|
|
||||||
$params['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;
|
|
||||||
|
|
||||||
foreach($approvers['i'] as $approverid) {
|
|
||||||
$notifier->toIndividual($user, $dms->getUser($approverid), $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER);
|
|
||||||
}
|
|
||||||
foreach($approvers['g'] as $approvergrpid) {
|
|
||||||
$notifier->toGroup($user, $dms->getGroup($approvergrpid), $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
|
@ -68,46 +68,7 @@ $comment = $_POST["comment"];
|
||||||
if (($oldcomment = $version->getComment()) != $comment) {
|
if (($oldcomment = $version->getComment()) != $comment) {
|
||||||
if($version->setComment($comment)) {
|
if($version->setComment($comment)) {
|
||||||
if($notifier) {
|
if($notifier) {
|
||||||
$notifyList = $document->getNotifyList();
|
$notifier->sendChangedVersionCommentMail($version, $user, $oldcomment);
|
||||||
$folder = $document->getFolder();
|
|
||||||
|
|
||||||
/*
|
|
||||||
$subject = "###SITENAME###: ".$document->getName().", v.".$version->getVersion()." - ".getMLText("document_comment_changed_email");
|
|
||||||
$message = getMLText("document_comment_changed_email")."\r\n";
|
|
||||||
$message .=
|
|
||||||
getMLText("document").": ".$document->getName()."\r\n".
|
|
||||||
getMLText("version").": ".$version->getVersion()."\r\n".
|
|
||||||
getMLText("comment").": ".$comment."\r\n".
|
|
||||||
getMLText("user").": ".$user->getFullName()." <". $user->getEmail() .">\r\n".
|
|
||||||
"URL: ###URL_PREFIX###out/out.ViewDocument.php?documentid=".$document->getID()."&version=".$version->getVersion()."\r\n";
|
|
||||||
|
|
||||||
if(isset($document->_notifyList["users"])) {
|
|
||||||
$notifier->toList($user, $document->_notifyList["users"], $subject, $message);
|
|
||||||
}
|
|
||||||
if(isset($document->_notifyList["groups"])) {
|
|
||||||
foreach ($document->_notifyList["groups"] as $grp) {
|
|
||||||
$notifier->toGroup($user, $grp, $subject, $message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$subject = "document_comment_changed_email_subject";
|
|
||||||
$message = "document_comment_changed_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['version'] = $version->getVersion();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$params['username'] = $user->getFullName();
|
|
||||||
$params['new_comment'] = $comment;
|
|
||||||
$params['old_comment'] = $oldcomment;
|
|
||||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID()."&version=".$version->getVersion();
|
|
||||||
$params['sitename'] = $settings->_siteName;
|
|
||||||
$params['http_root'] = $settings->_httpRoot;
|
|
||||||
$notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
foreach ($notifyList["groups"] as $grp) {
|
|
||||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -148,146 +148,14 @@ if(!$controller->run()) {
|
||||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg);
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($oldname != $name) {
|
if($notifier) {
|
||||||
// Send notification to subscribers.
|
$notifier->sendChangedNameMail($document, $user, $oldname);
|
||||||
if($notifier) {
|
|
||||||
$notifyList = $document->getNotifyList();
|
|
||||||
$folder = $document->getFolder();
|
|
||||||
$subject = "document_renamed_email_subject";
|
|
||||||
$message = "document_renamed_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['old_name'] = $oldname;
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$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;
|
|
||||||
|
|
||||||
// if user is not owner send notification to owner
|
$notifier->sendChangedCommentMail($document, $user, $oldcomment);
|
||||||
if ($user->getID() != $document->getOwner()->getID() &&
|
|
||||||
false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) {
|
|
||||||
$notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
|
||||||
}
|
|
||||||
$notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
foreach ($notifyList["groups"] as $grp) {
|
|
||||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($oldcomment != $comment) {
|
$notifier->sendChangedExpiryMail($document, $user, $oldexpires);
|
||||||
// Send notification to subscribers.
|
|
||||||
if($notifier) {
|
|
||||||
$notifyList = $document->getNotifyList();
|
|
||||||
$folder = $document->getFolder();
|
|
||||||
$subject = "document_comment_changed_email_subject";
|
|
||||||
$message = "document_comment_changed_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$params['old_comment'] = $oldcomment;
|
|
||||||
$params['new_comment'] = $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;
|
|
||||||
|
|
||||||
// if user is not owner send notification to owner
|
$notifier->sendChangedAttributesMail($document, $user, $oldattributes);
|
||||||
if ($user->getID() != $document->getOwner()->getID() &&
|
|
||||||
false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) {
|
|
||||||
$notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
|
||||||
}
|
|
||||||
$notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
foreach ($notifyList["groups"] as $grp) {
|
|
||||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($expires != $oldexpires) {
|
|
||||||
if($notifier) {
|
|
||||||
$notifyList = $document->getNotifyList();
|
|
||||||
$folder = $document->getFolder();
|
|
||||||
// Send notification to subscribers.
|
|
||||||
$subject = "expiry_changed_email_subject";
|
|
||||||
$message = "expiry_changed_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$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;
|
|
||||||
|
|
||||||
// if user is not owner send notification to owner
|
|
||||||
if ($user->getID() != $document->getOwner()->getID() &&
|
|
||||||
false === SeedDMS_Core_DMS::inList($document->getOwner(), $notifyList['users'])) {
|
|
||||||
$notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
|
||||||
}
|
|
||||||
$notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
foreach ($notifyList["groups"] as $grp) {
|
|
||||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($oldkeywords != $keywords) {
|
|
||||||
}
|
|
||||||
|
|
||||||
$newattributes = $document->getAttributes();
|
|
||||||
if($oldattributes) {
|
|
||||||
foreach($oldattributes as $attrdefid=>$attribute) {
|
|
||||||
if(!isset($newattributes[$attrdefid]) || $newattributes[$attrdefid]->getValueAsArray() !== $oldattributes[$attrdefid]->getValueAsArray()) {
|
|
||||||
if($notifier) {
|
|
||||||
$notifyList = $document->getNotifyList();
|
|
||||||
$subject = "document_attribute_changed_email_subject";
|
|
||||||
$message = "document_attribute_changed_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['attribute_name'] = $attribute->getAttributeDefinition()->getName();
|
|
||||||
$params['attribute_old_value'] = $oldattributes[$attrdefid]->getValue();
|
|
||||||
$params['attribute_new_value'] = isset($newattributes[$attrdefid]) ? $newattributes[$attrdefid]->getValue() : '';
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$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, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
foreach ($notifyList["groups"] as $grp) {
|
|
||||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Check for new attributes which didn't have a value before */
|
|
||||||
if($newattributes) {
|
|
||||||
foreach($newattributes as $attrdefid=>$attribute) {
|
|
||||||
if(!isset($oldattributes[$attrdefid]) && $attribute) {
|
|
||||||
if($notifier) {
|
|
||||||
$notifyList = $document->getNotifyList();
|
|
||||||
$subject = "document_attribute_changed_email_subject";
|
|
||||||
$message = "document_attribute_changed_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['attribute_name'] = $dms->getAttributeDefinition($attrdefid)->getName();
|
|
||||||
$params['attribute_old_value'] = '';
|
|
||||||
$params['attribute_new_value'] = $attribute->getValue();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$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, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
foreach ($notifyList["groups"] as $grp) {
|
|
||||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_document_edited')));
|
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_document_edited')));
|
||||||
|
|
|
@ -56,30 +56,7 @@ foreach($clipboard['docs'] as $documentid) {
|
||||||
if ($document->setFolder($targetFolder)) {
|
if ($document->setFolder($targetFolder)) {
|
||||||
// Send notification to subscribers.
|
// Send notification to subscribers.
|
||||||
if($notifier) {
|
if($notifier) {
|
||||||
$nl1 = $oldFolder->getNotifyList();
|
$notifier->sendMovedDocumentMail($document, $user, $oldFolder);
|
||||||
$nl2 = $document->getNotifyList();
|
|
||||||
$nl3 = $targetFolder->getNotifyList();
|
|
||||||
$nl = array(
|
|
||||||
'users'=>array_unique(array_merge($nl1['users'], $nl2['users'], $nl3['users']), SORT_REGULAR),
|
|
||||||
'groups'=>array_unique(array_merge($nl1['groups'], $nl2['groups'], $nl3['groups']), SORT_REGULAR)
|
|
||||||
);
|
|
||||||
$subject = "document_moved_email_subject";
|
|
||||||
$message = "document_moved_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['old_folder_path'] = $oldFolder->getFolderPathPlain();
|
|
||||||
$params['new_folder_path'] = $targetFolder->getFolderPathPlain();
|
|
||||||
$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 user is not owner send notification to owner
|
|
||||||
// if ($user->getID() != $document->getOwner()->getID())
|
|
||||||
// $notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
|
||||||
}
|
}
|
||||||
$session->removeFromClipboard($document);
|
$session->removeFromClipboard($document);
|
||||||
|
|
||||||
|
@ -103,31 +80,7 @@ foreach($clipboard['folders'] as $folderid) {
|
||||||
if ($folder->setParent($targetFolder)) {
|
if ($folder->setParent($targetFolder)) {
|
||||||
// Send notification to subscribers.
|
// Send notification to subscribers.
|
||||||
if($notifier) {
|
if($notifier) {
|
||||||
$nl1 = $oldFolder->getNotifyList();
|
$notifier->sendMovedFolderMail($folder, $user, $oldFolder);
|
||||||
$nl2 = $folder->getNotifyList();
|
|
||||||
$nl3 = $targetFolder->getNotifyList();
|
|
||||||
$nl = array(
|
|
||||||
'users'=>array_unique(array_merge($nl1['users'], $nl2['users'], $nl3['users']), SORT_REGULAR),
|
|
||||||
'groups'=>array_unique(array_merge($nl1['groups'], $nl2['groups'], $nl3['groups']), SORT_REGULAR)
|
|
||||||
);
|
|
||||||
$subject = "folder_moved_email_subject";
|
|
||||||
$message = "folder_moved_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $folder->getName();
|
|
||||||
$params['old_folder_path'] = $oldFolder->getFolderPathPlain();
|
|
||||||
$params['new_folder_path'] = $targetFolder->getFolderPathPlain();
|
|
||||||
$params['username'] = $user->getFullName();
|
|
||||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->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 user is not owner send notification to owner
|
|
||||||
// if ($user->getID() != $folder->getOwner()->getID())
|
|
||||||
// $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
$session->removeFromClipboard($folder);
|
$session->removeFromClipboard($folder);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -82,30 +82,7 @@ if(!$settings->_enableDuplicateDocNames) {
|
||||||
if ($document->setFolder($targetFolder)) {
|
if ($document->setFolder($targetFolder)) {
|
||||||
// Send notification to subscribers.
|
// Send notification to subscribers.
|
||||||
if($notifier) {
|
if($notifier) {
|
||||||
$nl1 = $oldFolder->getNotifyList();
|
$notifier->sendMovedDocumentMail($document, $user, $oldFolder);
|
||||||
$nl2 = $document->getNotifyList();
|
|
||||||
$nl3 = $targetFolder->getNotifyList();
|
|
||||||
$nl = array(
|
|
||||||
'users'=>array_unique(array_merge($nl1['users'], $nl2['users'], $nl3['users']), SORT_REGULAR),
|
|
||||||
'groups'=>array_unique(array_merge($nl1['groups'], $nl2['groups'], $nl3['groups']), SORT_REGULAR)
|
|
||||||
);
|
|
||||||
$subject = "document_moved_email_subject";
|
|
||||||
$message = "document_moved_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['old_folder_path'] = $oldFolder->getFolderPathPlain();
|
|
||||||
$params['new_folder_path'] = $targetFolder->getFolderPathPlain();
|
|
||||||
$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 user is not owner send notification to owner
|
|
||||||
// if ($user->getID() != $document->getOwner()->getID())
|
|
||||||
// $notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -81,31 +81,7 @@ if(!$settings->_enableDuplicateSubFolderNames) {
|
||||||
if ($folder->setParent($targetFolder)) {
|
if ($folder->setParent($targetFolder)) {
|
||||||
// Send notification to subscribers.
|
// Send notification to subscribers.
|
||||||
if($notifier) {
|
if($notifier) {
|
||||||
$nl1 = $oldFolder->getNotifyList();
|
$notifier->sendMovedFolderMail($folder, $user, $oldFolder);
|
||||||
$nl2 = $folder->getNotifyList();
|
|
||||||
$nl3 = $targetFolder->getNotifyList();
|
|
||||||
$nl = array(
|
|
||||||
'users'=>array_unique(array_merge($nl1['users'], $nl2['users'], $nl3['users']), SORT_REGULAR),
|
|
||||||
'groups'=>array_unique(array_merge($nl1['groups'], $nl2['groups'], $nl3['groups']), SORT_REGULAR)
|
|
||||||
);
|
|
||||||
$subject = "folder_moved_email_subject";
|
|
||||||
$message = "folder_moved_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $folder->getName();
|
|
||||||
$params['old_folder_path'] = $oldFolder->getFolderPathPlain();
|
|
||||||
$params['new_folder_path'] = $targetFolder->getFolderPathPlain();
|
|
||||||
$params['username'] = $user->getFullName();
|
|
||||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->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 user is not owner send notification to owner
|
|
||||||
//if ($user->getID() != $folder->getOwner()->getID())
|
|
||||||
// $notifier->toIndividual($user, $folder->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured"));
|
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured"));
|
||||||
|
|
|
@ -69,13 +69,11 @@ $previewer->deleteDocumentPreviews($document);
|
||||||
|
|
||||||
/* Get the notify list before removing the document
|
/* Get the notify list before removing the document
|
||||||
* Also inform the users/groups of the parent folder
|
* Also inform the users/groups of the parent folder
|
||||||
|
* Getting the list now will keep them in the document object
|
||||||
|
* even after the document has been deleted.
|
||||||
*/
|
*/
|
||||||
$dnl = $document->getNotifyList();
|
$dnl = $document->getNotifyList();
|
||||||
$fnl = $folder->getNotifyList();
|
$fnl = $folder->getNotifyList();
|
||||||
$nl = array(
|
|
||||||
'users'=>array_unique(array_merge($dnl['users'], $fnl['users']), SORT_REGULAR),
|
|
||||||
'groups'=>array_unique(array_merge($dnl['groups'], $fnl['groups']), SORT_REGULAR)
|
|
||||||
);
|
|
||||||
$docname = $document->getName();
|
$docname = $document->getName();
|
||||||
|
|
||||||
$controller->setParam('document', $document);
|
$controller->setParam('document', $document);
|
||||||
|
@ -89,19 +87,10 @@ if(!$controller->run()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($notifier){
|
if ($notifier){
|
||||||
$subject = "document_deleted_email_subject";
|
/* $document still has the data from the just deleted document,
|
||||||
$message = "document_deleted_email_body";
|
* which is just enough to send the email.
|
||||||
$params = array();
|
*/
|
||||||
$params['name'] = $docname;
|
$notifier->sendDeleteDocumentMail($document, $user);
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$params['username'] = $user->getFullName();
|
|
||||||
$params['sitename'] = $settings->_siteName;
|
|
||||||
$params['http_root'] = $settings->_httpRoot;
|
|
||||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_rm_document')));
|
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_rm_document')));
|
||||||
|
|
|
@ -85,6 +85,8 @@ if(!$controller->run()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($notifier) {
|
if ($notifier) {
|
||||||
|
$notifier->sendDeleteFolderMail($folder, $user);
|
||||||
|
/*
|
||||||
$subject = "folder_deleted_email_subject";
|
$subject = "folder_deleted_email_subject";
|
||||||
$message = "folder_deleted_email_body";
|
$message = "folder_deleted_email_body";
|
||||||
$params = array();
|
$params = array();
|
||||||
|
@ -98,6 +100,7 @@ if ($notifier) {
|
||||||
foreach ($nl["groups"] as $grp) {
|
foreach ($nl["groups"] as $grp) {
|
||||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
add_log_line("?folderid=".$folderid."&name=".$foldername);
|
add_log_line("?folderid=".$folderid."&name=".$foldername);
|
||||||
|
|
|
@ -110,19 +110,19 @@ else {
|
||||||
$emailGroupListA = array();
|
$emailGroupListA = array();
|
||||||
$status = $version->getReviewStatus();
|
$status = $version->getReviewStatus();
|
||||||
foreach ($status as $st) {
|
foreach ($status as $st) {
|
||||||
if ($st["status"]==0 && !in_array($st["required"], $emailUserList)) {
|
if ($st["status"]==0) {
|
||||||
if($st['type'] == 0)
|
if($st['type'] == 0 && !in_array($st["required"], $emailUserListR))
|
||||||
$emailUserListR[] = $st["required"];
|
$emailUserListR[] = $st["required"];
|
||||||
else
|
elseif(!in_array($st["required"], $emailGroupListR))
|
||||||
$emailGroupListR[] = $st["required"];
|
$emailGroupListR[] = $st["required"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$status = $version->getApprovalStatus();
|
$status = $version->getApprovalStatus();
|
||||||
foreach ($status as $st) {
|
foreach ($status as $st) {
|
||||||
if ($st["status"]==0 && !in_array($st["required"], $emailUserList)) {
|
if ($st["status"]==0) {
|
||||||
if($st['type'] == 0)
|
if($st['type'] == 0 && !in_array($st["required"], $emailUserListA))
|
||||||
$emailUserListA[] = $st["required"];
|
$emailUserListA[] = $st["required"];
|
||||||
else
|
elseif(!in_array($st["required"], $emailGroupListA))
|
||||||
$emailGroupListA[] = $st["required"];
|
$emailGroupListA[] = $st["required"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,32 +72,7 @@ if (!$version->setWorkflow($workflow, $user)){
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($notifier) {
|
if ($notifier) {
|
||||||
$nl = $document->getNotifyList();
|
$notifier->sendRequestWorkflowActionMail($version, $user);
|
||||||
$folder = $document->getFolder();
|
|
||||||
|
|
||||||
if($settings->_enableNotificationWorkflow) {
|
|
||||||
$subject = "request_workflow_action_email_subject";
|
|
||||||
$message = "request_workflow_action_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['version'] = $version->getVersion();
|
|
||||||
$params['workflow'] = $workflow->getName();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$params['current_state'] = $workflow->getInitState()->getName();
|
|
||||||
$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();
|
|
||||||
|
|
||||||
foreach($workflow->getNextTransitions($workflow->getInitState()) as $ntransition) {
|
|
||||||
foreach($ntransition->getUsers() as $tuser) {
|
|
||||||
$notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW);
|
|
||||||
}
|
|
||||||
foreach($ntransition->getGroups() as $tuser) {
|
|
||||||
$notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_log_line("?documentid=".$documentid);
|
add_log_line("?documentid=".$documentid);
|
||||||
|
|
|
@ -341,121 +341,10 @@ default:
|
||||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText($controller->getErrorMsg()));
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText($controller->getErrorMsg()));
|
||||||
} else {
|
} else {
|
||||||
// Send notification to subscribers.
|
// Send notification to subscribers.
|
||||||
if ($notifier){
|
if($notifier) {
|
||||||
$notifyList = $document->getNotifyList();
|
$notifier->sendNewDocumentVersionMail($document, $user);
|
||||||
$folder = $document->getFolder();
|
|
||||||
|
|
||||||
$subject = "document_updated_email_subject";
|
$notifier->sendChangedExpiryMail($document, $user, $oldexpires);
|
||||||
$message = "document_updated_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$params['username'] = $user->getFullName();
|
|
||||||
$params['comment'] = $document->getComment();
|
|
||||||
$params['version_comment'] = $content->getComment();
|
|
||||||
$params['url'] = getBaseUrl().$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
|
|
||||||
$params['sitename'] = $settings->_siteName;
|
|
||||||
$params['http_root'] = $settings->_httpRoot;
|
|
||||||
$notifier->toList($user, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
foreach ($notifyList["groups"] as $grp) {
|
|
||||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
}
|
|
||||||
// if user is not owner send notification to owner
|
|
||||||
// if ($user->getID() != $document->getOwner()->getID())
|
|
||||||
// $notifier->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
|
|
||||||
|
|
||||||
/* Get workflow from controller in case it was modified in a hook */
|
|
||||||
$workflow = $controller->getParam('workflow');
|
|
||||||
if($workflow && $settings->_enableNotificationWorkflow) {
|
|
||||||
$subject = "request_workflow_action_email_subject";
|
|
||||||
$message = "request_workflow_action_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['version'] = $content->getVersion();
|
|
||||||
$params['workflow'] = $workflow->getName();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$params['current_state'] = $workflow->getInitState()->getName();
|
|
||||||
$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();
|
|
||||||
|
|
||||||
foreach($workflow->getNextTransitions($workflow->getInitState()) as $ntransition) {
|
|
||||||
foreach($ntransition->getUsers() as $tuser) {
|
|
||||||
$notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW);
|
|
||||||
}
|
|
||||||
foreach($ntransition->getGroups() as $tuser) {
|
|
||||||
$notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($settings->_enableNotificationAppRev) {
|
|
||||||
/* Reviewers and approvers will be informed about the new document */
|
|
||||||
/* Get reviewers and approvers from controller in case it was
|
|
||||||
* modified in a hook
|
|
||||||
*/
|
|
||||||
$reviewers = $controller->getParam('reviewers');
|
|
||||||
$approvers = $controller->getParam('approvers');
|
|
||||||
if($reviewers['i'] || $reviewers['g']) {
|
|
||||||
$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'] = $content->getComment();
|
|
||||||
$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;
|
|
||||||
|
|
||||||
foreach($reviewers['i'] as $reviewerid) {
|
|
||||||
$notifier->toIndividual($user, $dms->getUser($reviewerid), $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER);
|
|
||||||
}
|
|
||||||
foreach($reviewers['g'] as $reviewergrpid) {
|
|
||||||
$notifier->toGroup($user, $dms->getGroup($reviewergrpid), $subject, $message, $params, SeedDMS_NotificationService::RECV_REVIEWER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
elseif($approvers['i'] || $approvers['g']) {
|
|
||||||
$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'] = $content->getComment();
|
|
||||||
$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;
|
|
||||||
|
|
||||||
foreach($approvers['i'] as $approverid) {
|
|
||||||
$notifier->toIndividual($user, $dms->getUser($approverid), $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER);
|
|
||||||
}
|
|
||||||
foreach($approvers['g'] as $approvergrpid) {
|
|
||||||
$notifier->toGroup($user, $dms->getGroup($approvergrpid), $subject, $message, $params, SeedDMS_NotificationService::RECV_APPROVER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($oldexpires != $document->getExpires()) {
|
|
||||||
// Send notification to subscribers.
|
|
||||||
$subject = "expiry_changed_email_subject";
|
|
||||||
$message = "expiry_changed_email_body";
|
|
||||||
$params = array();
|
|
||||||
$params['name'] = $document->getName();
|
|
||||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
|
||||||
$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, $notifyList["users"], $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
foreach ($notifyList["groups"] as $grp) {
|
|
||||||
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($settings->_removeFromDropFolder) {
|
if($settings->_removeFromDropFolder) {
|
||||||
|
|
|
@ -2870,8 +2870,12 @@ $(document).ready( function() {
|
||||||
?>
|
?>
|
||||||
/* catch click on a document row in the list folders and documents */
|
/* catch click on a document row in the list folders and documents */
|
||||||
$('body').on('click', '[id^=\"table-row-document\"] td:nth-child(2)', function(ev) {
|
$('body').on('click', '[id^=\"table-row-document\"] td:nth-child(2)', function(ev) {
|
||||||
attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3];
|
if(ev.shiftKey) {
|
||||||
window.location = '../out/out.ViewDocument.php?documentid=' + attr_id;
|
$(ev.currentTarget).parent().toggleClass('selected');
|
||||||
|
} else {
|
||||||
|
attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3];
|
||||||
|
window.location = '../out/out.ViewDocument.php?documentid=' + attr_id;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -2891,10 +2895,14 @@ $('body').on('click', '[id^=\"table-row-document\"] td:nth-child(2)', function(e
|
||||||
?>
|
?>
|
||||||
/* catch click on a document row in the list folders and documents */
|
/* catch click on a document row in the list folders and documents */
|
||||||
$('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) {
|
$('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) {
|
||||||
attr_id = $(ev.currentTarget).parent().data('target-id');
|
if(ev.shiftKey) {
|
||||||
if(typeof attr_id == 'undefined')
|
$(ev.currentTarget).parent().toggleClass('selected');
|
||||||
attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3];
|
} else {
|
||||||
window.location = '../out/out.ViewFolder.php?folderid=' + attr_id;
|
attr_id = $(ev.currentTarget).parent().data('target-id');
|
||||||
|
if(typeof attr_id == 'undefined')
|
||||||
|
attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3];
|
||||||
|
window.location = '../out/out.ViewFolder.php?folderid=' + attr_id;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,13 +194,17 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
|
||||||
* the table row when deleting the folder
|
* the table row when deleting the folder
|
||||||
* This was added for the internal_link extensіon
|
* This was added for the internal_link extensіon
|
||||||
*/
|
*/
|
||||||
attr_id = $(ev.currentTarget).parent().data('target-id');
|
if(ev.shiftKey) {
|
||||||
if(typeof attr_id == 'undefined')
|
$(ev.currentTarget).parent().toggleClass('selected');
|
||||||
attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3];
|
} else {
|
||||||
folderSelectedmaintree(attr_id, '');
|
attr_id = $(ev.currentTarget).parent().data('target-id');
|
||||||
$([document.documentElement, document.body]).animate({
|
if(typeof attr_id == 'undefined')
|
||||||
scrollTop: 200
|
attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3];
|
||||||
}, 200);
|
folderSelectedmaintree(attr_id, '');
|
||||||
|
$([document.documentElement, document.body]).animate({
|
||||||
|
scrollTop: 200
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
<?php
|
<?php
|
||||||
$this->printClickDocumentJs();
|
$this->printClickDocumentJs();
|
||||||
|
|
|
@ -2841,8 +2841,12 @@ $(document).ready( function() {
|
||||||
?>
|
?>
|
||||||
/* catch click on a document row in the list folders and documents */
|
/* catch click on a document row in the list folders and documents */
|
||||||
$('body').on('click', '[id^=\"table-row-document\"] td:nth-child(2)', function(ev) {
|
$('body').on('click', '[id^=\"table-row-document\"] td:nth-child(2)', function(ev) {
|
||||||
attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3];
|
if(ev.shiftKey) {
|
||||||
window.location = '../out/out.ViewDocument.php?documentid=' + attr_id;
|
$(ev.currentTarget).parent().toggleClass('selected');
|
||||||
|
} else {
|
||||||
|
attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3];
|
||||||
|
window.location = '../out/out.ViewDocument.php?documentid=' + attr_id;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -2862,10 +2866,14 @@ $('body').on('click', '[id^=\"table-row-document\"] td:nth-child(2)', function(e
|
||||||
?>
|
?>
|
||||||
/* catch click on a document row in the list folders and documents */
|
/* catch click on a document row in the list folders and documents */
|
||||||
$('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) {
|
$('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) {
|
||||||
attr_id = $(ev.currentTarget).parent().data('target-id');
|
if(ev.shiftKey) {
|
||||||
if(typeof attr_id == 'undefined')
|
$(ev.currentTarget).parent().toggleClass('selected');
|
||||||
attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3];
|
} else {
|
||||||
window.location = '../out/out.ViewFolder.php?folderid=' + attr_id;
|
attr_id = $(ev.currentTarget).parent().data('target-id');
|
||||||
|
if(typeof attr_id == 'undefined')
|
||||||
|
attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3];
|
||||||
|
window.location = '../out/out.ViewFolder.php?folderid=' + attr_id;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -2901,10 +2909,12 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
|
||||||
* {@link SeedDMS_Bootstrap_Style::folderListRowStart()}
|
* {@link SeedDMS_Bootstrap_Style::folderListRowStart()}
|
||||||
*/
|
*/
|
||||||
function documentListRowStart($document, $class='') { /* {{{ */
|
function documentListRowStart($document, $class='') { /* {{{ */
|
||||||
if($class == 'error')
|
if($class) {
|
||||||
$class = 'table-danger';
|
if($class == 'error')
|
||||||
else
|
$class = 'table-danger';
|
||||||
$class = 'table-'.$class;
|
else
|
||||||
|
$class = 'table-'.$class;
|
||||||
|
}
|
||||||
$docID = $document->getID();
|
$docID = $document->getID();
|
||||||
return "<tr id=\"table-row-document-".$docID."\" data-target-id=\"".$docID."\" class=\"table-row-document droptarget ".($class ? ' '.$class : '')."\" data-droptarget=\"document_".$docID."\" rel=\"document_".$docID."\" formtoken=\"".createFormKey('')."\" draggable=\"true\" data-name=\"".htmlspecialchars($document->getName(), ENT_QUOTES)."\">";
|
return "<tr id=\"table-row-document-".$docID."\" data-target-id=\"".$docID."\" class=\"table-row-document droptarget ".($class ? ' '.$class : '')."\" data-droptarget=\"document_".$docID."\" rel=\"document_".$docID."\" formtoken=\"".createFormKey('')."\" draggable=\"true\" data-name=\"".htmlspecialchars($document->getName(), ENT_QUOTES)."\">";
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
|
@ -28,7 +28,7 @@ require_once("../inc/inc.ClassEmailNotify.php");
|
||||||
require_once("../inc/inc.Notification.php");
|
require_once("../inc/inc.Notification.php");
|
||||||
require_once("../inc/inc.ClassController.php");
|
require_once("../inc/inc.ClassController.php");
|
||||||
|
|
||||||
$notifier = new SeedDMS_NotificationService($logger);
|
$notifier = new SeedDMS_NotificationService($logger, $settings);
|
||||||
|
|
||||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
|
||||||
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {
|
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user