From ab72673379f344ec7cd9637a96aa4a1a77a91ca3 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 13 Mar 2023 10:24:53 +0100 Subject: [PATCH] do not show menu item if document may not be checked in --- views/bootstrap/class.Bootstrap.php | 8 +++++--- views/bootstrap4/class.Bootstrap4.php | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index c03548cac..66d3e07f6 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -812,9 +812,11 @@ background-image: linear-gradient(to bottom, #882222, #111111);; $menuitems['update_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.UpdateDocument".$docid, 'label'=>getMLText('update_document')); if($accessobject->check_controller_access('LockDocument')) $menuitems['lock_document'] = array('link'=>$this->params['settings']->_httpRoot."op/op.LockDocument".$docid."&formtoken=".createFormKey('lockdocument'), 'label'=>getMLText('lock_document')); - if($document->isCheckedOut()) - $menuitems['checkin_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.CheckInDocument".$docid, 'label'=>getMLText('checkin_document')); - else { + if($document->isCheckedOut()) { + if($accessobject->mayCheckIn($document)) { + $menuitems['checkin_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.CheckInDocument".$docid, 'label'=>getMLText('checkin_document')); + } + } else { if($this->params['checkoutdir']) { $menuitems['checkout_document'] = array('link'=>$this->params['settings']->_httpRoot."op/op.CheckOutDocument".$docid, 'label'=>getMLText('checkout_document')); } diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index e2248acd3..6713ddf13 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -733,9 +733,11 @@ background-image: linear-gradient(to bottom, #882222, #111111);; $menuitems['update_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.UpdateDocument".$docid, 'label'=>getMLText('update_document')); if($accessobject->check_controller_access('LockDocument')) $menuitems['lock_document'] = array('link'=>$this->params['settings']->_httpRoot."op/op.LockDocument".$docid."&formtoken=".createFormKey('lockdocument'), 'label'=>getMLText('lock_document')); - if($document->isCheckedOut()) - $menuitems['checkin_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.CheckInDocument".$docid, 'label'=>getMLText('checkin_document')); - else { + if($document->isCheckedOut()) { + if($accessobject->mayCheckIn($document)) { + $menuitems['checkin_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.CheckInDocument".$docid, 'label'=>getMLText('checkin_document')); + } + } else { if($this->params['checkoutdir']) { $menuitems['checkout_document'] = array('link'=>$this->params['settings']->_httpRoot."op/op.CheckOutDocument".$docid, 'label'=>getMLText('checkout_document')); }