mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-13 17:37:45 +00:00
Merge branch 'master' into migrate_to_sf72
# Conflicts: # src/Bundle/ChillEventBundle/Controller/EventController.php # src/Bundle/ChillEventBundle/Controller/ParticipationController.php # src/Bundle/ChillEventBundle/DependencyInjection/ChillEventExtension.php # src/Bundle/ChillEventBundle/Entity/Event.php # src/Bundle/ChillEventBundle/Form/EventType.php # src/Bundle/ChillEventBundle/Menu/AdminMenuBuilder.php # src/Bundle/ChillEventBundle/config/services.yaml # src/Bundle/ChillEventBundle/config/services/controller.yaml # src/Bundle/ChillMainBundle/Resources/views/Menu/user.html.twig # src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkDuplicateController.php # src/Bundle/ChillPersonBundle/Controller/PersonController.php # src/Bundle/ChillPersonBundle/Form/PersonType.php
This commit is contained in:
@@ -90,7 +90,7 @@ class AccompanyingPeriodWorkRepository implements ObjectRepository
|
||||
* * first, opened works
|
||||
* * then, closed works
|
||||
*
|
||||
* @param array{types?: list<SocialAction>, user?: list<User>, after?: \DateTimeImmutable|null, before?: \DateTimeImmutable|null} $filters
|
||||
* @param array{types?: list<SocialAction>, user?: list<User>, currentUser?: User, after?: \DateTimeImmutable|null, before?: \DateTimeImmutable|null} $filters
|
||||
*
|
||||
* @return AccompanyingPeriodWork[]
|
||||
*/
|
||||
@@ -101,6 +101,7 @@ class AccompanyingPeriodWorkRepository implements ObjectRepository
|
||||
|
||||
$sql = "SELECT {$rsm} FROM chill_person_accompanying_period_work w
|
||||
LEFT JOIN chill_person_accompanying_period_work_referrer AS rw ON accompanyingperiodwork_id = w.id
|
||||
AND (rw.enddate IS NULL OR rw.enddate > CURRENT_DATE)
|
||||
WHERE accompanyingPeriod_id = :periodId";
|
||||
|
||||
// implement filters
|
||||
@@ -119,6 +120,10 @@ class AccompanyingPeriodWorkRepository implements ObjectRepository
|
||||
.')';
|
||||
}
|
||||
|
||||
if (isset($filters['currentUser'])) {
|
||||
$sql .= ' AND rw.user_id = :currentUser';
|
||||
}
|
||||
|
||||
$sql .= " AND daterange(:after::date, :before::date) && daterange(w.startDate, w.endDate, '[]')";
|
||||
|
||||
// if the start and end date were inversed, we inverse the order to avoid an error
|
||||
@@ -152,6 +157,11 @@ class AccompanyingPeriodWorkRepository implements ObjectRepository
|
||||
->setParameter('limit', $limit, Types::INTEGER)
|
||||
->setParameter('offset', $offset, Types::INTEGER);
|
||||
|
||||
if (isset($filters['currentUser'])) {
|
||||
$nq->setParameter('currentUser', $filters['currentUser']->getId());
|
||||
}
|
||||
|
||||
|
||||
foreach ($filters['user'] as $key => $user) {
|
||||
$nq->setParameter('user_'.$key, $user);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Repository\Identifier;
|
||||
|
||||
use Chill\PersonBundle\Entity\Identifier\PersonIdentifierDefinition;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @template-extends ServiceEntityRepository<PersonIdentifierDefinition>
|
||||
*/
|
||||
class PersonIdentifierDefinitionRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $managerRegistry)
|
||||
{
|
||||
parent::__construct($managerRegistry, PersonIdentifierDefinition::class);
|
||||
}
|
||||
|
||||
public function findByActive(): array
|
||||
{
|
||||
return $this->findBy(['active' => true]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user