diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php index 3bae64fec..6c958ca6c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/CreatorJobAggregator.php @@ -62,15 +62,13 @@ class CreatorJobAggregator implements AggregatorInterface { return function ($value): string { if ('_header' === $value) { - return 'Job'; + return 'export.aggregator.course.by_creator_job.Creator\'s job'; } - if (null === $value) { + if (null === $value || null === $j = $this->jobRepository->find($value)) { return ''; } - $j = $this->jobRepository->find($value); - return $this->translatableStringHelper->localize( $j->getLabel() ); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorFilter.php index 1ac6d5390..b13947e60 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorFilter.php @@ -11,10 +11,10 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; +use Chill\MainBundle\Entity\User; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickUserDynamicType; use Chill\PersonBundle\Export\Declarations; -use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use function in_array; @@ -32,17 +32,9 @@ class CreatorFilter implements FilterInterface $qb->join('acp.createdBy', 'acp_creator'); } - $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('acp_creator', ':creators'); - - if ($where instanceof Andx) { - $where->add($clause); - } else { - $where = $qb->expr()->andX($clause); - } - - $qb->add('where', $where); - $qb->setParameter('creators', $data['accepted_creators']); + $qb + ->andWhere($qb->expr()->in('acp_creator', ':creators')) + ->setParameter('creators', $data['accepted_creators']); } public function applyOn(): string @@ -55,20 +47,15 @@ class CreatorFilter implements FilterInterface $builder ->add('accepted_creators', PickUserDynamicType::class, [ 'multiple' => true, + 'label' => false, ]); } public function describeAction($data, $format = 'string'): array { - $creators = []; - - foreach ($data['accepted_creators'] as $c) { - $creators[] = $c; - } - return [ 'Filtered by creator: only %creators%', [ - '%creators%' => implode(', ', $creators), + '%creators%' => implode(', ', array_map(static fn (User $u) => $u->getLabel(), $data['accepted_creators'])), ], ]; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php index c8b7ccc55..62cf49d6d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CreatorJobFilter.php @@ -68,6 +68,7 @@ class CreatorJobFilter implements FilterInterface }, 'multiple' => true, 'expanded' => true, + 'label' => 'Job', ]); } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index dca6c91f6..bdedea895 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1008,6 +1008,8 @@ export: Calc date: Date de calcul de la composition du ménage by_number_of_action: Number of actions: Nombre d'actions + by_creator_job: + Creator's job: Métier du créateur course_work: by_current_action: Current action ?: Action en cours ?