add and use sendRewindWorkflowMail()

This commit is contained in:
Uwe Steinmann 2021-08-30 19:39:29 +02:00
parent 6dac961e9c
commit a4276a42a9
2 changed files with 30 additions and 19 deletions

View File

@ -1119,5 +1119,34 @@ class SeedDMS_NotificationService {
}
}
} /* }}} */
/**
* This notification is sent when a workflow is rewinded.
*/
public function sendRewindWorkflowMail($content, $user) { /* {{{ */
$document = $content->getDocument();
$folder = $document->getFolder();
$workflow = $content->getWorkflow();
$nl = $document->getNotifyList();
$folder = $document->getFolder();
$subject = "rewind_workflow_email_subject";
$message = "rewind_workflow_email_body";
$params = array();
$params['name'] = $document->getName();
$params['version'] = $content->getVersion();
$params['workflow'] = $workflow->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.ViewDocument.php?documentid=".$document->getID()."&currenttab=workflow";
// Send notification to subscribers.
$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);
}
} /* }}} */
}

View File

@ -62,25 +62,7 @@ if (!is_object($workflow)) {
if($version->rewindWorkflow()) {
if ($notifier) {
$nl = $document->getNotifyList();
$folder = $document->getFolder();
$subject = "rewind_workflow_email_subject";
$message = "rewind_workflow_email_body";
$params = array();
$params['name'] = $document->getName();
$params['version'] = $version->getVersion();
$params['workflow'] = $workflow->getName();
$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.ViewDocument.php?documentid=".$document->getID();
// Send notification to subscribers.
$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->sendRewindWorkflowMail($version, $user);
}
}