diff --git a/inc/inc.ClassNotificationService.php b/inc/inc.ClassNotificationService.php index f86fdc415..0293d8643 100644 --- a/inc/inc.ClassNotificationService.php +++ b/inc/inc.ClassNotificationService.php @@ -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(); diff --git a/op/op.RemoveDocumentFile.php b/op/op.RemoveDocumentFile.php index dbda46a6d..f01114f94 100644 --- a/op/op.RemoveDocumentFile.php +++ b/op/op.RemoveDocumentFile.php @@ -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); } }