mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-11-04 03:08:25 +00:00 
			
		
		
		
	HasNoReferrer filter
This commit is contained in:
		@@ -12,9 +12,13 @@ declare(strict_types=1);
 | 
			
		||||
namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\Export\FilterInterface;
 | 
			
		||||
use Chill\MainBundle\Form\Type\ChillDateType;
 | 
			
		||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\UserHistory;
 | 
			
		||||
use Chill\PersonBundle\Export\Declarations;
 | 
			
		||||
use Doctrine\DBAL\Types\Types;
 | 
			
		||||
use Doctrine\ORM\QueryBuilder;
 | 
			
		||||
use Symfony\Component\Form\FormBuilderInterface;
 | 
			
		||||
use DateTime;
 | 
			
		||||
 | 
			
		||||
class HasNoReferrerFilter implements FilterInterface
 | 
			
		||||
{
 | 
			
		||||
@@ -26,10 +30,18 @@ class HasNoReferrerFilter implements FilterInterface
 | 
			
		||||
    public function alterQuery(QueryBuilder $qb, $data)
 | 
			
		||||
    {
 | 
			
		||||
        $qb
 | 
			
		||||
            ->andWhere(
 | 
			
		||||
                $qb->expr()->in('', ':')
 | 
			
		||||
            )
 | 
			
		||||
            ->setParameter('', $data[]);
 | 
			
		||||
            ->andWhere('
 | 
			
		||||
                NOT EXISTS (
 | 
			
		||||
                    SELECT 1 FROM '. UserHistory::class .' uh 
 | 
			
		||||
                    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
 | 
			
		||||
@@ -39,12 +51,17 @@ class HasNoReferrerFilter implements FilterInterface
 | 
			
		||||
 | 
			
		||||
    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
 | 
			
		||||
    {
 | 
			
		||||
        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 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
 | 
			
		||||
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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user