From 0f072fc9a95d17f6d988c82751301c7e28b093a7 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 1 Jun 2021 10:54:06 +0200 Subject: [PATCH] check if current workflow state != null --- views/bootstrap/class.ViewDocument.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index 81ba70031..5d8487334 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -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 "
getDocument()->getId()."\" />getVersion()."\" />
"; } else { print "
getDocument()->getId()."\" />getVersion()."\" />
"; @@ -1107,7 +1111,7 @@ $(document).ready( function() { if($parentworkflow = $latestContent->getParentWorkflow()) { echo "

Sub workflow of '".htmlspecialchars($parentworkflow->getName())."'

"; } - echo "
".getMLText('current_state').": ".htmlspecialchars($workflowstate->getName())."
"; + echo "
".getMLText('current_state').": ".($workflowstate ? htmlspecialchars($workflowstate->getName()) : htmlspecialchars(getMLText('workflow_in_unknown_state')))."
"; echo "\n"; echo ""; echo ""; @@ -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; }
".getMLText('next_state').":