From 6d7bcb8a7c77cabfdb3b2e3774b45e75aee50924 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Tue, 18 May 2021 17:57:30 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B03956=20-=20Fix=20AJAX=20error=20when=20c?= =?UTF-8?q?reating=20an=20object=20which=20has=20a=20linkedset=20with=20a?= =?UTF-8?q?=20friendlyname=20composed=20of=20its=20own=20external=20keys'?= =?UTF-8?q?=20friendlynames=20=F0=9F=A4=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/uiwizard.class.inc.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/application/uiwizard.class.inc.php b/application/uiwizard.class.inc.php index 533b73bbb..b52b71a71 100644 --- a/application/uiwizard.class.inc.php +++ b/application/uiwizard.class.inc.php @@ -270,23 +270,20 @@ $sJSHandlerCode $aFields = array(); // reset foreach(MetaModel::ListAttributeDefs($this->m_sClass) as $sAttCode=>$oAttDef) { - $iOptions = (isset($aStates[$this->m_sTargetState]['attribute_list'][$sAttCode])) ? $aStates[$this->m_sTargetState]['attribute_list'][$sAttCode] : 0; - if ( ($sStateAttCode != $sAttCode) && - (!$oAttDef->IsExternalField()) && - (($iOptions & (OPT_ATT_HIDDEN | OPT_ATT_READONLY)) == 0) && - (!isset($aFieldsDone[$sAttCode])) ) - - { - // 'State', external fields, read-only and hidden fields + $iOptions = (isset($aStates[$this->m_sTargetState]['attribute_list'][$sAttCode])) ? $aStates[$this->m_sTargetState]['attribute_list'][$sAttCode] : 0; + if (($sStateAttCode != $sAttCode) && + (!$oAttDef->IsExternalField()) && + ($oAttDef->IsWritable()) && + (($iOptions & (OPT_ATT_HIDDEN | OPT_ATT_READONLY)) == 0) && + (!isset($aFieldsDone[$sAttCode]))) { + // 'State', external fields, read-only (both because of the flags or the attribute type) and hidden fields // and fields that are already listed in the wizard // are removed from the 'optional' part of the wizard $oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode); $aPrerequisites = $oAttDef->GetPrerequisiteAttributes(); $aFields[$sAttCode] = array(); - foreach($aPrerequisites as $sCode) - { - if (!isset($aFieldsDone[$sCode])) - { + foreach ($aPrerequisites as $sCode) { + if (!isset($aFieldsDone[$sCode])) { // retain only the dependencies that were not covered // in the 'mandatory' part of the wizard $aFields[$sAttCode][$sCode] = '';