get mandatory workflow from $_POST[workflows]

This commit is contained in:
Uwe Steinmann 2016-01-27 16:19:35 +01:00
parent a935a635c8
commit a68954725e
2 changed files with 18 additions and 2 deletions

View File

@ -206,11 +206,19 @@ if($settings->_workflowMode == 'traditional' || $settings->_workflowMode == 'tra
}
}
} elseif($settings->_workflowMode == 'advanced') {
if(!$workflow = $user->getMandatoryWorkflow()) {
if(!$workflows = $user->getMandatoryWorkflows()) {
if(isset($_POST["workflow"]))
$workflow = $dms->getWorkflow($_POST["workflow"]);
else
$workflow = null;
} else {
/* If there is excactly 1 mandatory workflow, then set no matter what has
* been posted in 'workflow', otherwise check if the posted workflow is in the
* list of mandatory workflows. If not, then take the first one.
*/
$workflow = array_shift($workflows);
foreach($workflows as $mw)
if($mw->getID() == $_POST['workflow']) {$workflow = $mw; break;}
}
}

View File

@ -185,11 +185,19 @@ if ($_FILES['userfile']['error'] == 0) {
}
}
} elseif($settings->_workflowMode == 'advanced') {
if(!$workflow = $user->getMandatoryWorkflow()) {
if(!$workflows = $user->getMandatoryWorkflows()) {
if(isset($_POST["workflow"]))
$workflow = $dms->getWorkflow($_POST["workflow"]);
else
$workflow = null;
} else {
/* If there is excactly 1 mandatory workflow, then set no matter what has
* been posted in 'workflow', otherwise check if the posted workflow is in the
* list of mandatory workflows. If not, then take the first one.
*/
$workflow = array_shift($workflows);
foreach($workflows as $mw)
if($mw->getID() == $_POST['workflow']) {$workflow = $mw; break;}
}
}