From 42ade7e1bed89f06ceb48642ca5f32394a067e9e Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Thu, 9 Jul 2026 15:37:52 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B09617=20-=20Send=20EVENT=20on=20data=20ex?= =?UTF-8?q?port=20for=20traceability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/cmdbabstract.class.inc.php | 5 ++--- application/datamodel.application.xml | 6 +++++- core/csvbulkexport.class.inc.php | 2 +- core/dbobject.class.php | 2 +- core/excelbulkexport.class.inc.php | 2 +- core/htmlbulkexport.class.inc.php | 2 +- core/restservices.class.inc.php | 4 ++-- core/spreadsheetbulkexport.class.inc.php | 4 ++-- core/trigger.class.inc.php | 5 +++++ core/xmlbulkexport.class.inc.php | 2 +- 10 files changed, 21 insertions(+), 13 deletions(-) diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 82fa3a0761..2fef1f1e83 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -5391,10 +5391,9 @@ JS * @throws \CoreException * @since 3.3.0 */ - final public function FireEventReadDetails(): void + final public function FireEventReadDetails(string $sExportType): void { - - $this->FireEvent(EVENT_DB_TRACEABILITY); + $this->FireEvent(EVENT_DATA_EXPORT, ['export_type' => $sExportType]); } ////////////// diff --git a/application/datamodel.application.xml b/application/datamodel.application.xml index 01ff1cde9a..f249ecc658 100644 --- a/application/datamodel.application.xml +++ b/application/datamodel.application.xml @@ -531,9 +531,13 @@ Call $this->AddInitialAttributeFlags($sAttCode, $iFlags) for all the initial att DBObject - Attribute codes exposed (empty means all attributes) + Attribute codes exposed (empty means potentially all attributes) array + + Type of export + string + Debug string string diff --git a/core/csvbulkexport.class.inc.php b/core/csvbulkexport.class.inc.php index ae9cd9eb5c..3eb7adf01f 100644 --- a/core/csvbulkexport.class.inc.php +++ b/core/csvbulkexport.class.inc.php @@ -340,7 +340,7 @@ EOF $sField = ''; $oObj = $aRow[$sAlias]; - $oObj->FireEventReadDetails(); + $oObj->FireEventReadDetails(get_class($this)); if ($oObj != null) { switch ($sAttCode) { case 'id': diff --git a/core/dbobject.class.php b/core/dbobject.class.php index 1d1a24a1f9..5d144b7dc9 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -6266,7 +6266,7 @@ abstract class DBObject implements iDisplay * @return void * @since 3.3.0 */ - public function FireEventReadDetails(): void + public function FireEventReadDetails(string $sExportType): void { } diff --git a/core/excelbulkexport.class.inc.php b/core/excelbulkexport.class.inc.php index 7987603f98..4d12c67c65 100644 --- a/core/excelbulkexport.class.inc.php +++ b/core/excelbulkexport.class.inc.php @@ -293,7 +293,7 @@ EOF $sAttCode = $aFieldSpec['sAttCode']; $oObj = $aRow[$sAlias]; - $oObj->FireEventReadDetails(); + $oObj->FireEventReadDetails(get_class($this)); $sField = ''; if ($oObj) { $sField = $this->GetValue($oObj, $sAttCode); diff --git a/core/htmlbulkexport.class.inc.php b/core/htmlbulkexport.class.inc.php index 0c5a1c92a0..29f3deede9 100644 --- a/core/htmlbulkexport.class.inc.php +++ b/core/htmlbulkexport.class.inc.php @@ -144,7 +144,7 @@ class HTMLBulkExport extends TabularBulkExport $sAttCode = $aFieldSpec['sAttCode']; $oObj = $aRow[$sAlias]; - $oObj->FireEventReadDetails(); + $oObj->FireEventReadDetails(get_class($this)); $sField = ''; if ($oObj) { $sField = $this->GetValue($oObj, $sAttCode); diff --git a/core/restservices.class.inc.php b/core/restservices.class.inc.php index 243c1732a4..3bef6d48d0 100644 --- a/core/restservices.class.inc.php +++ b/core/restservices.class.inc.php @@ -625,7 +625,7 @@ class CoreServices implements iRestServiceProvider, iRestInputSanitizer } while ($oObject = $oObjectSet->Fetch()) { - $oObject->FireEventReadDetails(); + $oObject->FireEventReadDetails(ContextTag::TAG_REST); $oResult->AddObject(0, '', $oObject, $aShowFields, RestUtils::HasRequestedExtendedOutput($sShowFields)); } $oResult->message = "Found: ".$oObjectSet->Count(); @@ -700,7 +700,7 @@ class CoreServices implements iRestServiceProvider, iRestInputSanitizer if ($oElement instanceof RelationObjectNode) { $oObject = $oElement->GetProperty('object'); if ($oObject) { - $oObject->FireEventReadDetails(); + $oObject->FireEventReadDetails(get_class($this)); if ($bEnableRedundancy && $sDirection == 'down') { // Add only the "reached" objects if ($oElement->GetProperty('is_reached')) { diff --git a/core/spreadsheetbulkexport.class.inc.php b/core/spreadsheetbulkexport.class.inc.php index 664bf16baa..4222285abb 100644 --- a/core/spreadsheetbulkexport.class.inc.php +++ b/core/spreadsheetbulkexport.class.inc.php @@ -253,18 +253,18 @@ EOF set_time_limit(intval($iLoopTimeLimit)); $sData .= ""; - foreach ($this->aStatusInfo['fields'] as $iCol => $aFieldSpec) { + foreach ($this->aStatusInfo['fields'] as $aFieldSpec) { $sAlias = $aFieldSpec['sAlias']; $sAttCode = $aFieldSpec['sAttCode']; $sField = ''; /** @var \DBObject $oObj */ $oObj = $aRow[$sAlias]; - $oObj->FireEventReadDetails(); if ($oObj == null) { $sData .= ""; continue; } + $oObj->FireEventReadDetails(get_class($this)); switch ($sAttCode) { case 'id': diff --git a/core/trigger.class.inc.php b/core/trigger.class.inc.php index fdd816e371..232adc9791 100644 --- a/core/trigger.class.inc.php +++ b/core/trigger.class.inc.php @@ -135,6 +135,11 @@ abstract class Trigger extends cmdbAbstractObject if ($oAction->IsActive()) { $oKPI = new ExecutionKPI(); $aContextArgs['action->object()'] = $oAction; + if (array_key_exists('this->object()', $aContextArgs)) { + /** @var \DBObject $oObject */ + $oObject = $aContextArgs['this->object()']; + $oObject->FireEventReadDetails(get_class($oAction)); + } $oAction->DoExecute($this, $aContextArgs); $oKPI->ComputeStatsForExtension($oAction, 'DoExecute'); } diff --git a/core/xmlbulkexport.class.inc.php b/core/xmlbulkexport.class.inc.php index c361b1d867..fa2b26ecf4 100644 --- a/core/xmlbulkexport.class.inc.php +++ b/core/xmlbulkexport.class.inc.php @@ -146,7 +146,7 @@ class XMLBulkExport extends BulkExport } foreach ($aAuthorizedClasses as $sAlias => $sClassName) { $oObj = $aObjects[$sAlias]; - $oObj->FireEventReadDetails(); + $oObj->FireEventReadDetails(get_class($this)); if (is_null($oObj)) { $sData .= "<$sClassName alias=\"$sAlias\" id=\"null\">\n"; } else {