create 13 new export/filters/aggregators in Person and AsideActivity Bundles

* minor corrections on last commit
* modify related files (declaration, messages.fr, repository)
* yaml service declaration
This commit is contained in:
2022-10-28 16:26:11 +02:00
parent 43d9ba1ba5
commit f1fb77187f
21 changed files with 923 additions and 40 deletions

View File

@@ -0,0 +1,60 @@
<?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\Export\Aggregator\EvaluationAggregators;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
class ByEndDateAggregator implements AggregatorInterface
{
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->addSelect('AS _aggregator')
->addGroupBy('_aggregator');
}
public function applyOn(): string
{
return Declarations::EVAL_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
// No form needed
}
public function getLabels($key, array $values, $data)
{
return function ($value): string {
if ('_header' === $value) {
return '';
}
};
}
public function getQueryKeys($data): array
{
return ['_aggregator'];
}
public function getTitle(): string
{
return 'Group by end date evaluations';
}
}

View File

@@ -0,0 +1,60 @@
<?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\Export\Aggregator\EvaluationAggregators;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
class ByMaxDateAggregator implements AggregatorInterface
{
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->addSelect('AS _aggregator')
->addGroupBy('_aggregator');
}
public function applyOn(): string
{
return Declarations::EVAL_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
// No form needed
}
public function getLabels($key, array $values, $data)
{
return function ($value): string {
if ('_header' === $value) {
return '';
}
};
}
public function getQueryKeys($data): array
{
return ['_aggregator'];
}
public function getTitle(): string
{
return 'Group by max date evaluations';
}
}

View File

@@ -0,0 +1,60 @@
<?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\Export\Aggregator\EvaluationAggregators;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
class ByStartDateAggregator implements AggregatorInterface
{
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->addSelect('AS _aggregator')
->addGroupBy('_aggregator');
}
public function applyOn(): string
{
return Declarations::EVAL_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
// No form needed
}
public function getLabels($key, array $values, $data)
{
return function ($value): string {
if ('_header' === $value) {
return '';
}
};
}
public function getQueryKeys($data): array
{
return ['_aggregator'];
}
public function getTitle(): string
{
return 'Group by start date evaluations';
}
}

View File

@@ -0,0 +1,60 @@
<?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\Export\Aggregator\SocialWorkAggregators;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
class CurrentActionAggregator implements AggregatorInterface
{
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->addSelect('AS _aggregator')
->addGroupBy('_aggregator');
}
public function applyOn(): string
{
return Declarations::SOCIAL_WORK_ACTION_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
// No form needed
}
public function getLabels($key, array $values, $data)
{
return function ($value): string {
if ('_header' === $value) {
return '';
}
};
}
public function getQueryKeys($data): array
{
return ['_aggregator'];
}
public function getTitle(): string
{
return 'Group by current actions';
}
}

View File

@@ -0,0 +1,55 @@
<?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\Export\Filter\EvaluationFilters;
use Chill\MainBundle\Export\FilterInterface;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
class ByEndDateFilter implements FilterInterface
{
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$qb
->andWhere(
$qb->expr()->in('', ':')
)
->setParameter('', $data[]);
}
public function applyOn(): string
{
return Declarations::EVAL_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
$builder->add();
}
public function describeAction($data, $format = 'string'): array
{
return ['', [
]];
}
public function getTitle(): string
{
return 'Filter by end date evaluations';
}
}

View File

@@ -0,0 +1,55 @@
<?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\Export\Filter\EvaluationFilters;
use Chill\MainBundle\Export\FilterInterface;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
class ByMaxDateFilter implements FilterInterface
{
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$qb
->andWhere(
$qb->expr()->in('', ':')
)
->setParameter('', $data[]);
}
public function applyOn(): string
{
return Declarations::EVAL_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
$builder->add();
}
public function describeAction($data, $format = 'string'): array
{
return ['', [
]];
}
public function getTitle(): string
{
return 'Filter by max date evaluations';
}
}

View File

@@ -0,0 +1,55 @@
<?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\Export\Filter\EvaluationFilters;
use Chill\MainBundle\Export\FilterInterface;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
class ByStartDateFilter implements FilterInterface
{
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$qb
->andWhere(
$qb->expr()->in('', ':')
)
->setParameter('', $data[]);
}
public function applyOn(): string
{
return Declarations::EVAL_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
$builder->add();
}
public function describeAction($data, $format = 'string'): array
{
return ['', [
]];
}
public function getTitle(): string
{
return 'Filter by start date evaluations';
}
}

View File

@@ -0,0 +1,55 @@
<?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\Export\Filter\EvaluationFilters;
use Chill\MainBundle\Export\FilterInterface;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
class CurrentEvaluationsFilter implements FilterInterface
{
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$qb
->andWhere(
$qb->expr()->in('', ':')
)
->setParameter('', $data[]);
}
public function applyOn(): string
{
return Declarations::EVAL_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
$builder->add();
}
public function describeAction($data, $format = 'string'): array
{
return ['', [
]];
}
public function getTitle(): string
{
return 'Filter by current evaluations';
}
}

View File

@@ -0,0 +1,55 @@
<?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\Export\Filter\SocialWorkFilters;
use Chill\MainBundle\Export\FilterInterface;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
class CurrentActionFilter implements FilterInterface
{
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
{
$qb
->andWhere(
$qb->expr()->in('', ':')
)
->setParameter('', $data[]);
}
public function applyOn(): string
{
return Declarations::SOCIAL_WORK_ACTION_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
{
$builder->add();
}
public function describeAction($data, $format = 'string'): array
{
return ['', [
]];
}
public function getTitle(): string
{
return 'Filter by current actions';
}
}