Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2021-05-17 06:59:44 +02:00
commit 447c035065
23 changed files with 702 additions and 743 deletions

View File

@ -3944,6 +3944,35 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
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
* 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 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
* The approval status is a list of approvals and its current status

View File

@ -1902,6 +1902,7 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
- SeedDMS_Core_DMS::getTimeline() uses status log instead of document content
- add methods SeedDMS_Core_DocumentContent::getReviewers() and SeedDMS_Core_DocumentContent::getApprovers()
</notes>
</release>
<release>

View File

@ -36,6 +36,11 @@ class SeedDMS_NotificationService {
*/
protected $logger;
/*
* Configuration
*/
protected $settings;
/*
* Possible types of receivers
*/
@ -48,28 +53,29 @@ class SeedDMS_NotificationService {
const RECV_REVISOR = 6;
const RECV_RECIPIENT = 7;
public function __construct($logger = null) {
public function __construct($logger = null, $settings = null) { /* {{{ */
$this->services = array();
$this->errors = array();
$this->logger = $logger;
}
$this->settings = $settings;
} /* }}} */
public function addService($service, $name='') {
public function addService($service, $name='') { /* {{{ */
if(!$name)
$name = md5(uniqid());
$this->services[$name] = $service;
$this->errors[$name] = true;
}
} /* }}} */
public function getServices() {
public function getServices() { /* {{{ */
return $this->services;
}
} /* }}} */
public function getErrors() {
public function getErrors() { /* {{{ */
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;
foreach($this->services as $name => $service) {
/* Set $to to email address of user or the string passed in $recipient
@ -98,26 +104,23 @@ class SeedDMS_NotificationService {
}
}
return $error;
}
} /* }}} */
/**
* 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;
foreach($this->services as $name => $service) {
$ret = true;
foreach ($groupRecipient->getUsers() as $recipient) {
$ret &= $this->toIndividual($sender, $recipient, $subject, $message, $params, $recvtype);
}
$this->errors[$name] = $ret;
if(!$ret) {
$error = false;
}
$ret = true;
foreach ($groupRecipient->getUsers() as $recipient) {
$ret &= $this->toIndividual($sender, $recipient, $subject, $message, $params, $recvtype);
}
if(!$ret) {
$error = false;
}
return $error;
}
} /* }}} */
/**
* Send a notification to a list of recipients
@ -132,20 +135,526 @@ class SeedDMS_NotificationService {
* @param int $recvtype type of receiver
* @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;
foreach($this->services as $name => $service) {
$ret = true;
foreach ($recipients as $recipient) {
$ret &= $this->toIndividual($sender, $recipient, $subject, $message, $params, $recvtype);
}
$this->errors[$name] = $ret;
if(!$ret) {
$error = false;
}
$ret = true;
foreach ($recipients as $recipient) {
$ret &= $this->toIndividual($sender, $recipient, $subject, $message, $params, $recvtype);
}
if(!$ret) {
$error = false;
}
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);
}
} /* }}} */
}

View File

@ -344,7 +344,7 @@ function getAttributeValidationError($error, $attrname='', $attrvalue='', $regex
case 10:
return array("attr_not_in_valueset", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 8:
case 9:
return array("attr_malformed_date", array('attrname'=>$attrname, 'value'=>$attrvalue));
break;
case 8:

View File

@ -13,7 +13,7 @@
*/
global $logger;
$notifier = new SeedDMS_NotificationService($logger);
$notifier = new SeedDMS_NotificationService($logger, $settings);
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {

View File

@ -455,105 +455,7 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
} else {
// Send notification to subscribers of folder.
if($notifier) {
$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)
);
$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);
}
}
}
$notifier->sendNewDocumentMail($document, $user);
}
if($settings->_removeFromDropFolder) {
if(file_exists($userfiletmp)) {

View File

@ -111,22 +111,7 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
} else {
// Send notification to subscribers.
if($notifier) {
$notifyList = $document->getNotifyList();
$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);
}
$notifier->sendNewFileMail($res, $user);
}
}
}
@ -135,5 +120,4 @@ add_log_line("?name=".$name."&documentid=".$documentid);
header("Location:../out/out.ViewDocument.php?documentid=".$documentid."&currenttab=attachments");
?>

