From 6b1155b9d8a6bb263737456768314ef0e0b038f2 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 16 Oct 2022 19:35:18 +0200 Subject: [PATCH] issue641: don't list all children if parent is chosen add mechanism to differenciate string in export --- .../SocialIssueFilter.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php index aa689165f..c72c78aa5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialIssueFilter.php @@ -85,7 +85,8 @@ class SocialIssueFilter implements FilterInterface if (null === $si) { $issues[] = $this->translator->trans('Not given'); } else { - $issues[] = $this->socialIssueRender->renderString($si, []); + $issues[] = $this->renderIssue($si); + } } @@ -127,4 +128,17 @@ class SocialIssueFilter implements FilterInterface array_intersect_key($array, $unique_ids) ); } + + private function renderIssue(SocialIssue $si): string + { + $render_str = $this->socialIssueRender->renderString($si, []); + + if (!$si->hasParent()) { + if (count($si->getDescendants()) > 0) { + return $render_str . " (et dérivés)"; + } + } + + return $render_str; + } }