mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
use new methods sendTriggerWorkflowTransitionMail and sendRequestWorkflowActionMail
This commit is contained in:
parent
42fdeaf915
commit
48a0ca8cb9
|
@ -78,61 +78,10 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['triggerWorkflowTransition'])) {
|
|||
|
||||
if($version->triggerWorkflowTransition($user, $transition, $_POST["comment"])) {
|
||||
if ($notifier) {
|
||||
$nl = $document->getNotifyList();
|
||||
$folder = $document->getFolder();
|
||||
$subject = "transition_triggered_email_subject";
|
||||
$message = "transition_triggered_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['version'] = $version->getVersion();
|
||||
$params['workflow'] = $workflow->getName();
|
||||
$params['action'] = $transition->getAction()->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['comment'] = $_POST["comment"];
|
||||
$params['previous_state'] = $transition->getState()->getName();
|
||||
$params['current_state'] = $transition->getNextState()->getName();
|
||||
$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();
|
||||
$wkflog = $version->getWorkflowLog($transition);
|
||||
$notifier->sendTriggerWorkflowTransitionMail($version, $user, $wkflog ? $wkflog[0] : false);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
if($settings->_enableNotificationWorkflow) {
|
||||
$subject = "request_workflow_action_email_subject";
|
||||
$message = "request_workflow_action_email_body";
|
||||
$params = array();
|
||||
$params['name'] = $document->getName();
|
||||
$params['version'] = $version->getVersion();
|
||||
$params['workflow'] = $workflow->getName();
|
||||
$params['folder_path'] = $folder->getFolderPathPlain();
|
||||
$params['current_state'] = $transition->getNextState()->getName();
|
||||
$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();
|
||||
|
||||
$usersinformed = array();
|
||||
$groupsinformed = array();
|
||||
foreach($workflow->getNextTransitions($transition->getNextState()) as $ntransition) {
|
||||
foreach($ntransition->getUsers() as $tuser) {
|
||||
if(!in_array($tuser->getUser()->getID(), $usersinformed)) {
|
||||
$usersinformed[] = $tuser->getUser()->getID();
|
||||
$notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW);
|
||||
}
|
||||
}
|
||||
foreach($ntransition->getGroups() as $tuser) {
|
||||
if(!in_array($tuser->getGroup()->getID(), $groupsinformed)) {
|
||||
$groupsinformed[] = $tuser->getGroup()->getID();
|
||||
$notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params, SeedDMS_NotificationService::RECV_WORKFLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$notifier->sendRequestWorkflowActionMail($version, $user, $transition);
|
||||
}
|
||||
|
||||
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_trigger_workflow')));
|
||||
|
|
Loading…
Reference in New Issue
Block a user