From 1a395f4b50232aabd7ea1fdc3a6a3e3cfc0e5fe1 Mon Sep 17 00:00:00 2001 From: odain-cbd <56586767+odain-cbd@users.noreply.github.com> Date: Fri, 4 Sep 2026 10:07:05 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B010006=20-=20fix=20audit=20display=20in?= =?UTF-8?q?=20case=20of=20no=20fields=20provided=20(#1039)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/tabularbulkexport.class.inc.php | 12 ++++++------ .../unitary-tests/webservices/ExportTest.php | 14 ++++++++++---- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/core/tabularbulkexport.class.inc.php b/core/tabularbulkexport.class.inc.php index 4446d204df..bd797cbccf 100644 --- a/core/tabularbulkexport.class.inc.php +++ b/core/tabularbulkexport.class.inc.php @@ -363,13 +363,13 @@ EOF } } foreach ($aAuthorizedClasses as $sAlias => $sClassName) { - foreach (MetaModel::GetZListItems($sClassName, 'details') as $sAttCode) { - //$oAttDef = Metamodel::GetAttributeDef($sClassName, $sAttCode); - if (utils::IsNullOrEmptyString($sAlias)) { - $aFields[] = "$sAttCode"; - } else { - $aFields[] = "$sAlias.$sAttCode"; + foreach (MetaModel::ListAttributeDefs($sClassName) as $oAttribute) { + $sAttCode = $oAttribute->GetCode(); + if (! $this->IsExportableField($sClassName, $sAttCode, $oAttribute)) { + continue; } + $sCurrentAlias = utils::IsNullOrEmptyString($sAlias) ? "" : "$sAlias."; + $aFields[] = "{$sCurrentAlias}{$sAttCode}"; } } diff --git a/tests/php-unit-tests/unitary-tests/webservices/ExportTest.php b/tests/php-unit-tests/unitary-tests/webservices/ExportTest.php index 4e07a9cc73..4eb5692079 100644 --- a/tests/php-unit-tests/unitary-tests/webservices/ExportTest.php +++ b/tests/php-unit-tests/unitary-tests/webservices/ExportTest.php @@ -56,7 +56,7 @@ HEADER; $sOutput = $this->performExportTesting($aParams, $this->sLogin); $sExpectedHeader = <<
Obsolete","Person->Organization","Person->Organization->Obsolete" HEADER; @@ -85,14 +85,20 @@ HEADER; $sExpectedHeader = <<
Person -Organization +Last name +First name Email +Organization Login Language Status -Profiles -Allowed Organizations log +Type of account +Full name +Person +Person->Obsolete +Person->Organization +Person->Organization->Obsolete HEADER; $this->assertStringContainsString("$sExpectedHeader", $sOutput, "Header ($sExpectedHeader)\n should be in export-v2 answer: \n$sOutput");