mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Feature: [export][activity] Add an aggregator to group by sent / received
This commit is contained in:
parent
60f93f7f12
commit
9cf06c147f
@ -16,15 +16,27 @@ use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class SentReceivedAggregator implements AggregatorInterface
|
||||
{
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
/**
|
||||
* @param TranslatorInterface $translator
|
||||
*/
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
{
|
||||
$qb->addSelect('activity.sentReceived AS activity_sentreceived_aggregator')
|
||||
->addGroupBy('activity_sentreceived_aggregator');
|
||||
@ -35,16 +47,16 @@ class SentReceivedAggregator implements AggregatorInterface
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
public function buildForm(FormBuilderInterface $builder): void
|
||||
{
|
||||
// No form needed
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
public function getLabels($key, array $values, $data): callable
|
||||
{
|
||||
return static function ($value): string {
|
||||
return function (?string $value): string {
|
||||
if ('_header' === $value) {
|
||||
return '';
|
||||
return 'export.aggregator.activity.by_sent_received.Sent or received';
|
||||
}
|
||||
|
||||
switch ($value) {
|
||||
@ -52,10 +64,10 @@ class SentReceivedAggregator implements AggregatorInterface
|
||||
return '';
|
||||
|
||||
case 'sent':
|
||||
return 'is sent';
|
||||
return $this->translator->trans('export.aggregator.activity.by_sent_received.is sent');
|
||||
|
||||
case 'received':
|
||||
return 'is received';
|
||||
return $this->translator->trans('export.aggregator.activity.by_sent_received.is received');
|
||||
|
||||
default:
|
||||
throw new LogicException(sprintf('The value %s is not valid', $value));
|
||||
@ -70,6 +82,6 @@ class SentReceivedAggregator implements AggregatorInterface
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by sentreceived';
|
||||
return 'export.aggregator.activity.by_sent_received.Group activity by sentreceived';
|
||||
}
|
||||
}
|
||||
|
@ -260,8 +260,6 @@ activity is not emergency: l'activité n'est pas urgente
|
||||
Filter activity by sentreceived: Filtrer les activités par envoyé/reçu
|
||||
'Filtered activity by sentreceived: only %sentreceived%': "Filtré par envoyé/reçu: uniquement %sentreceived%"
|
||||
Accepted sentreceived: ''
|
||||
is sent: envoyé
|
||||
is received: reçu
|
||||
Filter activity by linked socialaction: Filtrer les activités par action liée
|
||||
'Filtered activity by linked socialaction: only %actions%': "Filtré par action liée: uniquement %actions%"
|
||||
Filter activity by linked socialissue: Filtrer les activités par problématique liée
|
||||
@ -280,7 +278,6 @@ Accepted userscope: Services
|
||||
Filter acp which has no activity: Filtrer les parcours qui n’ont pas d’activité
|
||||
Filtered acp which has no activities: Filtrer les parcours sans activité associée
|
||||
Group acp by activity number: Grouper les parcours par nombre d’activité
|
||||
Group activity by sentreceived: Grouper les activités par envoyé / reçu
|
||||
|
||||
#aggregators
|
||||
Activity type: Type d'activité
|
||||
@ -337,3 +334,10 @@ export:
|
||||
by_usersscope:
|
||||
Filter by users scope: Filtrer les activités par services d'au moins un utilisateur participant
|
||||
'Filtered activity by users scope: only %scopes%': 'Filtré par service d''au moins un utilisateur participant: seulement %scopes%'
|
||||
aggregator:
|
||||
activity:
|
||||
by_sent_received:
|
||||
Sent or received: Envoyé ou reçu
|
||||
is sent: envoyé
|
||||
is received: reçu
|
||||
Group activity by sentreceived: Grouper les activités par envoyé / reçu
|
||||
|
Loading…
x
Reference in New Issue
Block a user