mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
HasNoReferrer filter
This commit is contained in:
parent
a18870c91e
commit
bc41910a39
@ -12,9 +12,13 @@ declare(strict_types=1);
|
|||||||
namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters;
|
namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters;
|
||||||
|
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\UserHistory;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
class HasNoReferrerFilter implements FilterInterface
|
class HasNoReferrerFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
@ -26,10 +30,18 @@ class HasNoReferrerFilter implements FilterInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
$qb
|
$qb
|
||||||
->andWhere(
|
->andWhere('
|
||||||
$qb->expr()->in('', ':')
|
NOT EXISTS (
|
||||||
)
|
SELECT 1 FROM '. UserHistory::class .' uh
|
||||||
->setParameter('', $data[]);
|
WHERE uh.startDate < :date
|
||||||
|
AND (
|
||||||
|
uh.endDate IS NULL
|
||||||
|
or uh.endDate > :date
|
||||||
|
)
|
||||||
|
AND uh.accompanyingPeriod = acp
|
||||||
|
)
|
||||||
|
')
|
||||||
|
->setParameter('date', $data['calc_date'], Types::DATE_IMMUTABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -39,12 +51,17 @@ class HasNoReferrerFilter implements FilterInterface
|
|||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
$builder->add();
|
$builder
|
||||||
|
->add('calc_date', ChillDateType::class, [
|
||||||
|
'label' => 'Has no referrer on this date',
|
||||||
|
'data' => new DateTime(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, $format = 'string'): array
|
||||||
{
|
{
|
||||||
return ['', [
|
return ['Filtered acp which has no referrer on date: %date%', [
|
||||||
|
'%date%' => $data['calc_date']->format('d-m-Y'),
|
||||||
]];
|
]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,6 +554,8 @@ Date to: Date de fin
|
|||||||
|
|
||||||
Filter by temporary location: Filtrer les parcours avec une localisation temporaire
|
Filter by temporary location: Filtrer les parcours avec une localisation temporaire
|
||||||
Filter by which has no referrer: Filtrer les parcours sans référent
|
Filter by which has no referrer: Filtrer les parcours sans référent
|
||||||
|
"Filtered acp which has no referrer on date: %date%": "Filtré les parcours sans référent à cette date: %date%"
|
||||||
|
Has no referrer on this date: N'a pas de référent à cette date
|
||||||
Filter by which has no action: Filtrer les parcours qui n’ont pas d’actions
|
Filter by which has no action: Filtrer les parcours qui n’ont pas d’actions
|
||||||
Filtered acp which has no actions: Filtré les parcours qui n'ont pas d'actions
|
Filtered acp which has no actions: Filtré les parcours qui n'ont pas d'actions
|
||||||
Group by number of actions: Grouper les parcours par nombre d’actions
|
Group by number of actions: Grouper les parcours par nombre d’actions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user