revert stepFilter to uniq selection

(cfr ddac410b2e5be2db7542dc92f89c5d0d4baf3ce7)
This commit is contained in:
Mathieu Jaumotte 2022-07-25 18:24:24 +02:00
parent e728c00671
commit ef827a1322
2 changed files with 8 additions and 12 deletions

View File

@ -39,8 +39,10 @@ class StepFilter implements FilterInterface
{ {
$builder->add('accepted_steps', ChoiceType::class, [ $builder->add('accepted_steps', ChoiceType::class, [
'choices' => self::STEPS, 'choices' => self::STEPS,
'multiple' => true, 'multiple' => false,
'expanded' => true, 'expanded' => true,
'empty_data' => self::DEFAULT_CHOICE,
'data' => self::DEFAULT_CHOICE,
]); ]);
} }
@ -51,16 +53,10 @@ class StepFilter implements FilterInterface
public function describeAction($data, $format = 'string') public function describeAction($data, $format = 'string')
{ {
$steps = []; $step = array_flip(self::STEPS)[$data['accepted_steps']];
foreach ($data['accepted_steps'] as $v) { return ["Filtered by steps: only %step%", [
$steps[] = $this->translator->trans( '%step%' => $this->translator->trans($step)
array_flip(self::STEPS)[$v]
);
}
return ["Filtered by steps: only %steps%", [
'%steps%' => implode(', ou ', $steps)
]]; ]];
} }
@ -72,7 +68,7 @@ class StepFilter implements FilterInterface
public function alterQuery(QueryBuilder $qb, $data) public function alterQuery(QueryBuilder $qb, $data)
{ {
$where = $qb->getDQLPart('where'); $where = $qb->getDQLPart('where');
$clause = $qb->expr()->in('acp.step', ':step'); $clause = $qb->expr()->eq('acp.step', ':step');
if ($where instanceof Andx) { if ($where instanceof Andx) {
$where->add($clause); $where->add($clause);

View File

@ -388,7 +388,7 @@ Accepted socialissues: Problématiques sociales
Filter by step: Filtrer par statut du parcours Filter by step: Filtrer par statut du parcours
Accepted steps: Statuts Accepted steps: Statuts
"Filtered by steps: only %steps%": "Filtré par statut du parcours: uniquement %steps%" "Filtered by steps: only %step%": "Filtré par statut du parcours: uniquement %step%"
Filter by origin: Filtrer par origine du parcours Filter by origin: Filtrer par origine du parcours
Accepted origins: Origines Accepted origins: Origines