mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch '111_exports_suite' of gitlab.com:Chill-Projet/chill-bundles into 111_exports_suite
This commit is contained in:
commit
f40aa89d08
@ -48,6 +48,9 @@ class SentReceivedAggregator implements AggregatorInterface
|
||||
}
|
||||
|
||||
switch ($value) {
|
||||
case null:
|
||||
return '';
|
||||
|
||||
case 'sent':
|
||||
return 'is sent';
|
||||
|
||||
|
@ -54,8 +54,6 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
{
|
||||
$user = $this->tokenStorage->getToken()->getUser();
|
||||
|
||||
if ($this->authorizationChecker->isGranted('ROLE_USER')) {
|
||||
$menu->addChild('My calendar list', [
|
||||
'route' => 'chill_calendar_calendar_list',
|
||||
|
@ -13,9 +13,9 @@ namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Entity\UserJob;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Repository\UserJobRepositoryInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
@ -25,10 +25,14 @@ class CreatorJobFilter implements FilterInterface
|
||||
{
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
private UserJobRepositoryInterface $userJobRepository;
|
||||
|
||||
public function __construct(
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
UserJobRepositoryInterface $userJobRepository
|
||||
) {
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->userJobRepository = $userJobRepository;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
@ -42,17 +46,9 @@ class CreatorJobFilter implements FilterInterface
|
||||
$qb->join('acp.createdBy', 'acp_creator');
|
||||
}
|
||||
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = $qb->expr()->in('acp_creator.userJob', ':creator_job');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('creator_job', $data['creator_job']);
|
||||
$qb
|
||||
->andWhere($qb->expr()->in('acp_creator.userJob', ':creator_job'))
|
||||
->setParameter('creator_job', $data['creator_job']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -64,6 +60,7 @@ class CreatorJobFilter implements FilterInterface
|
||||
{
|
||||
$builder->add('creator_job', EntityType::class, [
|
||||
'class' => UserJob::class,
|
||||
'choices' => $this->userJobRepository->findAllActive(),
|
||||
'choice_label' => function (UserJob $j) {
|
||||
return $this->translatableStringHelper->localize(
|
||||
$j->getLabel()
|
||||
@ -84,7 +81,7 @@ class CreatorJobFilter implements FilterInterface
|
||||
);
|
||||
}
|
||||
|
||||
return ['Filtered by creator job: only %jobs%', [
|
||||
return ['export.filter.course.creator_job.Filtered by creator job: only %jobs%', [
|
||||
'%jobs%' => implode(', ', $creatorJobs),
|
||||
]];
|
||||
}
|
||||
|
@ -12,8 +12,12 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class HasTemporaryLocationFilter implements FilterInterface
|
||||
@ -26,10 +30,25 @@ class HasTemporaryLocationFilter implements FilterInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->in('', ':')
|
||||
)
|
||||
->setParameter('', $data[]);
|
||||
->join('acp.locationHistories', 'acp_having_temporarily_location')
|
||||
->andWhere('acp_having_temporarily_location.startDate <= :acp_having_temporarily_location_date
|
||||
AND (acp_having_temporarily_location.endDate IS NULL OR acp_having_temporarily_location.endDate > :acp_having_temporarily_location_date)')
|
||||
->setParameter('acp_having_temporarily_location_date', $data['calc_date']);
|
||||
|
||||
switch ($data['having_temporarily']) {
|
||||
case true:
|
||||
$qb->andWhere('acp_having_temporarily_location.addressLocation IS NOT NULL');
|
||||
|
||||
break;
|
||||
|
||||
case false:
|
||||
$qb->andWhere('acp_having_temporarily_location.personLocation IS NOT NULL');
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new LogicException('value not supported');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -39,13 +58,44 @@ class HasTemporaryLocationFilter implements FilterInterface
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
//$builder->add();
|
||||
$builder
|
||||
->add('having_temporarily', ChoiceType::class, [
|
||||
'choices' => [
|
||||
'export.filter.course.having_temporarily.Having a temporarily location' => true,
|
||||
'export.filter.course.having_temporarily.Having a person\'s location' => false,
|
||||
],
|
||||
'choice_label' => static function ($choice) {
|
||||
switch ($choice) {
|
||||
case true:
|
||||
return 'export.filter.course.having_temporarily.Having a temporarily location';
|
||||
|
||||
case false:
|
||||
return 'export.filter.course.having_temporarily.Having a person\'s location';
|
||||
|
||||
default:
|
||||
throw new LogicException('this choice is not supported');
|
||||
}
|
||||
},
|
||||
])
|
||||
->add('calc_date', ChillDateType::class, [
|
||||
'label' => 'export.filter.course.having_temporarily.Calculation date',
|
||||
'input' => 'datetime_immutable',
|
||||
'data' => new DateTimeImmutable(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
return ['', [
|
||||
]];
|
||||
switch ($data['having_temporarily']) {
|
||||
case true:
|
||||
return ['export.filter.course.having_temporarily.Having a temporarily location', []];
|
||||
|
||||
case false:
|
||||
return ['export.filter.course.having_temporarily.Having a person\'s location', []];
|
||||
|
||||
default:
|
||||
throw new LogicException('value not supported');
|
||||
}
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
|
@ -1021,6 +1021,12 @@ export:
|
||||
Computation date for referrer: Date à laquelle le référent était actif
|
||||
by_referrer:
|
||||
Computation date for referrer: Date à laquelle le référent était actif
|
||||
having_temporarily:
|
||||
Having a temporarily location: Ayant une localisation temporaire
|
||||
Having a person's location: Ayant une localisation auprès d'un usager
|
||||
Calculation date: Date de la localisation
|
||||
creator_job:
|
||||
'Filtered by creator job: only %jobs%': 'Filtré par métier du créateur: seulement %jobs%'
|
||||
list:
|
||||
person_with_acp:
|
||||
List peoples having an accompanying period: Liste des personnes ayant un parcours d'accompagnement
|
||||
|
Loading…
x
Reference in New Issue
Block a user