Merge branch '111_exports_suite' into calendar/finalization

This commit is contained in:
2022-09-08 10:19:53 +02:00
72 changed files with 579 additions and 282 deletions

View File

@@ -39,7 +39,9 @@ class AdministrativeLocationAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acp.administrativeLocation', 'al');
if (!in_array('acploc', $qb->getAllAliases(), true)) {
$qb->join('acp.administrativeLocation', 'acploc');
}
$qb->addSelect('IDENTITY(acp.administrativeLocation) AS location_aggregator');

View File

@@ -40,7 +40,9 @@ class ClosingMotiveAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acp.closingMotive', 'cm');
if (!in_array('acpmotive', $qb->getAllAliases(), true)) {
$qb->join('acp.closingMotive', 'acpmotive');
}
$qb->addSelect('IDENTITY(acp.closingMotive) AS closingmotive_aggregator');

View File

@@ -43,9 +43,12 @@ final class EvaluationAggregator implements AggregatorInterface
if (!in_array('acpw', $qb->getAllAliases(), true)) {
$qb->join('acp.works', 'acpw');
}
$qb->join('acpw.accompanyingPeriodWorkEvaluations', 'we');
$qb->addSelect('IDENTITY(we.evaluation) AS evaluation_aggregator');
if (!in_array('workeval', $qb->getAllAliases(), true)) {
$qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval');
}
$qb->addSelect('IDENTITY(workeval.evaluation) AS evaluation_aggregator');
$groupby = $qb->getDQLPart('groupBy');

View File

@@ -0,0 +1,96 @@
<?php
namespace Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
final class GeographicalUnitStatAggregator implements AggregatorInterface
{
/*
private EntityRepository $repository;
public function __construct(
EntityManagerInterface $em
) {
$this->repository = $em->getRepository(...::class);
}
*/
/**
* @inheritDoc
*/
public function getLabels($key, array $values, $data)
{
return function ($value): string {
if ('_header' === $value) {
return 'Geographical unit';
}
$g = $this->repository->find($value);
return $g; //...
};
}
/**
* @inheritDoc
*/
public function getQueryKeys($data): array
{
return ['geographicalunitstat_aggregator'];
}
/**
* @inheritDoc
*/
public function buildForm(FormBuilderInterface $builder)
{
// TODO: Implement buildForm() method.
}
/**
* @inheritDoc
*/
public function getTitle(): string
{
return 'Group by geographical unit';
}
/**
* @inheritDoc
*/
public function addRole(): ?string
{
return null;
}
/**
* @inheritDoc
*/
public function alterQuery(QueryBuilder $qb, $data)
{
//$qb->addSelect('... AS geographicalunitstat_aggregator');
$groupby = $qb->getDQLPart('groupBy');
if (!empty($groupBy)) {
$qb->addGroupBy('geographicalunitstat_aggregator');
} else {
$qb->groupBy('geographicalunitstat_aggregator');
}
}
/**
* @inheritDoc
*/
public function applyOn(): string
{
return Declarations::ACP_TYPE;
}
}

View File

@@ -39,7 +39,9 @@ final class JobAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acp.job', 'j');
if (!in_array('acpjob', $qb->getAllAliases(), true)) {
$qb->join('acp.job', 'acpjob');
}
$qb->addSelect('IDENTITY(acp.job) AS job_aggregator');

View File

@@ -41,7 +41,9 @@ final class OriginAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acp.origin', 'o');
if (!in_array('acporigin', $qb->getAllAliases(), true)) {
$qb->join('acp.origin', 'acporigin');
}
$qb->addSelect('o.id AS origin_aggregator');

View File

@@ -39,9 +39,11 @@ final class ReferrerAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acp.user', 'u');
if (!in_array('acpuser', $qb->getAllAliases(), true)) {
$qb->join('acp.user', 'acpuser');
}
$qb->addSelect('u.id AS referrer_aggregator');
$qb->addSelect('acpuser.id AS referrer_aggregator');
$groupBy = $qb->getDQLPart('groupBy');

