mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
add filtering in task list
This commit is contained in:
@@ -61,6 +61,66 @@ final class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepository
|
||||
->setParameter('user', $this->security->getUser())
|
||||
;
|
||||
|
||||
if (!empty($pattern)) {
|
||||
$qb->andWhere($qb->expr()->like('LOWER(UNACCENT(t.title))', 'LOWER(UNACCENT(:pattern))'))
|
||||
->setParameter('pattern', $pattern)
|
||||
;
|
||||
}
|
||||
|
||||
if (count($flags) > 0) {
|
||||
$orX = $qb->expr()->orX();
|
||||
$now = new \DateTime();
|
||||
|
||||
if (\in_array('no-alert', $flags)) {
|
||||
$orX
|
||||
->add(
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull('t.endDate'),
|
||||
$qb->expr()->gte('t.endDate - COALESCE(t.warningInterval, :intervalBlank)', ':now')
|
||||
)
|
||||
);
|
||||
$qb
|
||||
->setParameter('intervalBlank', new \DateInterval('P0D'))
|
||||
->setParameter('now', $now)
|
||||
;
|
||||
}
|
||||
|
||||
if (\in_array('warning', $flags)) {
|
||||
$orX
|
||||
->add(
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->eq('t.closed', "'FALSE'"),
|
||||
$qb->expr()->not($qb->expr()->isNull('t.endDate')),
|
||||
$qb->expr()->not($qb->expr()->isNull('t.warningInterval')),
|
||||
$qb->expr()->lte('t.endDate - t.warningInterval', ':now')
|
||||
)
|
||||
)
|
||||
;
|
||||
$qb
|
||||
->setParameter('now', $now)
|
||||
;
|
||||
}
|
||||
|
||||
if (\in_array('alert', $flags)) {
|
||||
$orX
|
||||
->add(
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->eq('t.closed', "'FALSE'"),
|
||||
$qb->expr()->not($qb->expr()->isNull('t.endDate')),
|
||||
$qb->expr()->lte('t.endDate', ':now')
|
||||
)
|
||||
)
|
||||
;
|
||||
$qb
|
||||
->setParameter('now', $now)
|
||||
;
|
||||
}
|
||||
|
||||
$qb->andWhere($orX);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user