diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 8d8fe20f4..65785a018 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -1016,7 +1016,7 @@ class SeedDMS_Core_DMS { $queryStr = ''; } break; // }}} - case 'AppRevOwner': // Documents waiting for review/approval I'm owning {{{ + case 'AppRevOwner': // Documents waiting for review/approval/revision I'm owning {{{ $user = $param1; $orderby = $param3; if($param4 == 'desc') @@ -1024,7 +1024,7 @@ class SeedDMS_Core_DMS { else $orderdir = 'ASC'; $queryStr .= "AND `tblDocuments`.`owner` = '".$user->getID()."' ". - "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.") "; + "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.", ".S_IN_REVISION.") "; if ($orderby=='e') $queryStr .= "ORDER BY `expires`"; else if ($orderby=='u') $queryStr .= "ORDER BY `statusDate`"; else if ($orderby=='s') $queryStr .= "ORDER BY `status`"; @@ -1034,6 +1034,36 @@ class SeedDMS_Core_DMS { // "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.") ". // "ORDER BY `statusDate` DESC"; break; // }}} + case 'ReceiveOwner': // Documents waiting for reception I'm owning {{{ + $user = $param1; + $orderby = $param3; + if($param4 == 'desc') + $orderdir = 'DESC'; + else + $orderdir = 'ASC'; + + $qs = 'SELECT DISTINCT documentID FROM `tblDocumentRecipients` LEFT JOIN `ttcontentid` ON `ttcontentid`.`maxVersion` = `tblDocumentRecipients`.`version` AND `ttcontentid`.`document` = `tblDocumentRecipients`.`documentID`'; + $ra = $this->db->getResultArray($qs); + if (is_bool($ra) && !$ra) { + return false; + } + $docs = array(); + foreach($ra as $d) { + $docs[] = $d['documentID']; + } + + if ($docs) { + $queryStr .= "AND `tblDocuments`.`id` IN (" . implode(',', $docs) . ") "; + $queryStr .= "AND `tblDocuments`.`owner` = '".$user->getID()."'"; + if ($orderby=='e') $queryStr .= "ORDER BY `expires`"; + else if ($orderby=='u') $queryStr .= "ORDER BY `statusDate`"; + else if ($orderby=='s') $queryStr .= "ORDER BY `status`"; + else $queryStr .= "ORDER BY `name`"; + $queryStr .= " ".$orderdir; + } else { + $queryStr = ''; + } + break; // }}} case 'RejectOwner': // Documents that has been rejected and I'm owning {{{ $user = $param1; $orderby = $param3;