View File

@@ -35,8 +35,8 @@ final class RequestorAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
if (!in_array('part', $qb->getAllAliases(), true)) {
$qb->join('acp.participations', 'part');
if (!in_array('acppart', $qb->getAllAliases(), true)) {
$qb->join('acp.participations', 'acppart');
}
$qb->addSelect("
@@ -44,7 +44,7 @@ final class RequestorAggregator implements AggregatorInterface
WHEN acp.requestorPerson IS NOT NULL
THEN
( CASE
WHEN acp.requestorPerson = part.person
WHEN acp.requestorPerson = acppart.person
THEN 'is person concerned'
ELSE 'is other person'
END )

View File

@@ -39,9 +39,11 @@ final class ScopeAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acp.scopes', 's');
if (!in_array('acpscope', $qb->getAllAliases(), true)) {
$qb->join('acp.scopes', 'acpscope');
}
$qb->addSelect('s.id as scope_aggregator');
$qb->addSelect('acpscope.id as scope_aggregator');
$groupBy = $qb->getDQLPart('groupBy');

View File

@@ -39,8 +39,11 @@ final class SocialIssueAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acp.socialIssues', 'si');
$qb->addSelect('si.id as socialissue_aggregator');
if (!in_array('acpsocialissue', $qb->getAllAliases(), true)) {
$qb->join('acp.socialIssues', 'acpsocialissue');
}
$qb->addSelect('acpsocialissue.id as socialissue_aggregator');
$groupBy = $qb->getDQLPart('groupBy');

View File

@@ -15,6 +15,7 @@ use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Export\ExportElementValidatedInterface;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Entity\Household\HouseholdMember;
use Chill\PersonBundle\Repository\Household\PositionRepository;
use DateTime;
use Doctrine\ORM\QueryBuilder;
@@ -45,22 +46,27 @@ final class HouseholdPositionAggregator implements AggregatorInterface, ExportEl
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->resetDQLPart('from');
$qb->from('ChillPersonBundle:Household\HouseholdMember', 'hm');
$qb->from(HouseholdMember::class, 'member');
$qb->join('hm.person', 'person');
$qb->join('person.center', 'center');
if (!in_array('memberperson', $qb->getAllAliases(), true)) {
$qb->join('member.person', 'memberperson');
}
if (!in_array('membercenter', $qb->getAllAliases(), true)) {
$qb->join('memberperson.center', 'membercenter');
}
$qb->andWhere($qb->expr()->andX(
$qb->expr()->lte('hm.startDate', ':date'),
$qb->expr()->lte('member.startDate', ':date'),
$qb->expr()->orX(
$qb->expr()->isNull('hm.endDate'),
$qb->expr()->gte('hm.endDate', ':date')
$qb->expr()->isNull('member.endDate'),
$qb->expr()->gte('member.endDate', ':date')
)
));
$qb->setParameter('date', $data['date_position']);
$qb->addSelect('IDENTITY(hm.position) AS household_position_aggregator');
$qb->addSelect('IDENTITY(member.position) AS household_position_aggregator');
$groupBy = $qb->getDQLPart('groupBy');

View File

@@ -37,8 +37,11 @@ final class MaritalStatusAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('person.maritalStatus', 'ms');
$qb->addSelect('ms.id as marital_status_aggregator');
if (!in_array('personmarital', $qb->getAllAliases(), true)) {
$qb->join('person.maritalStatus', 'personmarital');
}
$qb->addSelect('personmarital.id as marital_status_aggregator');
$groupBy = $qb->getDQLPart('groupBy');

View File

@@ -38,8 +38,11 @@ final class ActionTypeAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acpw.socialAction', 'sa');
$qb->addSelect('sa.id as action_type_aggregator');
if (!in_array('acpwsocialaction', $qb->getAllAliases(), true)) {
$qb->join('acpw.socialAction', 'acpwsocialaction');
}
$qb->addSelect('acpwsocialaction.id as action_type_aggregator');
$groupBy = $qb->getDQLPart('groupBy');

View File

@@ -37,8 +37,11 @@ final class GoalAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acpw.goals', 'g');
$qb->addSelect('g.id as goal_aggregator');
if (!in_array('goal', $qb->getAllAliases(), true)) {
$qb->join('acpw.goals', 'goal');
}
$qb->addSelect('goal.id as goal_aggregator');
$groupBy = $qb->getDQLPart('groupBy');

View File

@@ -39,9 +39,11 @@ final class JobAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acpw.referrers', 'u');
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
$qb->join('acpw.referrers', 'acpwuser');
}
$qb->addSelect('IDENTITY(u.userJob) as job_aggregator');
$qb->addSelect('IDENTITY(acpwuser.userJob) as job_aggregator');
$groupBy = $qb->getDQLPart('groupBy');

View File

@@ -39,9 +39,11 @@ final class ReferrerAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acpw.referrers', 'u');
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
$qb->join('acpw.referrers', 'acpwuser');
}
$qb->addSelect('u.id AS referrer_aggregator');
$qb->addSelect('acpwuser.id AS referrer_aggregator');
$groupBy = $qb->getDQLPart('groupBy');

