Skip to content

Commit

Permalink
fix: merge submissions field names in case of some fields have been a…
Browse files Browse the repository at this point in the history
…dded, removed or renamed between submissions
  • Loading branch information
theus77 committed Nov 2, 2024
1 parent 6d2b630 commit c0af0a7
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,9 @@ public function generateExportConfig(array $formSubmissionIds): array
$data['deadline'] = null === $expireDate ? '' : $expireDate->format('Y-m-d');

$sheetName = $formSubmission->getName();
if (!\key_exists($sheetName, $sheets)) {
$titles = [];
foreach ($data as $key => $value) {
$titles[] = $key;
}
$sheets[$sheetName] = [$titles];
}
$titles = $sheets[$sheetName][0] ?? [];
$titles = \array_unique(\array_merge($titles, \array_keys($data)));
$sheets[$sheetName][0] = $titles;
$sheets[$sheetName] = \array_merge($sheets[$sheetName], [$data]);
}

Expand Down

0 comments on commit c0af0a7

Please sign in to comment.