diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php index a5cbc16f1..269924a8a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php @@ -61,7 +61,11 @@ class BySocialActionAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->addSelect('IDENTITY(activity.socialActions) AS socialaction_aggregator'); + if(!in_array('socialaction', $qb->getAllAliases())) { + $qb->join('activity.socialActions', 'socialaction'); + } + + $qb->addSelect('socialaction.id AS socialaction_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php index 193f93f5c..0e4b9ab8e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php @@ -62,7 +62,11 @@ class BySocialIssueAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->addSelect('IDENTITY(activity.socialIssues) AS socialissue_aggregator'); + if (!in_array('socialissue', $qb->getAllAliases())) { + $qb->join('activity.socialIssues', 'socialissue'); + } + + $qb->addSelect('socialissue.id AS socialissue_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php index 583e3589a..5a9e633ef 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php @@ -30,7 +30,7 @@ class ByThirdpartyAggregator implements AggregatorInterface { return function ($value): string { if ($value === '_header') { - return 'Thirdparty'; + return 'Accepted thirdparty'; } $tp = $this->thirdPartyRepository->find($value); @@ -61,7 +61,11 @@ class ByThirdpartyAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->addSelect('IDENTITY(activity.thirdParties) AS thirdparty_aggregator'); + if (!in_array('thirdparty', $qb->getAllAliases())) { + $qb->join('activity.thirdParties', 'thirdparty'); + } + + $qb->addSelect('thirdparty.id AS thirdparty_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php index 9cd6601c1..95c9998b8 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php @@ -61,7 +61,11 @@ class ByUserAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->addSelect('IDENTITY(activity.users) AS users_aggregator'); + if (!in_array('user', $qb->getAllAliases())) { + $qb->join('activity.users', 'user'); + } + + $qb->addSelect('user.id AS users_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php index ef866f4f6..11e508b88 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php @@ -16,7 +16,7 @@ class DateAggregator implements AggregatorInterface { private const CHOICES = [ 'by month' => 'month', - 'by week' => 'week', // sur base du numéro de la semaine + 'by week' => 'week', // numéro de la semaine 'by year' => 'year', ]; @@ -60,6 +60,7 @@ class DateAggregator implements AggregatorInterface public function buildForm(FormBuilderInterface $builder) { $builder->add('by_date', ChoiceType::class, [ + 'label' => 'Frequency', 'choices' => self::CHOICES, 'multiple' => false, 'expanded' => true, diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php index 088ac0e4a..aa5052aaa 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php @@ -63,7 +63,11 @@ class LocationTypeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->addSelect('IDENTITY(activity.location) AS locationtype_aggregator'); + if (!in_array('location', $qb->getAllAliases())) { + $qb->join('activity.location', 'location'); + } + + $qb->addSelect('IDENTITY(location.locationType) AS locationtype_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php index 3cdeee0f9..675098c60 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php @@ -15,6 +15,7 @@ use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Repository\UserRepository; +use Chill\MainBundle\Templating\Entity\UserRender; use Closure; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -26,10 +27,14 @@ class ActivityUserAggregator implements AggregatorInterface private UserRepository $userRepository; + private UserRender $userRender; + public function __construct( - UserRepository $userRepository + UserRepository $userRepository, + UserRender $userRender ) { $this->userRepository = $userRepository; + $this->userRender = $userRender; } public function addRole() @@ -63,10 +68,12 @@ class ActivityUserAggregator implements AggregatorInterface return function ($value) { if ('_header' === $value) { - return 'activity user'; + return 'Activity user'; } - return $this->userRepository->find($value)->getUsername(); + $u = $this->userRepository->find($value); + + return $this->userRender->renderString($u, []); }; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php index ea125adb2..58d77c73e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php @@ -48,7 +48,7 @@ class BySocialActionFilter implements FilterInterface } return ['Filtered activity by linked socialaction: only %actions%', [ - '%actions%' => implode(", ou", $actions) + '%actions%' => implode(", ou ", $actions) ]]; } @@ -61,7 +61,11 @@ class BySocialActionFilter implements FilterInterface { $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('activity.socialActions', ':socialactions'); + if (!in_array('socialaction', $qb->getAllAliases())) { + $qb->join('activity.socialActions', 'socialaction'); + } + + $clause = $qb->expr()->in('socialaction.id', ':socialactions'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php index 247b0ea32..052b780ff 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php @@ -48,7 +48,7 @@ class BySocialIssueFilter implements FilterInterface } return ['Filtered activity by linked socialissue: only %issues%', [ - '%issues%' => implode(", ou", $issues) + '%issues%' => implode(", ou ", $issues) ]]; } @@ -61,7 +61,11 @@ class BySocialIssueFilter implements FilterInterface { $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('activity.socialIssues', ':socialissues'); + if (!in_array('socialissue', $qb->getAllAliases())) { + $qb->join('activity.socialIssues', 'socialissue'); + } + + $clause = $qb->expr()->in('socialissue.id', ':socialissues'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php index 9fef06f72..b128b03aa 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php @@ -48,7 +48,7 @@ class ByUserFilter implements FilterInterface } return ['Filtered activity by linked users: only %users%', [ - '%users%' => implode(", ou", $users) + '%users%' => implode(", ou ", $users) ]]; } @@ -61,7 +61,11 @@ class ByUserFilter implements FilterInterface { $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('activity.users', ':users'); + if (!in_array('user', $qb->getAllAliases())) { + $qb->join('activity.users', 'user'); + } + + $clause = $qb->expr()->in('user.id', ':users'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php index 22e1f3c30..cf29f20f2 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php @@ -50,7 +50,7 @@ class LocationTypeFilter implements FilterInterface } return ['Filtered activity by locationtype: only %types%', [ - '%types%' => implode(", ou", $types) + '%types%' => implode(", ou ", $types) ]]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php index 02aff8cad..d1455ea89 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php @@ -49,7 +49,7 @@ class UserFilter implements FilterInterface } return ['Filtered activity by user: only %users%', [ - '%users%' => implode(", ou", $users) + '%users%' => implode(", ou ", $users) ]]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php index abc26d418..987704ab8 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php @@ -52,7 +52,7 @@ class UserScopeFilter implements FilterInterface } return ['Filtered activity by userscope: only %scopes%', [ - '%scopes%' => implode(", ou", $scopes) + '%scopes%' => implode(", ou ", $scopes) ]]; } diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 0bef84ba0..4041b97dc 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -256,7 +256,7 @@ Filter activity by linked users: Filtrer les activités par TMS 'Filtered activity by linked users: only %users%': "Filtré par TMS: uniquement %users%" Accepted users: TMS(s) Filter activity by emergency: Filtrer les activités par urgence -'Filtered activity by emergency: only %emergency%': "Filtré par urgence: uniquement %emergency%" +'Filtered activity by emergency: only %emergency%': "Filtré par urgence: uniquement si %emergency%" activity is emergency: l'activité est urgente activity is not emergency: l'activité n'est pas urgente Filter activity by sentreceived: Filtrer les activités par envoyé/reçu @@ -277,7 +277,7 @@ Accepted userscope: Services #aggregators Activity type: Type d'activité -Activity user: Utilisateur lié à l'activity +Activity user: Utilisateur lié à l'activité By reason: Par sujet By category of reason: Par catégorie de sujet Reason's level: Niveau du sujet @@ -288,8 +288,13 @@ Aggregate by activity reason: Grouper les activités par sujet Group activity by locationtype: Grouper les activités par type de localisation Group activity by date: Grouper les activités par date +Frequency: Fréquence +by month: par mois +by week: par semaine +by year: par année Group activity by linked users: Grouper les activités par TMS impliqué Group activity by linked thirdparties: Grouper les activités par tiers impliqué +Accepted thirdparty: Tiers impliqué Group activity by linked socialaction: Grouper les activités par action liée Group activity by linked socialissue: Grouper les activités par problématique liée Group activity by userscope: Grouper les activités par service du créateur