do not allow to change workflow if it is mandatory

This commit is contained in:
Uwe Steinmann 2013-08-06 14:21:40 +02:00
parent cb60c86e6e
commit 857519033d
4 changed files with 51 additions and 24 deletions

View File

@ -87,11 +87,6 @@ foreach($attributes_version as $attrdefid=>$attribute) {
}
if(isset($_POST["workflow"]))
$workflow = $dms->getWorkflow($_POST["workflow"]);
else
$workflow = null;
$reqversion = (int)$_POST["reqversion"];
if ($reqversion<1) $reqversion=1;
@ -183,6 +178,14 @@ foreach ($res as $r){
}
}
if(!$workflow = $user->getMandatoryWorkflow()) {
if(isset($_POST["workflow"]))
$workflow = $dms->getWorkflow($_POST["workflow"]);
else
$workflow = null;
}
if($settings->_dropFolderDir) {
if(isset($_POST["dropfolderfileform1"]) && $_POST["dropfolderfileform1"]) {
$fullfile = $settings->_dropFolderDir.'/'.$user->getLogin().'/'.$_POST["dropfolderfileform1"];

View File

@ -168,6 +168,8 @@ if ($_FILES['userfile']['error'] == 0) {
}
}
$workflow = $user->getMandatoryWorkflow();
if(isset($_POST["attributes"]) && $_POST["attributes"]) {
$attributes = $_POST["attributes"];
foreach($attributes as $attrdefid=>$attribute) {
@ -184,7 +186,7 @@ if ($_FILES['userfile']['error'] == 0) {
$attributes = array();
}
$contentResult=$document->addContent($comment, $user, $userfiletmp, basename($userfilename), $fileType, $userfiletype, $reviewers, $approvers, $version=0, $attributes);
$contentResult=$document->addContent($comment, $user, $userfiletmp, basename($userfilename), $fileType, $userfiletype, $reviewers, $approvers, $version=0, $attributes, $workflow);
if (is_bool($contentResult) && !$contentResult) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
}

View File

@ -215,19 +215,30 @@ function addFiles()
<div class="cbSelectTitle"><?php printMLText("workflow");?>:</div>
</td>
<td>
<select class="_chzn-select-deselect span9" name="workflow" data-placeholder="<?php printMLText('select_workflow'); ?>">
<?php
$mandatoryworkflow = $user->getMandatoryWorkflow();
$workflows=$dms->getAllWorkflows();
print "<option value=\"\">"."</option>";
foreach ($workflows as $workflow) {
print "<option value=\"".$workflow->getID()."\"";
if($mandatoryworkflow && $mandatoryworkflow->getID() == $workflow->getID())
echo " selected=\"selected\"";
print ">". htmlspecialchars($workflow->getName())."</option>";
}
if($mandatoryworkflow) {
?>
<?php echo $mandatoryworkflow->getName(); ?>
<input type="hidden" name="workflow" value="<?php echo $mandatoryworkflow->getID(); ?>">
<?php
} else {
?>
<select class="_chzn-select-deselect span9" name="workflow" data-placeholder="<?php printMLText('select_workflow'); ?>">
<?php
$workflows=$dms->getAllWorkflows();
print "<option value=\"\">"."</option>";
foreach ($workflows as $workflow) {
print "<option value=\"".$workflow->getID()."\"";
if($mandatoryworkflow && $mandatoryworkflow->getID() == $workflow->getID())
echo " selected=\"selected\"";
print ">". htmlspecialchars($workflow->getName())."</option>";
}
?>
</select>
<?php
}
?>
</td>
</tr>
<tr>

View File

@ -274,19 +274,30 @@ function checkForm()
<div class="cbSelectTitle"><?php printMLText("workflow");?>:</div>
</td>
<td>
<select class="_chzn-select-deselect span9" name="workflow" data-placeholder="<?php printMLText('select_workflow'); ?>">
<?php
$mandatoryworkflow = $user->getMandatoryWorkflow();
$workflows=$dms->getAllWorkflows();
print "<option value=\"\">"."</option>";
foreach ($workflows as $workflow) {
print "<option value=\"".$workflow->getID()."\"";
if($mandatoryworkflow && $mandatoryworkflow->getID() == $workflow->getID())
echo " selected=\"selected\"";
print ">". htmlspecialchars($workflow->getName())."</option>";
}
if($mandatoryworkflow) {
?>
<?php echo $mandatoryworkflow->getName(); ?>
<input type="hidden" name="workflow" value="<?php echo $mandatoryworkflow->getID(); ?>">
<?php
} else {
?>
<select class="_chzn-select-deselect span9" name="workflow" data-placeholder="<?php printMLText('select_workflow'); ?>">
<?php
$workflows=$dms->getAllWorkflows();
print "<option value=\"\">"."</option>";
foreach ($workflows as $workflow) {
print "<option value=\"".$workflow->getID()."\"";
if($mandatoryworkflow && $mandatoryworkflow->getID() == $workflow->getID())
echo " selected=\"selected\"";
print ">". htmlspecialchars($workflow->getName())."</option>";
}
?>
</select>
<?php
}
?>
</td>
</tr>
<tr>