mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
optimize sql code to get locked documents
This commit is contained in:
parent
da5dc944e7
commit
3a615b6e06
|
@ -1106,12 +1106,27 @@ class SeedDMS_Core_DMS {
|
|||
$orderdir = 'DESC';
|
||||
else
|
||||
$orderdir = 'ASC';
|
||||
$queryStr .= "AND `tblDocumentLocks`.`userID` = '".$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;
|
||||
|
||||
$qs = 'SELECT `document` FROM `tblDocumentLocks` WHERE `userID`='.$user->getID();
|
||||
$ra = $this->db->getResultArray($qs);
|
||||
if (is_bool($ra) && !$ra) {
|
||||
return false;
|
||||
}
|
||||
$docs = array();
|
||||
foreach($ra as $d) {
|
||||
$docs[] = $d['document'];
|
||||
}
|
||||
|
||||
if ($docs) {
|
||||
$queryStr .= "AND `tblDocuments`.`id` IN (" . implode(',', $docs) . ") ";
|
||||
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 'WorkflowOwner': // Documents waiting for workflow trigger I'm owning {{{
|
||||
$user = $param1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user