Skip to content

Commit

Permalink
explode user fields in csv
Browse files Browse the repository at this point in the history
  • Loading branch information
lrealdi committed Jun 21, 2017
1 parent e12cb6f commit b697c89
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions classes/exportas/SearchQueryCSVExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ protected function csvHeader($field)
$this->classFields[$field['identifier']] = $header;
}
break;

case 'ezuser': {
$header = array('username','email');
$this->classFields[$field['identifier']] = $header;
}
break;
}

return $header;
Expand Down Expand Up @@ -197,17 +203,23 @@ function transformItem($item)
}
break;

case 'ezuser': {
$stringData[$key] = $field['content']['login'] . '|' . $field['content']['email'];
}
break;

case 'ezobjectrelation':
case 'ezobjectrelationlist': {
$stringData[$key] = $converter->toCSVString($field['content'], $this->language);
}
break;

case 'ezuser': {
foreach ($this->classFields[$identifier] as $columnIdentifier) {
if ($columnIdentifier == 'username'){
$stringData[$key . '.' . $columnIdentifier] = $field['content']['login'];
}elseif ($columnIdentifier == 'email'){
$stringData[$key . '.' . $columnIdentifier] = $field['content']['email'];
}
}
}
break;

default: {
$stringData[$key] = $converter->toCSVString($field['content']);
}
Expand Down

0 comments on commit b697c89

Please sign in to comment.