From 5f441eb5acea4fbd8c9f48cac3494b4f640398c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 27 Nov 2023 21:01:01 +0100 Subject: [PATCH 1/2] Fix path to csv template --- .../ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php index a83c241d8..b69f0d37e 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php @@ -280,7 +280,7 @@ class CustomFieldChoice extends AbstractCustomField $template = '@ChillCustomFields/CustomFieldsRendering/choice.html.twig'; if ('csv' === $documentType) { - $template = 'ChillCustomFieldsBundle/CustomFieldsRendering/choice.csv.twig'; + $template = '@ChillCustomFields/CustomFieldsRendering/choice.csv.twig'; } return $this->templating From 4727a57825deca7bd407239496f38d84d3909e73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 27 Nov 2023 21:02:39 +0100 Subject: [PATCH 2/2] Export: ListPerson: avoid json_decoding the string '_header' --- .changes/unreleased/Fixed-20231127-210138.yaml | 5 +++++ .../ChillPersonBundle/Export/Export/ListPerson.php | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .changes/unreleased/Fixed-20231127-210138.yaml diff --git a/.changes/unreleased/Fixed-20231127-210138.yaml b/.changes/unreleased/Fixed-20231127-210138.yaml new file mode 100644 index 000000000..84f629161 --- /dev/null +++ b/.changes/unreleased/Fixed-20231127-210138.yaml @@ -0,0 +1,5 @@ +kind: Fixed +body: 'Export: fix list person with custom fields' +time: 2023-11-27T21:01:38.260730706+01:00 +custom: + Issue: "" diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php index b0e916765..8529fac10 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php @@ -332,13 +332,18 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou if (null === $value) { return ''; } - $decoded = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR); if ('_header' === $value) { $label = $cfType->getChoices($cf)[$slugChoice]; return $this->translatableStringHelper->localize($cf->getName()) - .' | '.$label; + .' | '.$label; + } + + try { + $decoded = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $e) { + throw new \RuntimeException(sprintf('unable to decode json: %s, %s', json_last_error(), json_last_error_msg()), $e->getCode(), $e); } if ('_other' === $slugChoice && $cfType->isChecked($cf, $slugChoice, $decoded)) {