mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
N°7799 - ✨ Allow AttributeSet in XML sample file (#654)
* ✨ Allow AttributeSet in XML sample file
In XML Data Loader, manage AttributeSet class and its children to be imported , in sample XML files.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -103,13 +103,27 @@ class XMLDataLoaderTest extends ItopDataTestCase
|
||||
<obsolescence_flag>no</obsolescence_flag>
|
||||
<obsolescence_date></obsolescence_date>
|
||||
</Person>
|
||||
<TriggerOnObjectUpdate alias="TriggerOnObjectUpdate" id="4">
|
||||
<description>Contact updated</description>
|
||||
<action_list></action_list>
|
||||
<context>GUI:Console</context>
|
||||
<complement>class restriction: Contact</complement>
|
||||
<subscription_policy>allow_no_channel</subscription_policy>
|
||||
<target_class>Contact</target_class>
|
||||
<filter>SELECT `Person` FROM Person AS `Person` WHERE ((`status` = 'active') AND ((`org_id` = :current_contact->org_id) OR (`org_id` = :this->org_id)))</filter>
|
||||
<target_attcodes>email,name</target_attcodes>
|
||||
<finalclass>TriggerOnObjectUpdate</finalclass>
|
||||
<friendlyname>Contact updated</friendlyname>
|
||||
</TriggerOnObjectUpdate>
|
||||
</Set>
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user