diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index f7fb9cfca..bab01ecaf 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -2191,6 +2191,34 @@ class SeedDMS_Core_DMS { } /* }}} */ + /** + * Returns a list of reviews, approvals which are not linked + * to a user, group anymore + * + * This method is for finding reviews or approvals whose user + * or group was deleted and not just removed from the process. + */ + function getProcessWithoutUserGroup($process, $usergroup) { /* {{{ */ + switch($process) { + case 'review': + $queryStr = "SELECT a.*, b.name FROM tblDocumentReviewers"; + break; + case 'approval': + $queryStr = "SELECT a.*, b.name FROM tblDocumentApprovers"; + break; + } + $queryStr .= " a LEFT JOIN tblDocuments b ON a.documentID=b.id where"; + switch($usergroup) { + case 'user': + $queryStr .= " a.type=0 and a.required not in (select id from tblUsers) ORDER by b.id"; + break; + case 'group': + $queryStr .= " a.type=1 and a.required not in (select id from tblGroups) ORDER by b.id"; + break; + } + return $this->db->getResultArray($queryStr); + } /* }}} */ + /** * Returns statitical information *