From cad40ed75871f35310157669a7e64cbe90f03341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guy=20Couronn=C3=A9?= Date: Thu, 15 May 2025 16:00:50 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B07799=20-=20:sparkles:=20Allow=20Attribut?= =?UTF-8?q?eSet=20in=20XML=20sample=20file=20(#654)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :sparkles: Allow AttributeSet in XML sample file In XML Data Loader, manage AttributeSet class and its children to be imported , in sample XML files. --- setup/xmldataloader.class.inc.php | 7 ++----- .../unitary-tests/core/XMLDataLoaderTest.php | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/setup/xmldataloader.class.inc.php b/setup/xmldataloader.class.inc.php index c26d5c75e..5b516dcb0 100644 --- a/setup/xmldataloader.class.inc.php +++ b/setup/xmldataloader.class.inc.php @@ -278,10 +278,6 @@ class XMLDataLoader $oDoc = new ormDocument($data, $sMimeType, $sFileName); $oTargetObj->Set($sAttCode, $oDoc); } - elseif ($oAttDef instanceof AttributeTagSet) - { - // TODO - } else { $value = (string)$oSubNode; @@ -289,8 +285,9 @@ class XMLDataLoader if ($value == '') { $value = $oAttDef->GetNullValue(); + } else { + $value = $oAttDef->MakeRealValue($value, $oTargetObj); } - $res = $oTargetObj->CheckValue($sAttCode, $value); if ($res !== true) { diff --git a/tests/php-unit-tests/unitary-tests/core/XMLDataLoaderTest.php b/tests/php-unit-tests/unitary-tests/core/XMLDataLoaderTest.php index 9a2a330fc..bb7ccaf9a 100644 --- a/tests/php-unit-tests/unitary-tests/core/XMLDataLoaderTest.php +++ b/tests/php-unit-tests/unitary-tests/core/XMLDataLoaderTest.php @@ -103,13 +103,27 @@ class XMLDataLoaderTest extends ItopDataTestCase no + + Contact updated + + GUI:Console + class restriction: Contact + allow_no_channel + Contact + SELECT `Person` FROM Person AS `Person` WHERE ((`status` = 'active') AND ((`org_id` = :current_contact->org_id) OR (`org_id` = :this->org_id))) + email,name + TriggerOnObjectUpdate + Contact updated + XML; $this->CreateFromXMLString($sXML); $oPerson = MetaModel::GetObjectByName('Person', 'Zacharie Zmillpatt'); + $oTrigger = MetaModel::GetObjectByName('TriggerOnObjectUpdate', 'Contact updated'); $this->assertEquals('Zanzibar', $oPerson->Get('location_id_friendlyname')); $this->assertEquals('ZuperTest', $oPerson->Get('org_id_friendlyname')); + $this->assertEquals('email, name', (string)$oTrigger->Get('target_attcodes')); // should add space after comma } } \ No newline at end of file