move sending notification mail into Notification Service

This commit is contained in:
Uwe Steinmann 2021-05-19 16:18:03 +02:00
parent 4d84aa2ce2
commit acf85728c3
2 changed files with 22 additions and 14 deletions

View File

@ -432,6 +432,27 @@ class SeedDMS_NotificationService {
}
} /* }}} */
/**
* This notification is sent when a new attachment is created.
*/
public function sendDeleteFileMail($file, $user) { /* {{{ */
$document = $file->getDocument();
$notifyList = $document->getNotifyList();
$subject = "removed_file_email_subject";
$message = "removed_file_email_body";
$params = array();
$params['document'] = $document->getName();
$params['username'] = $user->getFullName();
$params['url'] = getBaseUrl().$this->settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$params['sitename'] = $this->settings->_siteName;
$params['http_root'] = $this->settings->_httpRoot;
$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();

View File

@ -68,20 +68,7 @@ if (!$document->removeDocumentFile($fileid)) {
} else {
// Send notification to subscribers.
if($notifier) {
$notifyList = $document->getNotifyList();
$subject = "removed_file_email_subject";
$message = "removed_file_email_body";
$params = array();
$params['document'] = $document->getName();
$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->sendDeleteFileMail($file, $user);
}
}