mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
[activity][export] Fixed: fixed inconsistencies with date filters
This commit is contained in:
parent
8b64933565
commit
4e82126bed
@ -14,6 +14,7 @@ and this project adheres to
|
||||
* [person][export] Fixed: rename the alias for `accompanying_period` to `acp` in filter associated with person
|
||||
* [activity][export] Feature: improve label for aliases in "Filter by activity type"
|
||||
* [activity][export] DX/Feature: use of an `ActivityTypeRepositoryInterface` instead of the old-style EntityRepository
|
||||
* [person][export] Fixed: some inconsistency with date filter on accompanying courses
|
||||
|
||||
## Test releases
|
||||
|
||||
|
@ -29,24 +29,9 @@ class ActiveOneDayBetweenDatesFilter implements FilterInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = "OVERLAPSI (acp.openingDate, acp.closingDate), (:datefrom, :dateto) = 'TRUE'";
|
||||
|
||||
$clause = $qb->expr()->orX(
|
||||
$qb->expr()->lt('(acp.openingDate + 1)', ':dateto'),
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->lt('acp.openingDate', ':datefrom'),
|
||||
$qb->expr()->isNull('acp.closingDate')
|
||||
),
|
||||
$qb->expr()->gt('(acp.closingDate - 1)', ':datefrom')
|
||||
);
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->andWhere($clause);
|
||||
$qb->setParameter('datefrom', $data['date_from'], Types::DATE_MUTABLE);
|
||||
$qb->setParameter('dateto', $data['date_to'], Types::DATE_MUTABLE);
|
||||
}
|
||||
|
@ -29,20 +29,12 @@ class OpenBetweenDatesFilter implements FilterInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$clause = $qb->expr()->andX(
|
||||
$qb->expr()->lt('acp.openingDate', ':datefrom'),
|
||||
$qb->expr()->gt('acp.closingDate', ':dateto')
|
||||
$qb->expr()->gte('acp.openingDate', ':datefrom'),
|
||||
$qb->expr()->lte('acp.openingDate', ':dateto')
|
||||
);
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->andWhere($clause);
|
||||
$qb->setParameter('datefrom', $data['date_from'], Types::DATE_MUTABLE);
|
||||
$qb->setParameter('dateto', $data['date_to'], Types::DATE_MUTABLE);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user