add 'ExpiredOwner' to getDocumentList()

This commit is contained in:
Uwe Steinmann 2017-10-27 16:47:09 +02:00
parent 5149511aaa
commit 68ccb13a72

View File

@ -870,6 +870,7 @@ class SeedDMS_Core_DMS {
* @param string $param2 set to true
* if 'AppRevByMe', 'ReviseByMe', 'ReceiptByMe' shall return even documents
* І have already taken care of.
* if 'ExpiredOwner' contains the date in days or as 'yyyy-mm-dd'
* @param string $param3 sort list by this field
* @param string $param4 order direction
* @return array list of documents records
@ -1402,6 +1403,42 @@ class SeedDMS_Core_DMS {
$queryStr = '';
}
break; // }}}
case 'ExpiredOwner': // Documents expired and owned by me {{{
if(is_int($param2)) {
$ts = mktime(0, 0, 0) + $param2 * 86400;
} elseif(is_string($param2)) {
$tmp = explode('-', $param2, 3);
if(count($tmp) != 3)
return false;
$ts = mktime(0, 0, 0, $tmp[1], $tmp[2], $tmp[0]);
} else
$ts = mktime(0, 0, 0)-365*86400; /* Start of today - 1 year */
$tsnow = mktime(0, 0, 0); /* Start of today */
if($ts < $tsnow) { /* Check for docs expired in the past */
$startts = $ts;
$endts = $tsnow+86400; /* Use end of day */
} else { /* Check for docs which will expire in the future */
$startts = $tsnow;
$endts = $ts+86400; /* Use end of day */
}
$queryStr .=
"WHERE `tblDocuments`.`expires` > ".$startts." AND `tblDocuments`.`expires` < ".$endts." ";
$user = $param1;
$orderby = $param3;
if($param4 == 'desc')
$orderdir = 'DESC';
else
$orderdir = 'ASC';
$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;
break; // }}}
case 'WorkflowOwner': // Documents waiting for workflow trigger I'm owning {{{
$queryStr .= "WHERE 1=1 ";