diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 4c73c9c82..ada63bbe2 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -3392,22 +3392,15 @@ EOF ]; // The list of candidate fields is made of the ordered list of "details" attributes + other attributes - $aAttributes = array(); - foreach ($this->FlattenZList(MetaModel::GetZListItems($sClass, 'details')) as $sAttCode) { - $aAttributes[$sAttCode] = true; - } + // First attributes from the "details" zlist as they were sorted... + $aList = $this->FlattenZList(MetaModel::GetZListItems($sClass, 'details')); + + // ... then append forgotten attributes foreach (MetaModel::GetAttributesList($sClass) as $sAttCode) { - if (!array_key_exists($sAttCode, $aAttributes)) { - $aAttributes[$sAttCode] = true; + if (!in_array($sAttCode, $aList)) { + $aList[] = $sAttCode; } } - // Order the fields based on their dependencies, set the fields for which there is only one possible value - // and perform this in the order of dependencies to avoid dead-ends - $aDeps = array(); - foreach ($aAttributes as $sAttCode => $trash) { - $aDeps[$sAttCode] = MetaModel::GetPrerequisiteAttributes($sClass, $sAttCode); - } - $aList = $this->OrderDependentFields($aDeps); $bExistFieldToDisplay = false; foreach ($aList as $sAttCode) { diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 66606ab69..8d80ff618 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -3621,8 +3621,7 @@ abstract class MetaModel { MyHelpers::CheckKeyInArray('list code', $sListCode, self::$m_aListInfos); - if (!$sTargetClass) - { + if (!$sTargetClass) { $sTargetClass = self::GetCallersPHPClass("Init"); } diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php index 828cf0e04..4df999dff 100644 --- a/setup/compiler.class.inc.php +++ b/setup/compiler.class.inc.php @@ -1540,7 +1540,7 @@ EOF; // $oField $sAttCode = $oField->getAttribute('id'); $sAttType = $oField->getAttribute('xsi:type'); - + $aParameters = $this->CompileAttribute($sAttType, $oField, $sModuleRelativeDir, $sClass, $sAttCode, $sCss, $aTagFieldsInfo, $sTempTargetDir); @@ -1854,20 +1854,16 @@ EOF; $this->aCustomListsCodes[] = $sListCode; } - $sZlists .= "\n" . $this->GeneratePhpCodeForZlist($sListCode, $oListNode); + $sZlists .= "\n".$this->GeneratePhpCodeForZlist($sListCode, $oListNode); } // Methods $oMethods = $oClass->GetUniqueElement('methods'); - foreach($oMethods->getElementsByTagName('method') as $oMethod) - { + foreach ($oMethods->getElementsByTagName('method') as $oMethod) { $sMethodCode = $oMethod->GetChildText('code'); - if ($sMethodComment = $oMethod->GetChildText('comment', null)) - { + if ($sMethodComment = $oMethod->GetChildText('comment', null)) { $sMethods .= "\n\t$sMethodComment\n".$sMethodCode."\n"; - } - else - { + } else { $sMethods .= "\n\n".$sMethodCode."\n"; } }