mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
exports: fix choice forms builder with multiple selections
This commit is contained in:
parent
43bedc41a7
commit
ddac410b2e
@ -34,8 +34,8 @@ class ClosingMotiveFilter implements FilterInterface
|
|||||||
'choice_label' => function (ClosingMotive $cm) {
|
'choice_label' => function (ClosingMotive $cm) {
|
||||||
return $this->translatableStringHelper->localize($cm->getName());
|
return $this->translatableStringHelper->localize($cm->getName());
|
||||||
},
|
},
|
||||||
'multiple' => false,
|
'multiple' => true,
|
||||||
'expanded' => false
|
'expanded' => true,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,10 +52,15 @@ class ClosingMotiveFilter implements FilterInterface
|
|||||||
*/
|
*/
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, $format = 'string'): array
|
||||||
{
|
{
|
||||||
|
$motives = [];
|
||||||
|
|
||||||
|
foreach ($data['accepted_closingmotives'] as $k => $v) {
|
||||||
|
$motives[] = $this->translatableStringHelper->localize($v->getName());
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'Filtered by closingmotive: only %closingmotive%', [
|
'Filtered by closingmotive: only %closingmotives%', [
|
||||||
'%closingmotive%' => $this->translatableStringHelper->localize(
|
'%closingmotives%' => implode(', ou ', $motives)
|
||||||
$data['accepted_closingmotives']->getName())
|
|
||||||
]];
|
]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +78,7 @@ class ClosingMotiveFilter 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()->eq('acp.closingMotive', ':closingmotive');
|
$clause = $qb->expr()->in('acp.closingMotive', ':closingmotive');
|
||||||
|
|
||||||
if ($where instanceof Andx) {
|
if ($where instanceof Andx) {
|
||||||
$where->add($clause);
|
$where->add($clause);
|
||||||
|
@ -35,7 +35,7 @@ class OriginFilter implements FilterInterface
|
|||||||
'choice_label' => function (Origin $o) {
|
'choice_label' => function (Origin $o) {
|
||||||
return $this->translatableStringHelper->localize($o->getLabel());
|
return $this->translatableStringHelper->localize($o->getLabel());
|
||||||
},
|
},
|
||||||
'multiple' => false,
|
'multiple' => true,
|
||||||
'expanded' => true
|
'expanded' => true
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -53,9 +53,14 @@ class OriginFilter implements FilterInterface
|
|||||||
*/
|
*/
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, $format = 'string'): array
|
||||||
{
|
{
|
||||||
return ['Filtered by origins: only %origin%', [
|
$origins = [];
|
||||||
'%origin%' => $this->translatableStringHelper->localize(
|
|
||||||
$data['accepted_origins']->getLabel())
|
foreach ($data['accepted_origins'] as $v) {
|
||||||
|
$origins[] = $this->translatableStringHelper->localize($v->getLabel());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['Filtered by origins: only %origins%', [
|
||||||
|
'%origins%' => implode(', ou ', $origins)
|
||||||
]];
|
]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +78,7 @@ class OriginFilter 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()->eq('acp.origin', ':origin');
|
$clause = $qb->expr()->in('acp.origin', ':origin');
|
||||||
|
|
||||||
if ($where instanceof Andx) {
|
if ($where instanceof Andx) {
|
||||||
$where->add($clause);
|
$where->add($clause);
|
||||||
|
@ -39,10 +39,8 @@ class StepFilter implements FilterInterface
|
|||||||
{
|
{
|
||||||
$builder->add('accepted_steps', ChoiceType::class, [
|
$builder->add('accepted_steps', ChoiceType::class, [
|
||||||
'choices' => self::STEPS,
|
'choices' => self::STEPS,
|
||||||
'multiple' => false,
|
'multiple' => true,
|
||||||
'expanded' => true,
|
'expanded' => true,
|
||||||
'empty_data' => self::DEFAULT_CHOICE,
|
|
||||||
'data' => self::DEFAULT_CHOICE,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,10 +51,16 @@ class StepFilter implements FilterInterface
|
|||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
public function describeAction($data, $format = 'string')
|
||||||
{
|
{
|
||||||
$step = array_flip(self::STEPS)[$data['accepted_steps']];
|
$steps = [];
|
||||||
|
|
||||||
return ["Filtered by steps: only %step%", [
|
foreach ($data['accepted_steps'] as $v) {
|
||||||
'%step%' => $this->translator->trans($step)
|
$steps[] = $this->translator->trans(
|
||||||
|
array_flip(self::STEPS)[$v]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ["Filtered by steps: only %steps%", [
|
||||||
|
'%steps%' => implode(', ou ', $steps)
|
||||||
]];
|
]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +72,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()->eq('acp.step', ':step');
|
$clause = $qb->expr()->in('acp.step', ':step');
|
||||||
|
|
||||||
if ($where instanceof Andx) {
|
if ($where instanceof Andx) {
|
||||||
$where->add($clause);
|
$where->add($clause);
|
||||||
|
@ -388,15 +388,15 @@ 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 %step%": "Filtré par statut du parcours: uniquement %step%"
|
"Filtered by steps: only %steps%": "Filtré par statut du parcours: uniquement %steps%"
|
||||||
|
|
||||||
Filter by origin: Filtrer par origine du parcours
|
Filter by origin: Filtrer par origine du parcours
|
||||||
Accepted origins: Origines
|
Accepted origins: Origines
|
||||||
"Filtered by origins: only %origin%": "Filtré par origine du parcours: uniquement %origin%"
|
"Filtered by origins: only %origins%": "Filtré par origine du parcours: uniquement %origins%"
|
||||||
|
|
||||||
Filter by closing motive: Filtrer par motif de fermeture
|
Filter by closing motive: Filtrer par motif de fermeture
|
||||||
Accepted closingmotives: Motifs de clôture
|
Accepted closingmotives: Motifs de clôture
|
||||||
"Filtered by closingmotive: only %closingmotive%": "Filtré par motif de clôture: uniquement %closingmotive%"
|
"Filtered by closingmotive: only %closingmotives%": "Filtré par motif de clôture: uniquement %closingmotives%"
|
||||||
|
|
||||||
Filter by confidential: Filtrer par confidentialité
|
Filter by confidential: Filtrer par confidentialité
|
||||||
Accepted confidentials: Choix possibles
|
Accepted confidentials: Choix possibles
|
||||||
|
Loading…
x
Reference in New Issue
Block a user