fix: export attributetags as Tag elements (like eventtags)

pull/1857/head
Andreas Ziegler 2016-09-29 16:53:04 +02:00
parent 67488923ac
commit 0e3fc2192e
3 changed files with 21 additions and 0 deletions

View File

@ -39,6 +39,13 @@ class JSONConverterTool {
$ra = array('Attribute' => $ra);
}
}
if (isset($event['Event']['Attribute'][$key]['AttributeTag'])) {
foreach ($event['Event']['Attribute'][$key]['AttributeTag'] as $atk => $tag) {
unset($tag['Tag']['org_id']);
$event['Event']['Attribute'][$key]['Tag'][$atk] = $tag['Tag'];
}
unset($event['Event']['Attribute'][$key]['AttributeTag']);
}
}
}
unset($event['Event']['RelatedAttribute']);

View File

@ -115,6 +115,13 @@ class XMLConverterTool {
$event['Event']['Attribute'][$key]['SharingGroup'][0] = $event['Event']['Attribute'][$key]['SharingGroup'];
unset($event['Event']['Attribute'][$key]['SharingGroup']);
}
if (isset($event['Event']['Attribute'][$key]['AttributeTag'])) {
foreach ($event['Event']['Attribute'][$key]['AttributeTag'] as $atk => $tag) {
unset($tag['Tag']['org_id']);
$event['Event']['Attribute'][$key]['Tag'][$atk] = $tag['Tag'];
}
unset($event['Event']['Attribute'][$key]['AttributeTag']);
}
}
}
unset($event['Event']['RelatedAttribute']);

View File

@ -1333,6 +1333,13 @@ class Event extends AppModel {
}
}
}
// unset empty attribute tags that got added because the tag wasn't exportable
if (!empty($attribute['AttributeTag'])) {
foreach ($attribute['AttributeTag'] as $atk => $attributeTag) {
if (empty($attributeTag['Tag'])) unset($attribute['AttributeTag'][$atk]);
}
$event['AttributeTag'] = array_values($attribute['AttributeTag']);
}
$attribute['ShadowAttribute'] = array();
// If a shadowattribute can be linked to an attribute, link it to it then remove it from the event
// This is to differentiate between proposals that were made to an attribute for modification and between proposals for new attributes