View File

@ -121,6 +121,8 @@ if(!$subFolder = $controller->run()) {
} else {
// Send notification to subscribers.
if($notifier) {
$notifier->sendNewFolderMail($subFolder, $user);
/*
$fnl = $folder->getNotifyList();
$snl = $subFolder->getNotifyList();
$nl = array(
@ -143,6 +145,7 @@ if(!$subFolder = $controller->run()) {
foreach ($nl["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
*/
}
}

View File

@ -69,7 +69,7 @@ if (isset($_COOKIE["mydms_session"])) {
$dms->noReadForStatus = $role->getNoAccess();
global $logger;
$notifier = new SeedDMS_NotificationService($logger);
$notifier = new SeedDMS_NotificationService($logger, $settings);
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {
if(method_exists($notificationObj, 'preAddService')) {
@ -79,7 +79,7 @@ if (isset($_COOKIE["mydms_session"])) {
}
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'])) {
@ -322,7 +322,11 @@ switch($command) {
if ($mfolder->getAccessMode($user, 'moveFolder') >= M_READWRITE) {
if($folder = $dms->getFolder($_REQUEST['targetfolderid'])) {
if($folder->getAccessMode($user, 'moveFolder') >= M_READWRITE) {
$oldFolder = $mfolder->getParent();
if($mfolder->setParent($folder)) {
if($notifier) {
$notifier->sendMovedFolderMail($mfolder, $user, $oldFolder);
}
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_move_folder'), 'data'=>''));
add_log_line();
@ -361,10 +365,14 @@ switch($command) {
if ($mdocument->getAccessMode($user, 'moveDocument') >= M_READWRITE) {
if($folder = $dms->getFolder($_REQUEST['targetfolderid'])) {
if($folder->getAccessMode($user, 'moveDocument') >= M_READWRITE) {
$oldFolder = $mdocument->getFolder();
if($mdocument->setFolder($folder)) {
if(isset($_REQUEST['sequence'])) {
$mdocument->setSequence((float) $_REQUEST['sequence']);
}
if($notifier) {
$notifier->sendMovedDocumentMail($mdocument, $user, $oldFolder);
}
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_move_document'), 'data'=>''));
add_log_line();
@ -511,19 +519,7 @@ switch($command) {
if($folder->remove()) {
if ($notifier) {
$subject = "folder_deleted_email_subject";
$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);
}
$notifier->sendDeleteFolderMail($folder, $user);
}
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>'', 'data'=>''));
@ -557,10 +553,6 @@ switch($command) {
/* Get the notify list before removing the document */
$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)
);
$docname = $document->getName();
$controller = Controller::factory('RemoveDocument', array('dms'=>$dms, 'user'=>$user));
@ -568,18 +560,10 @@ switch($command) {
$controller->setParam('fulltextservice', $fulltextservice);
if($controller->run()) {
if ($notifier){
$subject = "document_deleted_email_subject";
$message = "document_deleted_email_body";
$params = array();
$params['name'] = $docname;
$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);
}
/* $document still has the data from the just deleted document,
* which is just enough to send the email.
*/
$notifier->sendDeleteDocumentMail($document, $user);
}
header('Content-Type: application/json');
@ -646,10 +630,14 @@ switch($command) {
$document = $dms->getDocument($_REQUEST['id']);
if($document) {
if ($document->getAccessMode($user) >= M_READWRITE) {
$oldname = $document->getName();
if (!$document->setName($_REQUEST['name'])) {
header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>'Error setting name', 'data'=>''));
} else {
if($notifier) {
$notifier->sendChangedNameMail($document, $user, $oldname);
}
header('Content-Type: application/json');
echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_name_changed'), 'data'=>''));
add_log_line();
@ -831,106 +819,7 @@ switch($command) {
} else {
// Send notification to subscribers of folder.
if($notifier) {
$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)
);
$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);
}
}
}
$notifier->sendNewDocumentMail($document, $user);
}
}
header('Content-Type: application/json');

View File

@ -68,46 +68,7 @@ $comment = $_POST["comment"];
if (($oldcomment = $version->getComment()) != $comment) {
if($version->setComment($comment)) {
if($notifier) {
$notifyList = $document->getNotifyList();
$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);
}
$notifier->sendChangedVersionCommentMail($version, $user, $oldcomment);
}
}
else {

View File

@ -148,146 +148,14 @@ if(!$controller->run()) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg);
}
if ($oldname != $name) {
// Send notification to subscribers.
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($notifier) {
$notifier->sendChangedNameMail($document, $user, $oldname);
// 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);
}
}
}
$notifier->sendChangedCommentMail($document, $user, $oldcomment);
if ($oldcomment != $comment) {
// 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;
$notifier->sendChangedExpiryMail($document, $user, $oldexpires);
// 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 ($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);
}
}
}
}
$notifier->sendChangedAttributesMail($document, $user, $oldattributes);
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_document_edited')));