View File

@@ -37,10 +37,19 @@ final class ResultAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acpw.results', 'res');
$qb->join('acpw.goals', 'g');
$qb->join('g.results', 'gres');
$qb->addSelect('res.id, IDENTITY(g.results) as result_aggregator');
if (!in_array('acpwresult', $qb->getAllAliases(), true)) {
$qb->join('acpw.results', 'acpwresult');
}
if (!in_array('goal', $qb->getAllAliases(), true)) {
$qb->join('acpw.goals', 'goal');
}
if (!in_array('goalresult', $qb->getAllAliases(), true)) {
$qb->join('goal.results', 'goalresult');
}
$qb->addSelect('acpwresult.id, IDENTITY(goal.results) as result_aggregator');
$groupBy = $qb->getDQLPart('groupBy');

View File

@@ -39,9 +39,11 @@ final class ScopeAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acpw.referrers', 'u');
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
$qb->join('acpw.referrers', 'acpwuser');
}
$qb->addSelect('IDENTITY(u.mainScope) as scope_aggregator');
$qb->addSelect('IDENTITY(acpwuser.mainScope) as scope_aggregator');
$groupBy = $qb->getDQLPart('groupBy');

View File

@@ -88,11 +88,17 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$qb = $this->repository->createQueryBuilder('acp')
->join('acp.works', 'acpw')
->join('acpw.accompanyingPeriodWorkEvaluations', 'eval');
$qb = $this->repository->createQueryBuilder('acp');
$qb->select('COUNT(eval.id) AS export_result');
if (!in_array('acpw', $qb->getAllAliases(), true)) {
$qb->join('acp.works', 'acpw');
}
if (!in_array('workeval', $qb->getAllAliases(), true)) {
$qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval');
}
$qb->select('COUNT(workeval.id) AS export_result');
return $qb;
}

View File

@@ -88,13 +88,26 @@ class CountHousehold implements ExportInterface, GroupedExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$qb = $this->repository->createQueryBuilder('acp')
->join('acp.participations', 'acppart')
->join('acppart.person', 'person')
->join('person.householdParticipations', 'householdmember')
->join('householdmember.household', 'household');
$qb = $this->repository->createQueryBuilder('acp');
$qb->select('COUNT(DISTINCT householdmember.household) AS export_result');
if (!in_array('acppart', $qb->getAllAliases(), true)) {
$qb->join('acp.participations', 'acppart');
}
if (!in_array('partperson', $qb->getAllAliases(), true)) {
$qb->join('acppart.person', 'partperson');
}
if (!in_array('member', $qb->getAllAliases(), true)) {
$qb->join('partperson.householdParticipations', 'member');
}
if (!in_array('household', $qb->getAllAliases(), true)) {
$qb->join('member.household', 'household');
}
$qb->select('COUNT(DISTINCT member.household) AS export_result');
return $qb;
}

