diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index 85c5c492e..e19ab551d 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -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;