diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php index a77838167..58fcb2874 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CurrentActionAggregator.php @@ -16,19 +16,27 @@ use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\QueryBuilder; use LogicException; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Contracts\Translation\TranslatorInterface; class CurrentActionAggregator implements AggregatorInterface { + private 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(' - (CASE true WHEN acpw.startDate IS NULL ELSE false END) + (CASE WHEN acpw.endDate IS NULL THEN true ELSE false END) AS acpw_current_action_aggregator ') ->addGroupBy('acpw_current_action_aggregator'); @@ -39,24 +47,24 @@ class CurrentActionAggregator implements AggregatorInterface return Declarations::SOCIAL_WORK_ACTION_TYPE; } - public function buildForm(FormBuilderInterface $builder) + public function buildForm(FormBuilderInterface $builder): void { // No form needed } public function getLabels($key, array $values, $data) { - return static function ($value): string { + return function ($value): string { if ('_header' === $value) { - return ''; + return 'export.aggregator.course_work.by_current_action.Current action ?'; } switch ($value) { case true: - return 'Current action'; + return $this->translator->trans('export.aggregator.course_work.by_current_action.Current action'); case false: - return 'Not current action'; + return $this->translator->trans('export.aggregator.course_work.by_current_action.Not current action'); default: throw new LogicException(sprintf('The value %s is not valid', $value)); @@ -71,6 +79,6 @@ class CurrentActionAggregator implements AggregatorInterface public function getTitle(): string { - return 'Group by current actions'; + return 'export.aggregator.course_work.by_current_action.Group by current actions'; } } diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index 8b2d9d2b8..13c51762f 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -94,3 +94,7 @@ services: - { name: chill.export_aggregator, alias: social_work_actions_goal_result_aggregator } Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\CurrentActionAggregator: + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: social_work_actions_current_aggregator } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index df4b0fab2..0833f57e3 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -577,9 +577,6 @@ Group by creator job: Grouper les parcours par métier du créateur Filter by current actions: Filtrer les actions en cours Filtered by current action: 'Filtré: uniquement les actions en cours (sans date de fin)' -Group by current actions: Grouper les actions en cours -Current action: Actions en cours -Not current action: Actions terminées Filter by start date evaluations: Filtrer les évaluations par date de début Filter by end date evaluations: Filtrer les évaluations par date de fin start period date: Date de début de la période @@ -1015,6 +1012,12 @@ export: Calc date: Date de calcul de la composition du ménage by_number_of_action: Number of actions: Nombre d'actions + course_work: + by_current_action: + Current action ?: Action en cours ? + Group by current actions: Grouper les actions en cours + Current action: Action en cours + Not current action: Action terminée filter: course: by_user_scope: