add new parameter to SeedDMS_Core_DMS->getDocumentList() for skipping expired documents

This commit is contained in:
Uwe Steinmann 2021-02-04 12:25:22 +01:00
parent 095d187ce1
commit 4e5139616c
2 changed files with 27 additions and 8 deletions

View File

@ -893,14 +893,20 @@ class SeedDMS_Core_DMS {
* @param string $listtype type of document list, can be 'AppRevByMe',
* 'AppRevOwner', 'ReceiptByMe', 'ReviseByMe', 'LockedByMe', 'MyDocs'
* @param SeedDMS_Core_User $param1 user
* @param bool $param2 set to true
* if 'ReviewByMe', 'ApproveByMe', 'AppRevByMe', 'ReviseByMe', 'ReceiptByMe'
* shall return even documents І have already taken care of.
* @param bool|integer|string $param2 if set to true
* 'ReviewByMe', 'ApproveByMe', 'AppRevByMe', 'ReviseByMe', 'ReceiptByMe'
* will also return documents which the reviewer, approver, etc.
* has already taken care of. If set to false only
* untouched documents will be returned. In case of 'ExpiredOwner' this
* parameter contains the number of days (a negative number is allowed)
* relativ to the current date or a date in format 'yyyy-mm-dd'
* (even in the past).
* @param string $param3 sort list by this field
* @param string $param4 order direction
* @param bool $param5 set to false if expired documents shall not be considered
* @return array|bool
*/
function getDocumentList($listtype, $param1=null, $param2=false, $param3='', $param4='') { /* {{{ */
function getDocumentList($listtype, $param1=null, $param2=false, $param3='', $param4='', $param5=true) { /* {{{ */
/* The following query will get all documents and lots of additional
* information. It requires the two temporary tables ttcontentid and
* ttstatid.
@ -989,7 +995,10 @@ class SeedDMS_Core_DMS {
}
if (strlen($docCSV)>0) {
$queryStr .= "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.", ".S_EXPIRED.") ".
$docstatarr = array(S_DRAFT_REV, S_DRAFT_APP);
if($param5)
$docstatarr[] = S_EXPIRED;
$queryStr .= "AND `tblDocumentStatusLog`.`status` IN (".implode(',', $docstatarr).") ".
"AND `tblDocuments`.`id` IN (" . $docCSV . ") ".
"ORDER BY `statusDate` DESC";
} else {
@ -1027,7 +1036,10 @@ class SeedDMS_Core_DMS {
$queryStr .= "OR `tblDocumentReviewers`.`type` = 1 AND `tblDocumentReviewers`.`required` IN (".implode(',', $groups).") ";
$queryStr .= ") ";
}
$queryStr .= "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_EXPIRED.") ";
$docstatarr = array(S_DRAFT_REV);
if($param5)
$docstatarr[] = S_EXPIRED;
$queryStr .= "AND `tblDocumentStatusLog`.`status` IN (".implode(',', $docstatarr).") ";
if(!$param2)
$queryStr .= " AND `tblDocumentReviewLog`.`status` = 0 ";
if ($orderby=='e') $queryStr .= "ORDER BY `expires`";
@ -1106,7 +1118,10 @@ class SeedDMS_Core_DMS {
$queryStr .= "OR `tblDocumentApprovers`.`type` = 1 AND `tblDocumentApprovers`.`required` IN (".implode(',', $groups).")";
$queryStr .= ") ";
}
$queryStr .= "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_APP.", ".S_EXPIRED.") ";
$docstatarr = array(S_DRAFT_APP);
if($param5)
$docstatarr[] = S_EXPIRED;
$queryStr .= "AND `tblDocumentStatusLog`.`status` IN (".implode(',', $docstatarr).") ";
if(!$param2)
$queryStr .= " AND `tblDocumentApproveLog`.`status` = 0 ";
if ($orderby=='e') $queryStr .= "ORDER BY `expires`";
@ -1141,7 +1156,10 @@ class SeedDMS_Core_DMS {
}
if (strlen($docCSV)>0) {
$queryStr .= "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_APP.", ".S_EXPIRED.") ".
$docstatarr = array(S_DRAFT_APP);
if($param5)
$docstatarr[] = S_EXPIRED;
$queryStr .= "AND `tblDocumentStatusLog`.`status` IN (".implode(',', $docstatarr).") ".
"AND `tblDocuments`.`id` IN (" . $docCSV . ") ";
//$queryStr .= "ORDER BY `statusDate` DESC";
if ($orderby=='e') $queryStr .= "ORDER BY `expires`";

View File

@ -27,6 +27,7 @@
- add SeedDMS_Core_DatabaseAccess::hasTable()
- add SeedDMS_Core_User->isType() and SeedDMS_Core_Group->isType()
- add SeedDMS_Core_User->getDMS() and SeedDMS_Core_Group->getDMS()
- add new parameter to SeedDMS_Core_DMS->getDocumentList() for skipping expired documents
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">