Fix export controller when generating an export without any data in session

This commit is contained in:
Julien Fastré 2023-10-24 20:46:23 +02:00
parent 4bc1de01d6
commit 2c50f484f0
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -281,7 +281,7 @@ class ExportController extends AbstractController
$options = match ($step) { $options = match ($step) {
'export', 'generate_export' => [ 'export', 'generate_export' => [
'export_alias' => $alias, 'export_alias' => $alias,
'picked_centers' => $exportManager->getPickedCenters($data['centers']), 'picked_centers' => $exportManager->getPickedCenters($data['centers'] ?? []),
], ],
'formatter', 'generate_formatter' => [ 'formatter', 'generate_formatter' => [
'export_alias' => $alias, 'export_alias' => $alias,
@ -339,9 +339,9 @@ class ExportController extends AbstractController
$exportManager = $this->exportManager; $exportManager = $this->exportManager;
// check we have data from the previous step (export step) // check we have data from the previous step (export step)
$data = $this->session->get('centers_step', null); $data = $this->session->get('centers_step', []);
if (null === $data) { if (null === $data && true === $this->filterStatsByCenters) {
return $this->redirectToRoute('chill_main_export_new', [ return $this->redirectToRoute('chill_main_export_new', [
'step' => $this->getNextStep('export', $export, true), 'step' => $this->getNextStep('export', $export, true),
'alias' => $alias, 'alias' => $alias,