From 95aa4afe755cb0e79e852e456b2b53e212fadd22 Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Mon, 30 Oct 2023 16:28:57 +0100 Subject: [PATCH] =?UTF-8?q?=20N=C2=B06385=20-=20Allow=20to=20disable=20Lin?= =?UTF-8?q?kedSet=20(1:n=20&=20n:n)=20edition=20by=20XML=20in=20host=20edi?= =?UTF-8?q?tion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/cmdbabstract.class.inc.php | 6 +++++- .../UI/Links/Indirect/BlockIndirectLinkSetEditTable.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 9d0e595d9..d871105da 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -744,7 +744,11 @@ HTML $oPage->SetCurrentTab($sTabCode, $oAttDef->GetLabel().$sCount, $sTabDescription); $aArgs = array('this' => $this); - $bReadOnly = ($iFlags & (OPT_ATT_READONLY | OPT_ATT_SLAVE)); + + $sEditWhen = $oAttDef->GetEditWhen(); + $bIsEditableBasedOnEditWhen = ($sEditWhen === LINKSET_EDITWHEN_ALWAYS || $sEditWhen === LINKSET_EDITWHEN_ON_HOST_EDITION); + + $bReadOnly = ($iFlags & (OPT_ATT_READONLY | OPT_ATT_SLAVE)) || !$bIsEditableBasedOnEditWhen; if ($bEditMode && (!$bReadOnly)) { $sInputId = $this->m_iFormId.'_'.$sAttCode; $sDisplayValue = ''; // not used diff --git a/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php b/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php index 36e6bc359..b15995c20 100644 --- a/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php +++ b/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php @@ -281,7 +281,7 @@ EOF if ($bReadOnly) { $aRow['form::checkbox'] = ""; - foreach ($this->m_aEditableFields as $sFieldCode) { + foreach ($this->oUILinksWidget->GetEditableFields() as $sFieldCode) { $sDisplayValue = $linkObjOrId->GetEditValue($sFieldCode); $aRow[$sFieldCode] = $sDisplayValue; } @@ -435,7 +435,7 @@ JS $oAttDef = MetaModel::GetAttributeDef($this->oUILinksWidget->GetLinkedClass(), $sFieldCode); if ($bReadOnlyField) { - $sFieldForHtml = $sDisplayValue; + $sFieldForHtml = $oAttDef->GetAsHTML($sValue); } else { $sFieldForHtml = cmdbAbstractObject::GetFormElementForField( $oP,