View File

@ -56,30 +56,7 @@ foreach($clipboard['docs'] as $documentid) {
if ($document->setFolder($targetFolder)) {
// Send notification to subscribers.
if($notifier) {
$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().$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);
$notifier->sendMovedDocumentMail($document, $user, $oldFolder);
}
$session->removeFromClipboard($document);
@ -103,31 +80,7 @@ foreach($clipboard['folders'] as $folderid) {
if ($folder->setParent($targetFolder)) {
// Send notification to subscribers.
if($notifier) {
$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().$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);
$notifier->sendMovedFolderMail($folder, $user, $oldFolder);
}
$session->removeFromClipboard($folder);
} else {

View File

@ -82,30 +82,7 @@ if(!$settings->_enableDuplicateDocNames) {
if ($document->setFolder($targetFolder)) {
// Send notification to subscribers.
if($notifier) {
$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().$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);
$notifier->sendMovedDocumentMail($document, $user, $oldFolder);
}
} else {

View File

@ -81,31 +81,7 @@ if(!$settings->_enableDuplicateSubFolderNames) {
if ($folder->setParent($targetFolder)) {
// Send notification to subscribers.
if($notifier) {
$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().$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);
$notifier->sendMovedFolderMail($folder, $user, $oldFolder);
}
} else {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured"));

View File

@ -69,13 +69,11 @@ $previewer->deleteDocumentPreviews($document);
/* Get the notify list before removing the document
* 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();
$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();
$controller->setParam('document', $document);
@ -89,19 +87,10 @@ if(!$controller->run()) {
}
if ($notifier){
$subject = "document_deleted_email_subject";
$message = "document_deleted_email_body";
$params = array();
$params['name'] = $docname;
$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);
}
/* $document still has the data from the just deleted document,
* which is just enough to send the email.
*/
$notifier->sendDeleteDocumentMail($document, $user);
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_rm_document')));

View File

@ -85,6 +85,8 @@ if(!$controller->run()) {
}
if ($notifier) {
$notifier->sendDeleteFolderMail($folder, $user);
/*
$subject = "folder_deleted_email_subject";
$message = "folder_deleted_email_body";
$params = array();
@ -98,6 +100,7 @@ if ($notifier) {
foreach ($nl["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
*/
}
add_log_line("?folderid=".$folderid."&name=".$foldername);

View File

@ -110,19 +110,19 @@ else {
$emailGroupListA = array();
$status = $version->getReviewStatus();
foreach ($status as $st) {
if ($st["status"]==0 && !in_array($st["required"], $emailUserList)) {
if($st['type'] == 0)
if ($st["status"]==0) {
if($st['type'] == 0 && !in_array($st["required"], $emailUserListR))
$emailUserListR[] = $st["required"];
else
elseif(!in_array($st["required"], $emailGroupListR))
$emailGroupListR[] = $st["required"];
}
}
$status = $version->getApprovalStatus();
foreach ($status as $st) {
if ($st["status"]==0 && !in_array($st["required"], $emailUserList)) {
if($st['type'] == 0)
if ($st["status"]==0) {
if($st['type'] == 0 && !in_array($st["required"], $emailUserListA))
$emailUserListA[] = $st["required"];
else
elseif(!in_array($st["required"], $emailGroupListA))
$emailGroupListA[] = $st["required"];
}
}

View File

@ -72,32 +72,7 @@ if (!$version->setWorkflow($workflow, $user)){
}
if ($notifier) {
$nl = $document->getNotifyList();
$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);
}
}
}
$notifier->sendRequestWorkflowActionMail($version, $user);
}
add_log_line("?documentid=".$documentid);

View File

@ -341,121 +341,10 @@ default:
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText($controller->getErrorMsg()));
} else {
// Send notification to subscribers.
if ($notifier){
$notifyList = $document->getNotifyList();
$folder = $document->getFolder();
if($notifier) {
$notifier->sendNewDocumentVersionMail($document, $user);
$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'] = $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);
}
}
$notifier->sendChangedExpiryMail($document, $user, $oldexpires);
}
if($settings->_removeFromDropFolder) {

View File

@ -2870,8 +2870,12 @@ $(document).ready( function() {
?>
/* 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) {
attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3];
window.location = '../out/out.ViewDocument.php?documentid=' + attr_id;
if(ev.shiftKey) {
$(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
}
@ -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 */
$('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) {
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;
if(ev.shiftKey) {
$(ev.currentTarget).parent().toggleClass('selected');
} else {
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
}

View File

@ -194,13 +194,17 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
* the table row when deleting the folder
* This was added for the internal_link extensіon
*/
attr_id = $(ev.currentTarget).parent().data('target-id');
if(typeof attr_id == 'undefined')
attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3];
folderSelectedmaintree(attr_id, '');
$([document.documentElement, document.body]).animate({
scrollTop: 200
}, 200);
if(ev.shiftKey) {
$(ev.currentTarget).parent().toggleClass('selected');
} else {
attr_id = $(ev.currentTarget).parent().data('target-id');
if(typeof attr_id == 'undefined')
attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3];
folderSelectedmaintree(attr_id, '');
$([document.documentElement, document.body]).animate({
scrollTop: 200
}, 200);
}
});
<?php
$this->printClickDocumentJs();

View File

@ -2841,8 +2841,12 @@ $(document).ready( function() {
?>
/* 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) {
attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3];
window.location = '../out/out.ViewDocument.php?documentid=' + attr_id;
if(ev.shiftKey) {
$(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
}
@ -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 */
$('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) {
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;
if(ev.shiftKey) {
$(ev.currentTarget).parent().toggleClass('selected');
} else {
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
}
@ -2901,10 +2909,12 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
* {@link SeedDMS_Bootstrap_Style::folderListRowStart()}
*/
function documentListRowStart($document, $class='') { /* {{{ */
if($class == 'error')
$class = 'table-danger';
else
$class = 'table-'.$class;
if($class) {
if($class == 'error')
$class = 'table-danger';
else
$class = 'table-'.$class;
}
$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)."\">";
} /* }}} */

View File

@ -28,7 +28,7 @@ require_once("../inc/inc.ClassEmailNotify.php");
require_once("../inc/inc.Notification.php");
require_once("../inc/inc.ClassController.php");
$notifier = new SeedDMS_NotificationService($logger);
$notifier = new SeedDMS_NotificationService($logger, $settings);
if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['notification'] as $notificationObj) {