fix: remove sharing groups from json output if empty

pull/2128/head
iglocska 2017-04-07 16:51:37 +02:00
parent a68ff5da1a
commit dadd9b3c81
1 changed files with 6 additions and 0 deletions

View File

@ -16,6 +16,9 @@ class JSONConverterTool {
$event['Event'][$object] = $event[$object];
unset($event[$object]);
}
if ($object == 'SharingGroup' && isset($event['Event']['SharingGroup']) && empty($event['Event']['SharingGroup'])) {
unset($event['Event']['SharingGroup']);
}
}
if (isset($event['EventTag'])) {
@ -39,6 +42,9 @@ class JSONConverterTool {
if (isset($event['Event']['Attribute'])) {
// remove value1 and value2 from the output and remove invalid utf8 characters for the xml parser
foreach ($event['Event']['Attribute'] as $key => $value) {
if (isset($value['SharingGroup']) && empty($value['SharingGroup'])) {
unset($event['Event']['Attribute'][$k]['SharingGroup']);
}
unset($event['Event']['Attribute'][$key]['value1']);
unset($event['Event']['Attribute'][$key]['value2']);
unset($event['Event']['Attribute'][$key]['category_order']);