move send of notification mail in Notification class, do not inform approvers and reviewers anymore

This commit is contained in:
Uwe Steinmann 2021-12-03 19:13:16 +01:00
parent 897f6ce64b
commit f24badd9ce
2 changed files with 30 additions and 3 deletions

View File

@ -384,16 +384,41 @@ class SeedDMS_NotificationService {
$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 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(), $nl['users']))
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
}
} /* }}} */
/**
* This notification is sent when a document version is deleted.
* Keep in mind that $document refers to a document which has just been
* Keep in mind that $version refers to a version which has just been
* deleted from the database, but all the data needed is still in the
* object.
*/
public function sendDeleteDocumentVersionMail($document, $user) { /* {{{ */
public function sendDeleteDocumentVersionMail($document, $version, $user) { /* {{{ */
$nl = $document->getNotifyList();
$subject = "version_deleted_email_subject";
$message = "version_deleted_email_body";
$params = array();
$params['name'] = $document->getName();
$params['version'] = $version->getVersion();
$params['folder_path'] = $document->getFolder()->getFolderPathPlain();
$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();
$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 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(), $nl['users']))
$this->toIndividual($user, $document->getOwner(), $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
} /* }}} */
/**

View File

@ -142,13 +142,14 @@ else {
if($hit = $lucenesearch->getDocument($document->getID())) {
$index->delete($hit->id);
}
$version = $document->getLatestContent();
$index->addDocument($fulltextservice->IndexedDocument($document));
$index->commit();
}
// Notify affected users.
if ($notifier){
$notifier->sendDeleteDocumentVersionMail($document, $version, $user);
/*
$nl=$document->getNotifyList();
$userrecipientsR = array();
foreach ($emailUserListR as $eID) {
@ -195,6 +196,7 @@ else {
foreach ($nl["groups"] as $grp) {
$notifier->toGroup($user, $grp, $subject, $message, $params, SeedDMS_NotificationService::RECV_NOTIFICATION);
}
*/
}
}
}