From 7fc46fbc5053a1f53bf3d9f6960cff6404d3f552 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Tue, 27 Jun 2023 10:36:13 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B06472=20-=20Fix=20empty=20tables=20in=20"?= =?UTF-8?q?Progress"=20tab=20of=20a=20survey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataTable/DataTableUIBlockFactory.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sources/Application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php b/sources/Application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php index c4aabc789..eebee8983 100644 --- a/sources/Application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php +++ b/sources/Application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php @@ -322,7 +322,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory $aExtraFields[$sClassAlias][] = $sAttCode; } } else { - $aExtraFields['*'] = $sAttCode; + $aExtraFields['*'][] = $sFieldName; } } @@ -335,11 +335,21 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory } } foreach ($aAuthorizedClasses as $sAlias => $sClassName) { - if (array_key_exists($sAlias, $aExtraFields)) { + // In case there is only 1 "alias" for the extra fields and it is the fallback ("*"), then consider that all fields are for the current alias. + // This is for the particular use case when the zlist is set to false and extra fields are specified. + if ( (count($aExtraFields) === 1) && (array_keys($aExtraFields)[0] === '*') ) { + $aLists[$sAlias] = $aExtraFields['*']; + } + // Regular use case, dispatch fields to their corresponding aliases + else if (array_key_exists($sAlias, $aExtraFields)) { $aLists[$sAlias] = $aExtraFields[$sAlias]; - } else { + } + // Finally, if unknown alias, ignore fields + else { $aLists[$sAlias] = array(); } + + // If zlist specified, merge its fields with the currently present if ($sZListName !== false) { $aDefaultList = MetaModel::FlattenZList(MetaModel::GetZListItems($sClassName, $sZListName)); $aLists[$sAlias] = array_merge($aDefaultList, $aLists[$sAlias]);