From 8ede764db011c2e71be2f148bfbf073e82035a12 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 2 Aug 2016 10:38:44 +0200 Subject: [PATCH] check if assigned attribute was inherited in that case do not allow to delete it --- .../bootstrap/class.FolderAttributeGroup.php | 47 ++++++++++++------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/views/bootstrap/class.FolderAttributeGroup.php b/views/bootstrap/class.FolderAttributeGroup.php index adece16fd..cb9487f46 100644 --- a/views/bootstrap/class.FolderAttributeGroup.php +++ b/views/bootstrap/class.FolderAttributeGroup.php @@ -70,7 +70,8 @@ $(document).ready(function() { $allGroups = $this->params['allattrgrps']; $strictformcheck = $this->params['strictformcheck']; - $attrgrpList = $folder->getAttributeDefintionGroupList(); + $ifolder = null; // will be set to folder the current folder inherits a attr def group + $attrgrpList = $folder->getAttributeDefintionGroupList(true, $ifolder); $this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName())))); $this->globalNavigation($folder); @@ -88,23 +89,33 @@ $(document).ready(function() { } else { - foreach ($attrgrpList as $attrgrp) { - print ""; - print ""; - print "" . htmlspecialchars($attrgrp['group']->getName()) . ""; - if ($user->isAdmin()) { - print "
\n"; - echo createHiddenFieldWithKey('folderattributegroup')."\n"; - print "getID()."\">\n"; - print "\n"; - print "getID()."\">\n"; - print ""; - print ""; - print ""; - print "
\n"; - }else print ""; - print ""; - $attrgrpIDs[] = $attrgrp['group']->getID(); + if($ifolder->getID() == $folder->getID()) { + foreach ($attrgrpList as $attrgrp) { + print ""; + print ""; + print "" . htmlspecialchars($attrgrp['group']->getName()) . ""; + if ($user->isAdmin()) { + print "
\n"; + echo createHiddenFieldWithKey('folderattributegroup')."\n"; + print "getID()."\">\n"; + print "\n"; + print "getID()."\">\n"; + print ""; + print ""; + print ""; + print "
\n"; + }else print ""; + print ""; + $attrgrpIDs[] = $attrgrp['group']->getID(); + } + } else { + foreach ($attrgrpList as $attrgrp) { + print ""; + print ""; + print "" . htmlspecialchars($attrgrp['group']->getName()) . ""; + print " getID()."\">" . htmlspecialchars($ifolder->getName()) . ""; + print ""; + } } } print "\n";