From 938027cc1e7fbd3f0f2268fb98a8975f23046b5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 5 Jun 2023 17:54:00 +0200 Subject: [PATCH] apply fixes for list --- .../Export/Export/LinkedToACP/ListActivity.php | 4 ++++ .../Export/Export/LinkedToPerson/ListActivity.php | 4 ++++ .../src/Export/Export/ListAsideActivity.php | 4 ++++ .../ChillMainBundle/Export/Formatter/CSVListFormatter.php | 8 +++++++- .../Export/Formatter/CSVPivotedListFormatter.php | 6 +++++- .../Export/Formatter/SpreadsheetListFormatter.php | 6 +++++- .../Export/Export/ListAccompanyingPeriod.php | 4 ++++ .../Export/Export/ListAccompanyingPeriodWork.php | 5 ++++- .../ChillPersonBundle/Export/Export/ListEvaluation.php | 5 ++++- .../Export/Export/ListHouseholdInPeriod.php | 5 ++++- src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php | 6 ++++-- .../Export/Export/ListPersonWithAccompanyingPeriod.php | 6 ++++-- src/Bundle/ChillReportBundle/Export/Export/ReportList.php | 5 ++++- 13 files changed, 57 insertions(+), 11 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php index 026e16f90..9ed6bcda2 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/ListActivity.php @@ -44,6 +44,10 @@ class ListActivity implements ListInterface, GroupedExportInterface { $this->helper->buildForm($builder); } + public function getFormDefaultData(): array + { + return []; + } public function getAllowedFormattersTypes() { diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index 60110c9a8..d14111ba7 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -88,6 +88,10 @@ class ListActivity implements ListInterface, GroupedExportInterface ])], ]); } + public function getFormDefaultData(): array + { + return []; + } public function getAllowedFormattersTypes() { diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php index aee168174..b46e120b5 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php @@ -73,6 +73,10 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface public function buildForm(FormBuilderInterface $builder) { } + public function getFormDefaultData(): array + { + return []; + } public function getAllowedFormattersTypes() { diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php index b84c80118..70d80b74b 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/CSVListFormatter.php @@ -85,10 +85,16 @@ class CSVListFormatter implements FormatterInterface 'expanded' => true, 'multiple' => false, 'label' => 'Add a number on first column', - 'data' => true, ]); } + public function getFormDefaultData(array $aggregatorAliases): array + { + return ['numerotation' => true]; + } + + + public function getName() { return 'CSV vertical list'; diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php index 63d691443..cce0fa1e4 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/CSVPivotedListFormatter.php @@ -80,10 +80,14 @@ class CSVPivotedListFormatter implements FormatterInterface 'expanded' => true, 'multiple' => false, 'label' => 'Add a number on first column', - 'data' => true, ]); } + public function getFormDefaultData(array $aggregatorAliases): array + { + return ['numerotation' => true]; + } + public function getName() { return 'CSV horizontal list'; diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php index 0e5e339ea..34960d8d2 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php @@ -104,10 +104,14 @@ class SpreadsheetListFormatter implements FormatterInterface 'expanded' => true, 'multiple' => false, 'label' => 'Add a number on first column', - 'data' => true, ]); } + public function getFormDefaultData(array $aggregatorAliases): array + { + return ['format' => 'xlsx', 'numerotation' => true]; + } + public function getName() { return 'Spreadsheet list formatter (.xlsx, .ods)'; diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php index 0647460dd..e5e724b6c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php @@ -144,6 +144,10 @@ class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface 'required' => true, ]); } + public function getFormDefaultData(): array + { + return []; + } public function getAllowedFormattersTypes() { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php index 00fa8adb1..c437454c2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWork.php @@ -135,9 +135,12 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac 'label' => 'export.list.acpw.Date of calculation for associated elements', 'help' => 'export.list.acpw.help_description', 'required' => true, - 'data' => new RollingDate(RollingDate::T_TODAY), ]); } + public function getFormDefaultData(): array + { + return ['calc_date' => new RollingDate(RollingDate::T_TODAY)]; + } public function getAllowedFormattersTypes() { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php index f0985436b..c3e273733 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListEvaluation.php @@ -123,9 +123,12 @@ class ListEvaluation implements ListInterface, GroupedExportInterface 'label' => 'export.list.eval.Date of calculation for associated elements', 'help' => 'export.list.eval.help_description', 'required' => true, - 'data' => new RollingDate(RollingDate::T_TODAY), ]); } + public function getFormDefaultData(): array + { + return ['calc_date' => new RollingDate(RollingDate::T_TODAY)]; + } public function getAllowedFormattersTypes() { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php index 8894d145d..4dcc89495 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php @@ -75,10 +75,13 @@ class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface ->add('calc_date', PickRollingDateType::class, [ 'label' => 'export.list.household.Date of calculation for associated elements', 'help' => 'export.list.household.help_description', - 'data' => new RollingDate(RollingDate::T_TODAY), 'required' => true, ]); } + public function getFormDefaultData(): array + { + return ['calc_date' => new RollingDate(RollingDate::T_TODAY)]; + } public function getAllowedFormattersTypes() { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php index 8145fd658..12fb0ce5d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php @@ -107,17 +107,19 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou } }, ])], - 'data' => array_values($choices), ]); // add a date field for addresses $builder->add('address_date', ChillDateType::class, [ 'label' => 'Data valid at this date', 'help' => 'Data regarding center, addresses, and so on will be computed at this date', - 'data' => new DateTimeImmutable(), 'input' => 'datetime_immutable', ]); } + public function getFormDefaultData(): array + { + return ['fields' => array_values($choices), 'address_date' => new DateTimeImmutable()]; + } public function getAllowedFormattersTypes() { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php index 7cb066e87..fbdc7f391 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonWithAccompanyingPeriod.php @@ -80,17 +80,19 @@ class ListPersonWithAccompanyingPeriod implements ExportElementValidatedInterfac } }, ])], - 'data' => array_values($choices), ]); // add a date field for addresses $builder->add('address_date', ChillDateType::class, [ 'label' => 'Data valid at this date', 'help' => 'Data regarding center, addresses, and so on will be computed at this date', - 'data' => new DateTimeImmutable(), 'input' => 'datetime_immutable', ]); } + public function getFormDefaultData(): array + { + return ['fields' => array_values($choices), 'address_date' => new DateTimeImmutable()]; + } public function getAllowedFormattersTypes() { diff --git a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php index 9adae0097..c551bfb11 100644 --- a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php +++ b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php @@ -137,11 +137,14 @@ class ReportList implements ExportElementValidatedInterface, ListInterface // add a date field for addresses $builder->add('address_date', ChillDateType::class, [ 'label' => 'Address valid at this date', - 'data' => new DateTime(), 'required' => false, 'block_name' => 'list_export_form_address_date', ]); } + public function getFormDefaultData(): array + { + return ['address_date' => new DateTime()]; + } public function getAllowedFormattersTypes() {