From 098f15202c7edc0f62390d69b52fcf685886aa55 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 2 Aug 2017 17:30:54 +0200 Subject: [PATCH] add method getProcessWithoutUserGroup() checks for reviews/approvals which have lost its user or group --- SeedDMS_Core/Core/inc.ClassDMS.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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 *