mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
Evaluation HavingEndDate Aggregator
This commit is contained in:
parent
441c5c8da7
commit
05f9a83bed
@ -0,0 +1,75 @@
|
||||
<?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 HavingEndDateAggregator implements AggregatorInterface
|
||||
{
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb
|
||||
->addSelect('
|
||||
CASE true WHEN workeval.endDAte IS NULL ELSE false END
|
||||
AS eval_enddate_aggregator
|
||||
')
|
||||
->addGroupBy('eval_enddate_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 '';
|
||||
}
|
||||
switch ($value) {
|
||||
case true:
|
||||
return 'enddate is specified';
|
||||
|
||||
case false:
|
||||
return 'enddate is not specified';
|
||||
|
||||
default:
|
||||
throw new \LogicException(sprintf('The value %s is not valid', $value));
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['eval_enddate_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group evaluations having end date';
|
||||
}
|
||||
}
|
@ -611,6 +611,10 @@ maxdate is specified: la date d'échéance est spécifiée
|
||||
maxdate is not specified: la date d'échéance n'est pas spécifiée
|
||||
"Filtered by maxdate: only %choice%": "Filtré par date d'échéance: uniquement si %choice%"
|
||||
|
||||
Group evaluations having end date: Grouper les évaluations qui ont une date de fin
|
||||
enddate is specified: la date de fin est spécifiée
|
||||
enddate is not specified: la date de fin n'est pas spécifiée
|
||||
|
||||
## household filters/aggr
|
||||
Filter by composition: Filtrer les ménages par composition familiale
|
||||
Accepted composition: Composition familiale
|
||||
|
Loading…
x
Reference in New Issue
Block a user