mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 21:21:27 +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';
|
$orderdir = 'DESC';
|
||||||
else
|
else
|
||||||
$orderdir = 'ASC';
|
$orderdir = 'ASC';
|
||||||
$queryStr .= "AND `tblDocumentLocks`.`userID` = '".$user->getID()."' ";
|
|
||||||
if ($orderby=='e') $queryStr .= "ORDER BY `expires`";
|
$qs = 'SELECT `document` FROM `tblDocumentLocks` WHERE `userID`='.$user->getID();
|
||||||
else if ($orderby=='u') $queryStr .= "ORDER BY `statusDate`";
|
$ra = $this->db->getResultArray($qs);
|
||||||
else if ($orderby=='s') $queryStr .= "ORDER BY `status`";
|
if (is_bool($ra) && !$ra) {
|
||||||
else $queryStr .= "ORDER BY `name`";
|
return false;
|
||||||
$queryStr .= " ".$orderdir;
|
}
|
||||||
|
$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; // }}}
|
break; // }}}
|
||||||
case 'WorkflowOwner': // Documents waiting for workflow trigger I'm owning {{{
|
case 'WorkflowOwner': // Documents waiting for workflow trigger I'm owning {{{
|
||||||
$user = $param1;
|
$user = $param1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user