rename getLastWorkflowTransition() to getLastWorkflowLow(), returns a log even after the workflow was ended

This commit is contained in:
Uwe Steinmann 2022-02-18 18:02:08 +01:00
parent cffad48b61
commit ec1f99229e

View File

@ -5352,30 +5352,33 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
} /* }}} */
/**
* Get the latest logged transition for the document content within the
* workflow
* Get the latest workflow log entry for the document content within the
* workflow. Even after finishing the workflow (when the document content
* does not have workflow set anymore) this function returns the last
* log entry.
*
* @return array list of operations
* @return object
*/
function getLastWorkflowTransition() { /* {{{ */
function getLastWorkflowLog() { /* {{{ */
$db = $this->_document->getDMS()->getDB();
/*
if(!$this->_workflow)
$this->getWorkflow();
if(!$this->_workflow)
return false;
*/
$queryStr=
"SELECT * FROM `tblWorkflowLog` WHERE `version`='".$this->_version ."' AND `document` = '". $this->_document->getID() ."' AND `workflow` = ". $this->_workflow->getID();
"SELECT * FROM `tblWorkflowLog` WHERE `version`='".$this->_version ."' AND `document` = '". $this->_document->getID() ."'"; // AND `workflow` = ". $this->_workflow->getID();
$queryStr .= " ORDER BY `id` DESC LIMIT 1";
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$resArr)
return false;
$workflowlogs = array();
$i = 0;
$workflowlog = new SeedDMS_Core_Workflow_Log($resArr[$i]["id"], $this->_document->getDMS()->getDocument($resArr[$i]["document"]), $resArr[$i]["version"], $this->_workflow, $this->_document->getDMS()->getUser($resArr[$i]["userid"]), $this->_workflow->getTransition($resArr[$i]["transition"]), $resArr[$i]["date"], $resArr[$i]["comment"]);
$i = 0;
$workflow = $this->_document->getDMS()->getWorkflow($resArr[$i]["workflow"]);
$workflowlog = new SeedDMS_Core_Workflow_Log($resArr[$i]["id"], $this->_document->getDMS()->getDocument($resArr[$i]["document"]), $resArr[$i]["version"], $workflow, $this->_document->getDMS()->getUser($resArr[$i]["userid"]), $workflow->getTransition($resArr[$i]["transition"]), $resArr[$i]["date"], $resArr[$i]["comment"]);
$workflowlog->setDMS($this);
return $workflowlog;