check for missing release/reject of document, nicer layout

This commit is contained in:
Uwe Steinmann 2016-09-02 08:36:12 +02:00
parent c0e816fdc5
commit 588137ddd2

View File

@ -90,35 +90,42 @@ $(document).ready(function() {
$transitions = $workflow->getTransitions(); $transitions = $workflow->getTransitions();
$initstate = $workflow->getInitState(); $initstate = $workflow->getInitState();
$hasinitstate = true; $hasinitstate = true;
$hasreleased = true;
$hasrejected = true;
$missesug = false; $missesug = false;
if($transitions) { if($transitions) {
$hasinitstate = false; $hasinitstate = false;
$hasreleased = false;
$hasrejected = false;
foreach($transitions as $transition) { foreach($transitions as $transition) {
$transusers = $transition->getUsers(); $transusers = $transition->getUsers();
$transgroups = $transition->getGroups(); $transgroups = $transition->getGroups();
if(!$transusers && !$transgroups) { if(!$transusers && !$transgroups) {
$missesug = true; $missesug = true;
} }
if($transition->getNextState()->getDocumentStatus() == S_RELEASED)
$hasreleased = true;
if($transition->getNextState()->getDocumentStatus() == S_REJECTED)
$hasrejected = true;
if($transition->getState()->getID() == $initstate->getID()) if($transition->getState()->getID() == $initstate->getID())
$hasinitstate = true; $hasinitstate = true;
} }
} }
if($missesug) if($missesug)
$this->errorMsg('One of the transitions has neither a user nor a group!'); $this->errorMsg(getMLText('workflow_transition_without_user_group'));
if(!$hasinitstate) if(!$hasinitstate)
$this->errorMsg('None of the transitions starts with the initial state of the workflow!'); $this->errorMsg(getMLText('workflow_no_initial_state'));
if(!$hasreleased)
$this->errorMsg(getMLText('workflow_no_doc_released_state'));
if(!$hasrejected)
$this->errorMsg(getMLText('workflow_no_doc_rejected_state'));
if($workflow->isUsed()) { if($workflow->isUsed()) {
?> $this->infoMsg(getMLText('workflow_in_use'));
<p><?php echo getMLText('workflow_in_use') ?></p>
<?php
} else {
?>
<a class="standardText btn" href="../out/out.RemoveWorkflow.php?workflowid=<?php print $workflow->getID();?>"><i class="icon-remove"></i> <?php printMLText("rm_workflow");?></a>
<?php
} }
} }
?> ?>
<div class="well">
<form action="../op/op.WorkflowMgr.php" method="post" enctype="multipart/form-data"> <form action="../op/op.WorkflowMgr.php" method="post" enctype="multipart/form-data">
<?php <?php
if($workflow) { if($workflow) {
@ -135,6 +142,13 @@ $(document).ready(function() {
} }
?> ?>
<table class="table-condensed"> <table class="table-condensed">
<?php
if(!$workflow->isUsed()) {
?>
<tr><td></td><td><a class="standardText btn" href="../out/out.RemoveWorkflow.php?workflowid=<?php print $workflow->getID();?>"><i class="icon-remove"></i> <?php printMLText("rm_workflow");?></a></td></tr>
<?php
}
?>
<tr> <tr>
<td><?php printMLText("workflow_name");?>:</td> <td><?php printMLText("workflow_name");?>:</td>
<td><input type="text" name="name" value="<?php print ($workflow ? htmlspecialchars($workflow->getName()) : "");?>"></td> <td><input type="text" name="name" value="<?php print ($workflow ? htmlspecialchars($workflow->getName()) : "");?>"></td>
@ -159,6 +173,7 @@ $(document).ready(function() {
</tr> </tr>
</table> </table>
</form> </form>
</div>
<?php <?php
if($workflow) { if($workflow) {
$actions = $dms->getAllWorkflowActions(); $actions = $dms->getAllWorkflowActions();
@ -308,11 +323,9 @@ $(document).ready(function() {
</div> </div>
<div class="span7"> <div class="span7">
<div class="well">
<div class="ajax" data-view="WorkflowMgr" data-action="form" <?php echo ($selworkflow ? "data-query=\"workflowid=".$selworkflow->getID()."\"" : "") ?>></div> <div class="ajax" data-view="WorkflowMgr" data-action="form" <?php echo ($selworkflow ? "data-query=\"workflowid=".$selworkflow->getID()."\"" : "") ?>></div>
</div> </div>
</div> </div>
</div>
<?php <?php
$this->contentEnd(); $this->contentEnd();