mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-18 02:59:27 +00:00
send notification mails when document ist deleted
This commit is contained in:
parent
a8dbe05346
commit
44ee028bcd
|
@ -318,6 +318,15 @@ 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) {
|
||||||
|
$folder = $document->getFolder();
|
||||||
|
/* Get the notify list before removing the document */
|
||||||
|
$dnl = $document->getNotifyList();
|
||||||
|
$fnl = $folder->getNotifyList();
|
||||||
|
$nl = array(
|
||||||
|
'users'=>array_merge($dnl['users'], $fnl['users']),
|
||||||
|
'groups'=>array_merge($dnl['groups'], $fnl['groups'])
|
||||||
|
);
|
||||||
|
$docname = $document->getName();
|
||||||
if($document->remove()) {
|
if($document->remove()) {
|
||||||
/* Remove the document from the fulltext index */
|
/* Remove the document from the fulltext index */
|
||||||
if($settings->_enableFullSearch) {
|
if($settings->_enableFullSearch) {
|
||||||
|
@ -330,6 +339,22 @@ switch($command) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
foreach ($nl["groups"] as $grp) {
|
||||||
|
$notifier->toGroup($user, $grp, $subject, $message, $params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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'=>''));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user