set splash messages, inform users only once

This commit is contained in:
Uwe Steinmann 2018-11-16 11:35:56 +01:00
parent 2d8e8a606c
commit e6cc38cb22

View File

@ -116,9 +116,13 @@ if($version->triggerWorkflowTransition($user, $transition, $_POST["comment"])) {
$params['http_root'] = $settings->_httpRoot;
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID();
$usersinformed = array();
foreach($workflow->getNextTransitions($transition->getNextState()) as $ntransition) {
foreach($ntransition->getUsers() as $tuser) {
$notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params);
if(!in_array($tuser->getUser()->getID(), $usersinformed)) {
$usersinformed[] = $tuser->getUser()->getID();
$notifier->toIndividual($user, $tuser->getUser(), $subject, $message, $params);
}
}
foreach($ntransition->getGroups() as $tuser) {
$notifier->toGroup($user, $tuser->getGroup(), $subject, $message, $params);
@ -127,6 +131,8 @@ if($version->triggerWorkflowTransition($user, $transition, $_POST["comment"])) {
}
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_trigger_workflow')));
if(isset($GLOBALS['SEEDDMS_HOOKS']['triggerWorkflowTransition'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['triggerWorkflowTransition'] as $hookObj) {
if (method_exists($hookObj, 'postTriggerWorkflowTransition')) {
@ -134,6 +140,8 @@ if($version->triggerWorkflowTransition($user, $transition, $_POST["comment"])) {
}
}
}
} else {
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_trigger_workflow')));
}
add_log_line("?documentid=".$documentid."&version".$version_num);