diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 041205298..4ab83c02f 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -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);