add counting documents in workflow and need correction in countTasks()

This commit is contained in:
Uwe Steinmann 2018-03-29 16:30:02 +02:00
parent 05626a4759
commit 2259acc3f2

View File

@ -836,6 +836,9 @@ class SeedDMS_Core_DMS {
* @return array list of documents records
*/
function countTasks($listtype, $user=null) { /* {{{ */
if (!$this->db->createTemporaryTable("ttstatid") || !$this->db->createTemporaryTable("ttcontentid")) {
return false;
}
$groups = array();
if($user) {
$tmp = $user->getGroups();
@ -913,6 +916,41 @@ class SeedDMS_Core_DMS {
$queryStr .= "AND `tblDocumentRevisionLog`.`status` = 0 ";
$queryStr .= "AND `tblDocumentStatusLog`.`status` IN (".S_IN_REVISION.") ";
break; /* }}} */
case 'NeedsCorrectionOwner':
$queryStr .=
"LEFT JOIN `tblDocuments` ON `tblDocuments`.`id` = `ttcontentid`.`document` ";
$queryStr .= "WHERE `tblDocuments`.`owner` = '".$user->getID()."' ".
"AND `tblDocumentStatusLog`.`status` IN (".S_NEEDS_CORRECTION.") ";
break; /* }}} */
case 'WorkflowByMe':
// Get document list for the current user.
$workflowStatus = $user->getWorkflowStatus();
// Create a comma separated list of all the documentIDs whose information is
// required.
$dList = array();
foreach ($workflowStatus["u"] as $st) {
if (!in_array($st["document"], $dList)) {
$dList[] = $st["document"];
}
}
foreach ($workflowStatus["g"] as $st) {
if (!in_array($st["document"], $dList)) {
$dList[] = $st["document"];
}
}
$docCSV = "";
foreach ($dList as $d) {
$docCSV .= (strlen($docCSV)==0 ? "" : ", ")."'".$d."'";
}
if ($dList) {
$queryStr .=
"WHERE `ttcontentid`.`document` IN (" . implode(',', $dList) . ")";
} else {
$queryStr = '';
}
break;
}
if($queryStr) {
$resArr = $this->db->getResultArray($selectStr.$queryStr);