View File

@@ -88,11 +88,17 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$qb = $this->repository->createQueryBuilder('acp')
->join('acp.participations', 'acppart')
->join('acppart.person', 'person');
$qb = $this->repository->createQueryBuilder('acp');
$qb->select('COUNT(DISTINCT person.id) AS export_result');
if (!in_array('acppart', $qb->getAllAliases(), true)) {
$qb->join('acp.participations', 'acppart');
}
if (!in_array('partperson', $qb->getAllAliases(), true)) {
$qb->join('acppart.person', 'partperson');
}
$qb->select('COUNT(DISTINCT partperson.id) AS export_result');
return $qb;
}

View File

@@ -90,8 +90,11 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
{
$qb = $this->repository->createQueryBuilder('acp')
->join('acp.works', 'acpw');
$qb = $this->repository->createQueryBuilder('acp');
if (!in_array('acpw', $qb->getAllAliases(), true)) {
$qb->join('acp.works', 'acpw');
}
$qb->select('COUNT(acpw.id) as export_result');

View File

@@ -142,9 +142,9 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat
return 'List duplicates';
}
public function requiredRole(): Role
public function requiredRole(): string
{
return new Role(PersonVoter::DUPLICATE);
return PersonVoter::DUPLICATE;
}
public function validateForm($data, ExecutionContextInterface $context)

View File

