From 098f15202c7edc0f62390d69b52fcf685886aa55 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 2 Aug 2017 17:30:54 +0200 Subject: [PATCH 1/3] 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 * From 711114310b3a3aa2bf158600a188fa03d913e130 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 2 Aug 2017 17:31:39 +0200 Subject: [PATCH 2/3] list reviews/approvals which have lost their user/group --- out/out.ObjectCheck.php | 6 +++++ views/bootstrap/class.ObjectCheck.php | 32 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/out/out.ObjectCheck.php b/out/out.ObjectCheck.php index 2de030244..e9251dfab 100644 --- a/out/out.ObjectCheck.php +++ b/out/out.ObjectCheck.php @@ -64,6 +64,11 @@ $unlinkeddocuments = $dms->checkDocuments(); $nofilesizeversions = $dms->getNoFileSizeDocumentContent(); $nochecksumversions = $dms->getNoChecksumDocumentContent(); $duplicateversions = $dms->getDuplicateDocumentContent(); +foreach(array('review', 'approval') as $process) { + foreach(array('user', 'group') as $ug) { + $processwithoutusergroup[$process][$ug] = $dms->getProcessWithoutUserGroup($process, $ug); + } +} $rootfolder = $dms->getFolder($settings->_rootFolderID); if($view) { @@ -74,6 +79,7 @@ if($view) { $view->setParam('nofilesizeversions', $nofilesizeversions); $view->setParam('nochecksumversions', $nochecksumversions); $view->setParam('duplicateversions', $duplicateversions); + $view->setParam('processwithoutusergroup', $processwithoutusergroup); $view->setParam('unlink', $unlink); $view->setParam('setfilesize', $setfilesize); $view->setParam('setchecksum', $setchecksum); diff --git a/views/bootstrap/class.ObjectCheck.php b/views/bootstrap/class.ObjectCheck.php index 96b8fbb3c..f5e64b2a6 100644 --- a/views/bootstrap/class.ObjectCheck.php +++ b/views/bootstrap/class.ObjectCheck.php @@ -205,6 +205,7 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Bootstrap_Style { $nofilesizeversions = $this->params['nofilesizeversions']; $nochecksumversions = $this->params['nochecksumversions']; $duplicateversions = $this->params['duplicateversions']; + $processwithoutusergroup = $this->params['processwithoutusergroup']; $repair = $this->params['repair']; $unlink = $this->params['unlink']; $setfilesize = $this->params['setfilesize']; @@ -407,6 +408,37 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Bootstrap_Style { print "\n"; } + $this->contentContainerEnd(); + + $this->contentHeading(getMLText("process_without_user_group")); + $this->contentContainerStart(); + + if($processwithoutusergroup) { + print ""; + print "\n\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n\n\n"; + foreach(array('review', 'approval') as $process) { + foreach(array('user', 'group') as $ug) { + if($processwithoutusergroup[$process][$ug]) { + foreach($processwithoutusergroup[$process][$ug] as $rec) { + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + } + } + } + } + print "
".getMLText("process")."".getMLText("user_group")."".getMLText("documentid")."".getMLText("version")."".getMLText("required")."
".$process."".$ug."".$rec['documentID']."".$rec['version']."".$rec['name']."".$rec['required']."
\n"; + } + $this->contentContainerEnd(); $this->contentEnd(); $this->htmlEndPage(); From 141895b80d206e6169e70c9995e966ef16906fdf Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 2 Aug 2017 17:40:27 +0200 Subject: [PATCH 3/3] quote names in sql statements of getProcessesWithoutUserGroup() --- SeedDMS_Core/Core/inc.ClassDMS.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 6ebabeb3a..b8d1433d7 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -2137,19 +2137,19 @@ class SeedDMS_Core_DMS { function getProcessWithoutUserGroup($process, $usergroup) { /* {{{ */ switch($process) { case 'review': - $queryStr = "SELECT a.*, b.name FROM tblDocumentReviewers"; + $queryStr = "SELECT a.*, b.`name` FROM `tblDocumentReviewers`"; break; case 'approval': - $queryStr = "SELECT a.*, b.name FROM tblDocumentApprovers"; + $queryStr = "SELECT a.*, b.`name` FROM `tblDocumentApprovers`"; break; } - $queryStr .= " a LEFT JOIN tblDocuments b ON a.documentID=b.id where"; + $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"; + $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"; + $queryStr .= " a.`type`=1 and a.`required` not in (select `id` from `tblGroups`) ORDER by b.`id`"; break; } return $this->db->getResultArray($queryStr);