diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php
index ad1765462..4a0df531f 100644
--- a/SeedDMS_Core/Core/inc.ClassDocument.php
+++ b/SeedDMS_Core/Core/inc.ClassDocument.php
@@ -6323,19 +6323,21 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* id from table tblWorkflowDocumentContent which is used to
* get log entries for this workflow.
* This method will only get a currently running workflow in
- * a state. Once
+ * a state. Once a
* workflow has ended, the current state of the workflow was
* set to null.
*
+ * @param bool $full return not just workflow but the data from
+ * tblWorkflowDocumentContent too
* @return object/boolean an object of class SeedDMS_Core_Workflow
* or false in case of error, e.g. the version has not a workflow
*/
- function getWorkflow() { /* {{{ */
+ function getWorkflow($full = false) { /* {{{ */
$db = $this->_document->getDMS()->getDB();
if (!$this->_workflow) {
$queryStr=
- "SELECT a.`id` as `wdcid`, a.`parent`, b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflows` b ON a.`workflow` = b.`id` WHERE a.`version`='".$this->_version
+ "SELECT a.`id` as `wdcid`, a.`parent`, a.`date`, b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflows` b ON a.`workflow` = b.`id` WHERE a.`version`='".$this->_version
."' AND a.`document` = '". $this->_document->getID() ."' "
." AND a.`state` IS NOT NULL"
." ORDER BY `date` DESC LIMIT 1";
@@ -6344,10 +6346,13 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
return false;
if(!$recs)
return false;
- $this->_workflow = array('id'=>(int)$recs[0]['wdcid'], 'parent'=>(int)$recs[0]['parent'], 'workflow'=>new SeedDMS_Core_Workflow($recs[0]['id'], $recs[0]['name'], $this->_document->getDMS()->getWorkflowState($recs[0]['initstate']), $recs[0]["layoutdata"]));
+ $this->_workflow = array('id'=>(int)$recs[0]['wdcid'], 'parent'=>(int)$recs[0]['parent'], 'date'=>$recs[0]['date'], 'workflow'=>new SeedDMS_Core_Workflow($recs[0]['id'], $recs[0]['name'], $this->_document->getDMS()->getWorkflowState($recs[0]['initstate']), $recs[0]["layoutdata"]));
$this->_workflow['workflow']->setDMS($this->_document->getDMS());
}
- return $this->_workflow['workflow'];
+ if($full)
+ return $this->_workflow;
+ else
+ return $this->_workflow['workflow'];
} /* }}} */
/**
diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml
index d1de912fa..136a2fbff 100644
--- a/SeedDMS_Core/package.xml
+++ b/SeedDMS_Core/package.xml
@@ -12,7 +12,7 @@
uwe@steinmann.cxyes
- 2022-02-18
+ 2022-04-066.0.18
@@ -30,6 +30,7 @@
- add SeedDMS_Core_File::fileExtension()
- add callbacks on onPostUpdateAttribute, onPostRemoveAttribute, onPostAddAttribute
- fix searching for document content with a custom attribute having a value set
+- SeedDMS_Core_DocumentContent::getWorkflow() has optional parameter to return data from table tblWorkflowDocumentContent