mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
Fixed: fix the evaluation maxDateFilter to use correct alias
Some weird code is also removed in describeAction
This commit is contained in:
parent
5592e906f2
commit
6585662087
@ -22,8 +22,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
class MaxDateFilter implements FilterInterface
|
class MaxDateFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private const MAXDATE_CHOICES = [
|
private const MAXDATE_CHOICES = [
|
||||||
'is specified' => true,
|
'maxdate is specified' => true,
|
||||||
'is not specified' => false,
|
'maxdate is not specified' => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
private TranslatorInterface $translator;
|
||||||
@ -40,21 +40,13 @@ class MaxDateFilter implements FilterInterface
|
|||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
$where = $qb->getDQLPart('where');
|
|
||||||
|
|
||||||
if (true === $data['maxdate']) {
|
if (true === $data['maxdate']) {
|
||||||
$clause = $qb->expr()->isNotNull('eval.maxDate');
|
$clause = $qb->expr()->isNotNull('workeval.maxDate');
|
||||||
} else {
|
} else {
|
||||||
$clause = $qb->expr()->isNull('eval.maxDate');
|
$clause = $qb->expr()->isNull('workeval.maxDate');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($where instanceof Andx) {
|
$qb->andWhere($clause);
|
||||||
$where->add($clause);
|
|
||||||
} else {
|
|
||||||
$where = $qb->expr()->andX($clause);
|
|
||||||
}
|
|
||||||
|
|
||||||
$qb->add('where', $where);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -73,19 +65,15 @@ class MaxDateFilter implements FilterInterface
|
|||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
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%', [
|
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
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return 'Filter by maxdate';
|
return 'Filter evaluations by maxdate mention';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -581,10 +581,10 @@ Accepted evaluationtype: Évaluations
|
|||||||
Group by evaluation type: Grouper les évaluations par type
|
Group by evaluation type: Grouper les évaluations par type
|
||||||
Evaluation type: Type d'évaluation
|
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: ''
|
Maxdate: ''
|
||||||
is specified: La date d'échéance est spécifiée
|
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 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%"
|
"Filtered by maxdate: only %choice%": "Filtré par date d'échéance: uniquement si %choice%"
|
||||||
|
|
||||||
## household filters/aggr
|
## household filters/aggr
|
||||||
|
Loading…
x
Reference in New Issue
Block a user