@@ -43,14 +43,18 @@ class ActivityTypeFilter implements FilterInterface
// we replace indicator 'from' clause by 'act', and put 'acp' in a join
$qb->resetDQLPart('from');
$qb->from('ChillActivityBundle:Activity', 'act');
$qb->from('ChillActivityBundle:Activity', 'activity');
$qb
->join('act.accompanyingPeriod', 'acp')
->join('act.activityType', 'aty');
if (!in_array('actacp', $qb->getAllAliases(), true)) {
$qb->join('activity.accompanyingPeriod', 'actacp');
}
if (!in_array('acttype', $qb->getAllAliases(), true)) {
$qb->join('activity.activityType', 'acttype');
}
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->in('aty.id', ':activitytypes');
$clause = $qb->expr()->in('acttype.id', ':activitytypes');
if ($where instanceof Andx) {
$where->add($clause);

View File

@@ -73,8 +73,6 @@ class ConfidentialFilter implements FilterInterface
public function describeAction($data, $format = 'string'): array
{
dump($data, self::CHOICES);
foreach (self::CHOICES as $k => $v) {
if ($v === $data['accepted_confidentials']) {
$choice = $k;

View File

@@ -42,10 +42,12 @@ class CurrentUserScopeFilter implements FilterInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acp.scopes', 's');
if (!in_array('acpscope', $qb->getAllAliases(), true)) {
$qb->join('acp.scopes', 'acpscope');
}
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->eq('s.id', ':userscope');
$clause = $qb->expr()->eq('acpscope.id', ':userscope');
if ($where instanceof Andx) {
$where->add($clause);

View File

@@ -37,13 +37,20 @@ class EvaluationFilter implements FilterInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb
->join('acp.works', 'acpw')
->join('acpw.accompanyingPeriodWorkEvaluations', 'we')
->join('we.evaluation', 'ev');
if (!in_array('acpw', $qb->getAllAliases(), true)) {
$qb->join('acp.works', 'acpw');
}
if (!in_array('workeval', $qb->getAllAliases(), true)) {
$qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval');
}
if (!in_array('eval', $qb->getAllAliases(), true)) {
$qb->join('workeval.evaluation', 'eval');
}
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->in('ev.id', ':evaluations');
$clause = $qb->expr()->in('eval.id', ':evaluations');
if ($where instanceof Andx) {
$where->add($clause);

View File

@@ -55,11 +55,14 @@ final class RequestorFilter implements FilterInterface
switch ($data['accepted_choices']) {
case 'participation':
$qb->join('acp.participations', 'part');
if (!in_array('acppart', $qb->getAllAliases(), true)) {
$qb->join('acp.participations', 'acppart');
}
$clause = $qb->expr()->andX(
$qb->expr()->isNotNull('acp.requestorPerson'),
$qb->expr()->eq('acp.requestorPerson', 'part.person')
$qb->expr()->eq('acp.requestorPerson', 'acppart.person')
);
break;
@@ -67,7 +70,9 @@ final class RequestorFilter implements FilterInterface
case 'other_person':
$expr = $this->em->getExpressionBuilder();
$qb->join('acp.participations', 'part');
if (!in_array('acppart', $qb->getAllAliases(), true)) {
$qb->join('acp.participations', 'acppart');
}
$clause = $expr->andX(
$expr->isNotNull('acp.requestorPerson'),
@@ -76,10 +81,10 @@ final class RequestorFilter implements FilterInterface
// subquery
$this->em->createQueryBuilder()
->select('identity(acp2.requestorPerson)')
->from('ChillPersonBundle:AccompanyingPeriod', 'acp2')
->join('acp2.participations', 'part2')
->where($expr->eq('acp2.requestorPerson', 'part2.person'))
->join('acp2.participations', 'acppart2')
->select('identity(acp2.requestorPerson)')
->where($expr->eq('acp2.requestorPerson', 'acppart2.person'))
->getDQL()
)
);

View File

@@ -46,10 +46,13 @@ class SocialActionFilter implements FilterInterface
if (!in_array('acpw', $qb->getAllAliases(), true)) {
$qb->join('acp.works', 'acpw');
}
$qb->join('acpw.socialAction', 'sa');
if (!in_array('acpwsocialaction', $qb->getAllAliases(), true)) {
$qb->join('acpw.socialAction', 'acpwsocialaction');
}
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->in('sa.id', ':socialactions');
$clause = $qb->expr()->in('acpwsocialaction.id', ':socialactions');
if ($where instanceof Andx) {
$where->add($clause);

View File

@@ -50,10 +50,12 @@ class SocialIssueFilter implements FilterInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acp.socialIssues', 'si');
if (!in_array('acpsocialissue', $qb->getAllAliases(), true)) {
$qb->join('acp.socialIssues', 'acpsocialissue');
}
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->in('si.id', ':socialissues');
$clause = $qb->expr()->in('acpsocialissue.id', ':socialissues');
if ($where instanceof Andx) {
$where->add($clause);

View File

@@ -39,18 +39,29 @@ class ResidentialAddressAtThirdpartyFilter implements FilterInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->resetDQLPart('from');
$qb->from('ChillPersonBundle:Person\ResidentialAddress', 'ra');
$qb->from('ChillPersonBundle:Person\ResidentialAddress', 'resaddr');
$qb->join('ra.person', 'person');
$qb->join('person.center', 'center');
$qb->join('ra.hostThirdParty', 't');
$qb->join('t.categories', 'tc');
if (!in_array('resaddrperson', $qb->getAllAliases(), true)) {
$qb->join('resaddr.person', 'resaddrperson');
}
if (!in_array('resaddrcenter', $qb->getAllAliases(), true)) {
$qb->join('resaddrperson.center', 'resaddrcenter');
}
if (!in_array('tparty', $qb->getAllAliases(), true)) {
$qb->join('resaddr.hostThirdParty', 'tparty');
}
if (!in_array('tpartycat', $qb->getAllAliases(), true)) {
$qb->join('tparty.categories', 'tpartycat');
}
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->andX(
$qb->expr()->isNotNull('ra.hostThirdParty'),
$qb->expr()->between(':date', 'ra.startDate', 'ra.endDate'),
$qb->expr()->in('tc.id', ':type')
$qb->expr()->isNotNull('resaddr.hostThirdParty'),
$qb->expr()->between(':date', 'resaddr.startDate', 'resaddr.endDate'),
$qb->expr()->in('tpartycat.id', ':type')
);
if ($where instanceof Expr\Andx) {

View File

@@ -26,13 +26,18 @@ class ResidentialAddressAtUserFilter implements FilterInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->resetDQLPart('from');
$qb->from('ChillPersonBundle:Person\ResidentialAddress', 'ra');
$qb->from('ChillPersonBundle:Person\ResidentialAddress', 'resaddr');
$qb->join('ra.person', 'person');
$qb->join('person.center', 'center');
if (!in_array('resaddrperson', $qb->getAllAliases(), true)) {
$qb->join('resaddr.person', 'resaddrperson');
}
if (!in_array('resaddrcenter', $qb->getAllAliases(), true)) {
$qb->join('resaddrperson.center', 'resaddrcenter');
}
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->isNotNull('ra.hostPerson');
$clause = $qb->expr()->isNotNull('resaddr.hostPerson');
if ($where instanceof Andx) {
$where->add($clause);

View File

@@ -42,10 +42,12 @@ class JobFilter implements FilterInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acpw.referrers', 'u');
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
$qb->join('acpw.referrers', 'acpwuser');
}
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->in('u.userJob', ':job');
$clause = $qb->expr()->in('acpwuser.userJob', ':job');
if ($where instanceof Andx) {
$where->add($clause);

View File

@@ -36,10 +36,12 @@ class ReferrerFilter implements FilterInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acpw.referrers', 'u');
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
$qb->join('acpw.referrers', 'acpwuser');
}
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->in('u', ':agents');
$clause = $qb->expr()->in('acpwuser', ':agents');
if ($where instanceof Andx) {
$where->add($clause);

View File

@@ -42,10 +42,12 @@ class ScopeFilter implements FilterInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->join('acpw.referrers', 'u');
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
$qb->join('acpw.referrers', 'acpwuser');
}
$where = $qb->getDQLPart('where');
$clause = $qb->expr()->in('u.mainScope', ':scope');
$clause = $qb->expr()->in('acpwuser.mainScope', ':scope');
if ($where instanceof Andx) {
$where->add($clause);

View File

@@ -79,8 +79,8 @@ final class ReferrerFilterTest extends AbstractFilterTest
->select('acpw.id'),
$em->createQueryBuilder()
->from('ChillPersonBundle:AccompanyingPeriod\AccompanyingPeriodWork', 'acpw')
->join('acpw.referrers', 'r')
->select('r.id'),
->join('acpw.referrers', 'acpwuser')
->select('acpwuser.id'),
];
}
}

View File

@@ -44,12 +44,12 @@ services:
tags:
- { name: chill.export_filter, alias: accompanyingcourse_step_filter }
chill.person.export.filter_geographicalunitstat:
class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\GeographicalUnitStatFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: accompanyingcourse_geographicalunitstat_filter }
#chill.person.export.filter_geographicalunitstat:
# class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\GeographicalUnitStatFilter
# autowire: true
# autoconfigure: true
# tags:
# - { name: chill.export_filter, alias: accompanyingcourse_geographicalunitstat_filter }
chill.person.export.filter_socialaction:
class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\SocialActionFilter
@@ -178,6 +178,13 @@ services:
tags:
- { name: chill.export_aggregator, alias: accompanyingcourse_step_aggregator }
#chill.person.export.aggregator_geographicalunitstat:
# class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\GeographicalUnitStatAggregator
# autowire: true
# autoconfigure: true
# tags:
# - { name: chill.export_aggregator, alias: accompanyingcourse_geographicalunitstat_aggregator }
chill.person.export.aggregator_socialaction:
class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\SocialActionAggregator
autowire: true

View File

@@ -449,6 +449,8 @@ Step: Statut
Group by step: Grouper les parcours par statut du parcours
Filter by geographical unit: Filtrer les parcours par zone géographique
Group by geographical unit: Grouper les parcours par zone géographique
Geographical unit: Zone géographique
Filter by socialaction: Filtrer les parcours par action d'accompagnement
Accepted socialactions: Actions d'accompagnement