From fb37e526cc491eed9c9e26a24561490b87ea59c8 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 6 Feb 2024 10:29:23 +0100 Subject: [PATCH] separated revisions without access from disabled users --- CHANGELOG | 3 ++- out/out.ObjectCheck.php | 22 ++++++++++++------ views/bootstrap/class.ObjectCheck.php | 32 ++++++++++++++++++++++++--- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 796e989ca..99c278ec5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,7 +2,8 @@ Changes in version 6.0.27 -------------------------------------------------------------------------------- - Document/folder check distinguishes between documents which cannot be - receiped because of access rights or the recipient being disabled. + receiped/revised because of access rights or the recipient/revisor being + disabled. -------------------------------------------------------------------------------- Changes in version 6.0.26 diff --git a/out/out.ObjectCheck.php b/out/out.ObjectCheck.php index 0df6e70a3..6011492a5 100644 --- a/out/out.ObjectCheck.php +++ b/out/out.ObjectCheck.php @@ -112,9 +112,10 @@ foreach(array('review', 'approval', 'receipt', 'revision') as $process) { } } } -$docsinrevision = array(); +$docsinrevisionnoaccess = array(); +$docsinrevisiondisabled = array(); $docsmissingrevsiondate = array(); -if(!isset($_GET['action']) || $_GET['action'] == 'listDocsWithMissingRevisionDate') { +if(!isset($_GET['action']) || $_GET['action'] == 'listDocsWithMissingRevisionDate' || $_GET['action'] == 'listDocsInRevisionNoAccess' || $_GET['action'] == 'listDocsInRevisionDisabled') { $tmprevs = $dms->getDocumentsInRevision(); foreach($tmprevs as $rev) { if($doc = $dms->getDocument($rev['documentID'])) { @@ -133,8 +134,10 @@ foreach($tmprevs as $rev) { /* Caution: $content->getAccessMode($ruser) doesn't work as it uses the role * restrictions of the currently logged in user */ - if($mode < M_READ || $cmode < M_READ || $isdisabled) - $docsinrevision[] = $doc; + if($mode < M_READ || $cmode < M_READ) + $docsinrevisionnoaccess[$doc->getId()] = $doc; + if($isdisabled) + $docsinrevisiondisabled[$doc->getId()] = $doc; /* If a document has a sleeping revisor then it must have a * revision date, otherwise the revision will never be started. @@ -168,10 +171,14 @@ foreach($tmprevs as $rev) { /* Caution: $content->getAccessMode($ruser) doesn't work as it uses the role * restrictions of the currently logged in user */ + /* A document can appear several times in the list if there are more than + * 1 user without access. Using the document id as an index will create a + * unique list of documents. + */ if($mode < M_READ || $cmode < M_READ) - $docsinreceptionnoaccess[] = $doc; + $docsinreceptionnoaccess[$doc->getId()] = $doc; if($isdisabled) - $docsinreceptiondisabled[] = $doc; + $docsinreceptiondisabled[$doc->getId()] = $doc; } } } @@ -249,7 +256,8 @@ if($view) { $view->setParam('wrongfiletypeversions', $wrongfiletypeversions); $view->setParam('duplicateversions', $duplicateversions); $view->setParam('duplicatesequences', $duplicatesequences); - $view->setParam('docsinrevision', $docsinrevision); + $view->setParam('docsinrevisionnoaccess', $docsinrevisionnoaccess); + $view->setParam('docsinrevisiondisabled', $docsinrevisiondisabled); $view->setParam('docsmissingrevsiondate', $docsmissingrevsiondate); $view->setParam('docsinreceptionnoaccess', $docsinreceptionnoaccess); $view->setParam('docsinreceptiondisabled', $docsinreceptiondisabled); diff --git a/views/bootstrap/class.ObjectCheck.php b/views/bootstrap/class.ObjectCheck.php index 2f075e32e..d43496816 100644 --- a/views/bootstrap/class.ObjectCheck.php +++ b/views/bootstrap/class.ObjectCheck.php @@ -474,7 +474,7 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Theme_Style { $dms = $this->params['dms']; $user = $this->params['user']; $folder = $this->params['folder']; - $docsinrevision = $this->params['docsinrevision']; + $docsinrevision = $this->params['docsinrevisionnoaccess']; $conversionmgr = $this->params['conversionmgr']; $cachedir = $this->params['cachedir']; $previewwidth = $this->params['previewWidthList']; @@ -494,6 +494,30 @@ class SeedDMS_View_ObjectCheck extends SeedDMS_Theme_Style { } } /* }}} */ + function listDocsInRevisionDisabled() { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; + $folder = $this->params['folder']; + $docsinrevision = $this->params['docsinrevisiondisabled']; + $conversionmgr = $this->params['conversionmgr']; + $cachedir = $this->params['cachedir']; + $previewwidth = $this->params['previewWidthList']; + $previewconverters = $this->params['previewConverters']; + $timeout = $this->params['timeout']; + + $previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout); + if($conversionmgr) + $previewer->setConversionMgr($conversionmgr); + else + $previewer->setConverters($previewconverters); + + $this->contentHeading(getMLText("docs_in_revision_disabled")); + + if($docsinrevision) { + $this->printList($docsinrevision, $previewer); + } + } /* }}} */ + function listDocsWithMissingRevisionDate() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; @@ -698,7 +722,8 @@ $(document).ready( function() { $nochecksumversions = $this->params['nochecksumversions']; $duplicateversions = $this->params['duplicateversions']; $duplicatesequences = $this->params['duplicatesequences']; - $docsinrevision = $this->params['docsinrevision']; + $docsinrevisionnoaccess = $this->params['docsinrevisionnoaccess']; + $docsinrevisiondisabled = $this->params['docsinrevisiondisabled']; $docsinreceptionnoaccess = $this->params['docsinreceptionnoaccess']; $docsinreceptiondisabled = $this->params['docsinreceptiondisabled']; $processwithoutusergroup = $this->params['processwithoutusergroup']; @@ -734,7 +759,8 @@ $(document).ready( function() { $menuitems = []; $menuitems[] = array('label'=>getMLText('duplicate_content'), 'badge'=>count($duplicateversions), 'attributes'=>array(array('data-href', "#duplicate_content"), array('data-action', "listDuplicateContent"))); $menuitems[] = array('label'=>getMLText('duplicate_sequences'), 'badge'=>count($duplicatesequences), 'attributes'=>array(array('data-href', "#duplicate_sequences"), array('data-action', "listDuplicateSequence"))); - $menuitems[] = array('label'=>getMLText('docs_in_revision_no_access'), 'badge'=>count($docsinrevision), 'attributes'=>array(array('data-href', "#inrevision_no_access"), array('data-action', "listDocsInRevisionNoAccess"))); + $menuitems[] = array('label'=>getMLText('docs_in_revision_no_access'), 'badge'=>count($docsinrevisionnoaccess), 'attributes'=>array(array('data-href', "#inrevision_no_access"), array('data-action', "listDocsInRevisionNoAccess"))); + $menuitems[] = array('label'=>getMLText('docs_in_revision_disabled'), 'badge'=>count($docsinrevisiondisabled), 'attributes'=>array(array('data-href', "#inrevision_disabled"), array('data-action', "listDocsInRevisionDisabled"))); $menuitems[] = array('label'=>getMLText('docs_in_reception_no_access'), 'badge'=>count($docsinreceptionnoaccess), 'attributes'=>array(array('data-href', "#inreception_no_access"), array('data-action', "listDocsInReceptionNoAccess"))); $menuitems[] = array('label'=>getMLText('docs_in_reception_disabled'), 'badge'=>count($docsinreceptiondisabled), 'attributes'=>array(array('data-href', "#inreception_disabled"), array('data-action', "listDocsInReceptionDisabled"))); $menuitems[] = array('label'=>getMLText('docs_with_missing_revision_date'), 'badge'=>count($docsmissingrevsiondate), 'attributes'=>array(array('data-href', "#missing_revision_date"), array('data-action', "listDocsWithMissingRevisionDate")));