check if current workflow state != null

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

View File

@ -49,26 +49,29 @@ class SeedDMS_View_RewindWorkflow extends SeedDMS_Theme_Style {
$wkflog = $latestContent->getWorkflowLog(); $wkflog = $latestContent->getWorkflowLog();
$workflow = $latestContent->getWorkflow(); $workflow = $latestContent->getWorkflow();
$msg = "The document is currently in state: ".$currentstate->getName()."<br />"; if($currentstate) {
if($wkflog) { $msg = "The document is currently in state: ".$currentstate->getName()."<br />";
foreach($wkflog as $entry) { if($wkflog) {
if($entry->getTransition()->getNextState()->getID() == $currentstate->getID()) { foreach($wkflog as $entry) {
$enterdate = $entry->getDate(); if($entry->getTransition()->getNextState()->getID() == $currentstate->getID()) {
$enterts = makeTsFromLongDate($enterdate); $enterdate = $entry->getDate();
$enterts = makeTsFromLongDate($enterdate);
}
} }
$msg .= "The state was entered at ".$enterdate." which was ";
$msg .= getReadableDuration((time()-$enterts))." ago.<br />";
} }
$msg .= "The state was entered at ".$enterdate." which was "; $msg .= "The document may stay in this state for ".$currentstate->getMaxTime()." sec.";
$msg .= getReadableDuration((time()-$enterts))." ago.<br />"; } else {
$msg = getMLText('workflow_in_unknown_state');
} }
$msg .= "The document may stay in this state for ".$currentstate->getMaxTime()." sec.";
$this->infoMsg($msg); $this->infoMsg($msg);
$this->contentContainerStart();
// Display the Workflow form. // Display the Workflow form.
$this->rowStart(); $this->rowStart();
$this->columnStart(4); $this->columnStart(4);
?> ?>
<p><?php printMLText("rewind_workflow_warning"); ?></p> <?php $this->warningMsg(getMLText("rewind_workflow_warning")); ?>
<form method="post" action="../op/op.RewindWorkflow.php" name="form1"> <form method="post" action="../op/op.RewindWorkflow.php" name="form1">
<?php echo createHiddenFieldWithKey('rewindworkflow'); ?> <?php echo createHiddenFieldWithKey('rewindworkflow'); ?>
<input type='hidden' name='documentid' value='<?php echo $document->getId(); ?>'/> <input type='hidden' name='documentid' value='<?php echo $document->getId(); ?>'/>
@ -85,7 +88,6 @@ class SeedDMS_View_RewindWorkflow extends SeedDMS_Theme_Style {
<?php <?php
$this->columnEnd(); $this->columnEnd();
$this->rowEnd(); $this->rowEnd();
$this->contentContainerEnd();
if($wkflog) { if($wkflog) {
echo "<table class=\"table table-condensed table-sm\">"; echo "<table class=\"table table-condensed table-sm\">";