check if current workflow state != null

This commit is contained in:
Uwe Steinmann 2021-06-01 10:54:06 +02:00
parent 822aef2e53
commit 0f072fc9a9

View File

@ -704,13 +704,17 @@ $(document).ready( function() {
$reverselinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $reverselinks, 'source');
$needwkflaction = false;
$transitions = array();
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
} elseif($workflowmode == 'advanced') {
$workflow = $latestContent->getWorkflow();
if($workflow) {
$workflowstate = $latestContent->getWorkflowState();
$transitions = $workflow->getNextTransitions($workflowstate);
$needwkflaction = $latestContent->needsWorkflowAction($user);
if($workflowstate = $latestContent->getWorkflowState()) {
$transitions = $workflow->getNextTransitions($workflowstate);
$needwkflaction = $latestContent->needsWorkflowAction($user);
} else {
$this->warningMsg(getMLText('workflow_in_unknown_state'));
}
}
}
@ -1096,7 +1100,7 @@ $(document).ready( function() {
$this->columnStart(12);
$this->contentContainerStart();
if($user->isAdmin()) {
if(SeedDMS_Core_DMS::checkIfEqual($workflow->getInitState(), $latestContent->getWorkflowState())) {
if(!$workflowstate || SeedDMS_Core_DMS::checkIfEqual($workflow->getInitState(), $workflowstate)) {
print "<form action=\"../out/out.RemoveWorkflowFromDocument.php\" method=\"get\"><input type=\"hidden\" name=\"documentid\" value=\"".$latestContent->getDocument()->getId()."\" /><input type=\"hidden\" name=\"version\" value=\"".$latestContent->getVersion()."\" /><button type=\"submit\" class=\"btn btn-danger\"><i class=\"fa fa-remove\"></i> ".getMLText('rm_workflow')."</button></form>";
} else {
print "<form action=\"../out/out.RewindWorkflow.php\" method=\"get\"><input type=\"hidden\" name=\"documentid\" value=\"".$latestContent->getDocument()->getId()."\" /><input type=\"hidden\" name=\"version\" value=\"".$latestContent->getVersion()."\" /><button type=\"submit\" class=\"btn btn-danger\"><i class=\"fa fa-refresh\"></i> ".getMLText('rewind_workflow')."</button></form>";
@ -1107,7 +1111,7 @@ $(document).ready( function() {
if($parentworkflow = $latestContent->getParentWorkflow()) {
echo "<p>Sub workflow of '".htmlspecialchars($parentworkflow->getName())."'</p>";
}
echo "<h5>".getMLText('current_state').": ".htmlspecialchars($workflowstate->getName())."</h5>";
echo "<h5>".getMLText('current_state').": ".($workflowstate ? htmlspecialchars($workflowstate->getName()) : htmlspecialchars(getMLText('workflow_in_unknown_state')))."</h5>";
echo "<table class=\"table table-condensed table-sm\">\n";
echo "<tr>";
echo "<td>".getMLText('next_state').":</td>";
@ -1211,7 +1215,7 @@ $(document).ready( function() {
if($workflows) {
$subworkflows = array();
foreach($workflows as $wkf) {
if($wkf->getInitState()->getID() == $workflowstate->getID()) {
if($workflowstate && ($wkf->getInitState()->getID() == $workflowstate->getID())) {
if($workflow->getID() != $wkf->getID()) {
$subworkflows[] = $wkf;
}