add method getWorkflowStatus()

This commit is contained in:
Uwe Steinmann 2016-02-10 10:32:27 +01:00
parent c0a1ed57bb
commit a8c98b5f72

View File

@ -322,6 +322,35 @@ class SeedDMS_Core_Group {
return $status; return $status;
} /* }}} */ } /* }}} */
/**
* Get a list of documents with a workflow
*
* @param int $documentID optional document id for which to retrieve the
* reviews
* @param int $version optional version of the document
* @return array list of all workflows
*/
function getWorkflowStatus($documentID=null, $version=null) { /* {{{ */
$db = $this->_dms->getDB();
$queryStr = 'select distinct d.*, c.groupid from tblWorkflowTransitions a left join tblWorkflows b on a.workflow=b.id left join tblWorkflowTransitionGroups c on a.id=c.transition left join tblWorkflowDocumentContent d on b.id=d.workflow where d.document is not null and a.state=d.state and c.groupid='.$this->_id;
if($documentID) {
$queryStr .= ' AND d.document='.(int) $documentID;
if($version)
$queryStr .= ' AND d.version='.(int) $version;
}
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr == false)
return false;
$result = array();
if (count($resArr)>0) {
foreach ($resArr as $res) {
$result[] = $res;
}
}
return $result;
} /* }}} */
/** /**
* Get all notifications of group * Get all notifications of group
* *