N°3213 - Order transition attributes like in the "details" zlist instead of reordering them regarding the dependencies (#306)

N°3213 - Order transition attributes like in the "details" zlist instead of reordering them regarding the dependencies (#306)

---------

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
This commit is contained in:
Anne-Catherine
2023-06-08 17:29:53 +02:00
committed by GitHub
parent 99e84e86cd
commit cc8c6ac027
3 changed files with 12 additions and 24 deletions

View File

@@ -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) {

View File

@@ -3621,8 +3621,7 @@ abstract class MetaModel
{
MyHelpers::CheckKeyInArray('list code', $sListCode, self::$m_aListInfos);
if (!$sTargetClass)
{
if (!$sTargetClass) {
$sTargetClass = self::GetCallersPHPClass("Init");
}

View File

@@ -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";
}
}