diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php index 5235207ff..4f02eaa35 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php @@ -22,8 +22,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class MaxDateFilter implements FilterInterface { private const MAXDATE_CHOICES = [ - 'is specified' => true, - 'is not specified' => false, + 'maxdate is specified' => true, + 'maxdate is not specified' => false, ]; private TranslatorInterface $translator; @@ -40,21 +40,13 @@ class MaxDateFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $where = $qb->getDQLPart('where'); - if (true === $data['maxdate']) { - $clause = $qb->expr()->isNotNull('eval.maxDate'); + $clause = $qb->expr()->isNotNull('workeval.maxDate'); } else { - $clause = $qb->expr()->isNull('eval.maxDate'); + $clause = $qb->expr()->isNull('workeval.maxDate'); } - if ($where instanceof Andx) { - $where->add($clause); - } else { - $where = $qb->expr()->andX($clause); - } - - $qb->add('where', $where); + $qb->andWhere($clause); } public function applyOn(): string @@ -73,19 +65,15 @@ class MaxDateFilter implements FilterInterface public function describeAction($data, $format = 'string'): array { - foreach (self::MAXDATE_CHOICES as $k => $v) { - if ($v === $data['maxdate']) { - $choice = $k; - } - } - return ['Filtered by maxdate: only %choice%', [ - '%choice%' => $this->translator->trans($choice), + '%choice%' => $this->translator->trans( + $data['maxdate'] ? 'maxdate is specified': 'maxdate is not specified' + ), ]]; } public function getTitle(): string { - return 'Filter by maxdate'; + return 'Filter evaluations by maxdate mention'; } } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 664498a95..a5040e6df 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -581,10 +581,10 @@ Accepted evaluationtype: Évaluations Group by evaluation type: Grouper les évaluations par type Evaluation type: Type d'évaluation -Filter by maxdate: Filtrer les évaluations par date d'échéance +Filter evaluations by maxdate mention: Filtrer les évaluations qui possèdent une date d'échéance Maxdate: '' -is specified: La date d'échéance est spécifiée -is not specified: La date d'échéance n'est pas spécifiée +maxdate is specified: la date d'échéance est spécifiée +maxdate is not specified: la date d'échéance n'est pas spécifiée "Filtered by maxdate: only %choice%": "Filtré par date d'échéance: uniquement si %choice%" ## household filters/aggr