diff --git a/.changes/unreleased/DX-20251027-150053.yaml b/.changes/unreleased/DX-20251027-150053.yaml deleted file mode 100644 index 880894bd4..000000000 --- a/.changes/unreleased/DX-20251027-150053.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: DX -body: | - Send notifications log to dedicated channel, if it exists -time: 2025-10-27T15:00:53.309372316+01:00 -custom: - Issue: "" - SchemaChange: No schema change diff --git a/.changes/unreleased/Fixed-20251119-133324.yaml b/.changes/unreleased/Fixed-20251119-133324.yaml new file mode 100644 index 000000000..408863dfe --- /dev/null +++ b/.changes/unreleased/Fixed-20251119-133324.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: Insert name of file as the document title when uploading +time: 2025-11-19T13:33:24.778116633+01:00 +custom: + Issue: "" + SchemaChange: No schema change diff --git a/.changes/unreleased/Fixed-20251119-134802.yaml b/.changes/unreleased/Fixed-20251119-134802.yaml new file mode 100644 index 000000000..8c9250c40 --- /dev/null +++ b/.changes/unreleased/Fixed-20251119-134802.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: Add missing path paramater 'id' for editing multiple participations +time: 2025-11-19T13:48:02.078949572+01:00 +custom: + Issue: "" + SchemaChange: No schema change diff --git a/.changes/v4.7.0.md b/.changes/v4.7.0.md new file mode 100644 index 000000000..48e6095fc --- /dev/null +++ b/.changes/v4.7.0.md @@ -0,0 +1,21 @@ +## v4.7.0 - 2025-11-10 +### Feature +* ([#385](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/385)) Create invitation list in user menu +* ([#404](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/404)) Add columns for comments linked to an activity in the activity list export +### Fixed +* ([#451](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/451)) Fix: display also social actions linked to parents of the selected social issue +* ([#453](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/453)) Fix: export actions and their results in csv even when action does not have any goals attached to it. +* Fix the possibility to delete a workflow + + **Schema Change**: Drop or rename table or columns, or enforce new constraint that must be manually fixed +* ([#457](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/457)) Fix the fusion of thirdparty properties that are located in another schema than public for TO_ONE relations + add extra loop for MANY_TO_MANY relations where thirdparty is the source instead of the target +* ([#428](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/428)) Fix suggestion of referrer when creating notification for accompanyingPeriodWorkDocument +### DX +* Send notifications log to dedicated channel, if it exists + +### UX +* ([#425](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/425)) Change the terms 'cercle' and 'centre' to 'service', and 'territoire' respectively. +* ([#542](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/542)) Improve the ux for selecting whether user wants to be notified of the final step of a workflow or all steps +* Expand timeSpent choices for evaluation document and translate them to user locale or fallback 'fr' +* ([#455](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/455)) Change the order of display for results and objectives in the social work/action form +* Wrap text when it is too long within badges diff --git a/.changes/v4.8.0.md b/.changes/v4.8.0.md new file mode 100644 index 000000000..48583b6a2 --- /dev/null +++ b/.changes/v4.8.0.md @@ -0,0 +1,9 @@ +## v4.8.0 - 2025-11-17 +### Feature +* ([#461](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/461)) Make a calendar item on the 'mes rendez-vous' page clickable. Clicking will navigate to the edit page of the calendar item. +### Fixed +* ([#463](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/463)) Display calendar items for which an invite was accepted on the mes rendez-vous page +* Improve accessibility on login page + +### UX +* ([#449](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/449)) Remove the label if there is only one scope and no scope picking field is displayed. diff --git a/CHANGELOG.md b/CHANGELOG.md index 4573e5ba2..2cc2b5aa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,38 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## v4.8.0 - 2025-11-17 +### Feature +* ([#461](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/461)) Make a calendar item on the 'mes rendez-vous' page clickable. Clicking will navigate to the edit page of the calendar item. +### Fixed +* ([#463](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/463)) Display calendar items for which an invite was accepted on the mes rendez-vous page +* Improve accessibility on login page + +### UX +* ([#449](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/449)) Remove the label if there is only one scope and no scope picking field is displayed. + +## v4.7.0 - 2025-11-10 +### Feature +* ([#385](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/385)) Create invitation list in user menu +* ([#404](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/404)) Add columns for comments linked to an activity in the activity list export +### Fixed +* ([#451](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/451)) Fix: display also social actions linked to parents of the selected social issue +* ([#453](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/453)) Fix: export actions and their results in csv even when action does not have any goals attached to it. +* Fix the possibility to delete a workflow + + **Schema Change**: Drop or rename table or columns, or enforce new constraint that must be manually fixed +* ([#457](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/457)) Fix the fusion of thirdparty properties that are located in another schema than public for TO_ONE relations + add extra loop for MANY_TO_MANY relations where thirdparty is the source instead of the target +* ([#428](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/428)) Fix suggestion of referrer when creating notification for accompanyingPeriodWorkDocument +### DX +* Send notifications log to dedicated channel, if it exists + +### UX +* ([#425](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/425)) Change the terms 'cercle' and 'centre' to 'service', and 'territoire' respectively. +* ([#542](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/542)) Improve the ux for selecting whether user wants to be notified of the final step of a workflow or all steps +* Expand timeSpent choices for evaluation document and translate them to user locale or fallback 'fr' +* ([#455](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/455)) Change the order of display for results and objectives in the social work/action form +* Wrap text when it is too long within badges + ## v4.6.1 - 2025-10-27 ### Fixed * Fix export case where no 'reason' is picked within the PersonHavingActivityBetweenDateFilter.php diff --git a/composer.json b/composer.json index 6740b8538..c1e235670 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "ext-openssl": "*", "ext-redis": "*", "ext-zlib": "*", - "champs-libres/wopi-bundle": "dev-master#1be045ee95310d2037683859ecefdbf3a10f7be6 as 0.4.x-dev", + "champs-libres/wopi-bundle": "dev-symfony-v5@dev", "champs-libres/wopi-lib": "dev-master@dev", "doctrine/data-fixtures": "^1.8", "doctrine/doctrine-bundle": "^2.1", diff --git a/config/bundles.php b/config/bundles.php index ec11bc0b6..72b5e22f5 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -2,7 +2,6 @@ return [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], - loophp\PsrHttpMessageBridgeBundle\PsrHttpMessageBridgeBundle::class => ['all' => true], ChampsLibres\WopiBundle\WopiBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], @@ -37,4 +36,5 @@ return [ Chill\WopiBundle\ChillWopiBundle::class => ['all' => true], Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], Symfony\UX\Translator\UxTranslatorBundle::class => ['all' => true], + loophp\PsrHttpMessageBridgeBundle\PsrHttpMessageBridgeBundle::class => ['all' => true], ]; diff --git a/config/packages/chill.yaml b/config/packages/chill.yaml index 0f5aa08b7..26f91feb5 100644 --- a/config/packages/chill.yaml +++ b/config/packages/chill.yaml @@ -1,5 +1,5 @@ chill_main: - available_languages: [ '%env(resolve:LOCALE)%', 'en' ] + available_languages: [ '%env(resolve:LOCALE)%', 'en', 'nl' ] available_countries: ['BE', 'FR'] top_banner: visible: false diff --git a/config/packages/chill_aside_activity.yaml b/config/packages/chill_aside_activity.yaml new file mode 100644 index 000000000..eb5c2d70e --- /dev/null +++ b/config/packages/chill_aside_activity.yaml @@ -0,0 +1,2 @@ +chill_aside_activity: + show_concerned_persons_count: hidden diff --git a/docs/source/_static/bundles/docStore/doc_store_classes.puml b/docs/source/_static/bundles/docStore/doc_store_classes.puml index 431d268c0..f0c61f44c 100644 --- a/docs/source/_static/bundles/docStore/doc_store_classes.puml +++ b/docs/source/_static/bundles/docStore/doc_store_classes.puml @@ -23,8 +23,8 @@ class "Document" { - text description - ArrayCollection_DocumentCategory categories - varchar_150 content #link to openstack - - Center center - - Cercle cercle + - Territoire territoire + - Service service - User user - DateTime date # Creation date } diff --git a/docs/source/development/database-principles.rst b/docs/source/development/database-principles.rst index 455354934..3b528ae22 100644 --- a/docs/source/development/database-principles.rst +++ b/docs/source/development/database-principles.rst @@ -38,7 +38,7 @@ Certaines données sont historisées: - les référents d'un parcours; - les statuts d'un parcours; -- la liaison entre les centres et les usagers; +- la liaison entre les territoires et les usagers; - etc. Dans ces cas-là, Chill crée généralement deux colonnes, qui sont habituellement nommées :code:`startDate` et :code:`endDate`. Lorsque la colonne :code:`endDate` est à :code:`NULL`, cela signifie que la période n'est pas "fermée". La colonne :code:`startDate` n'est pas nullable. diff --git a/docs/source/development/database/table_list.csv b/docs/source/development/database/table_list.csv index fe688318d..be72a52ab 100644 --- a/docs/source/development/database/table_list.csv +++ b/docs/source/development/database/table_list.csv @@ -1,6 +1,6 @@ order,table_schema,table_name,commentaire 1,chill_3party,party_category,Catégorie de tiers -2,chill_3party,party_center,Association entre les tiers et les centres (déprécié) +2,chill_3party,party_center,Association entre les tiers et les territoires (déprécié) 3,chill_3party,party_profession,Profession du tiers (déprécié) 4,chill_3party,third_party,Tiers 5,chill_3party,thirdparty_category,association tiers - catégories @@ -54,7 +54,7 @@ order,table_schema,table_name,commentaire 53,public,activitytpresence,Présence aux échanges 54,public,activitytype,Types d'échanges 55,public,activitytypecategory,Catégories de types d'échanges -56,public,centers,"Centres (territoires, agences, etc.)" +56,public,centers,"Territoires (territoires, agences, etc.)" 57,public,chill_activity_activity_chill_person_socialaction, 58,public,chill_activity_activity_chill_person_socialissue 59,public,chill_docgen_template,Gabarits de documents @@ -111,7 +111,7 @@ order,table_schema,table_name,commentaire 110,public,chill_person_marital_status,Etats civils 111,public,chill_person_not_duplicate, 112,public,chill_person_person,Usagers -113,public,chill_person_person_center_history,Historique des centres d'un usagers +113,public,chill_person_person_center_history,Historique des territoires d'un usagers 114,public,chill_person_persons_to_addresses,Déprécié 115,public,chill_person_phone,Numéros d etéléphone supplémentaires d'un usager 116,public,chill_person_relations,Types de relations de filiation @@ -142,7 +142,7 @@ order,table_schema,table_name,commentaire 141,public,permission_groups 142,public,permissionsgroup_rolescope 143,public,persons_spoken_languages -144,public,regroupment,Regroupement de centres +144,public,regroupment,Regroupement de territoires 145,public,regroupment_center, 146,public,role_scopes, 147,public,scopes,Services diff --git a/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php b/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php index dd817e7ab..c3a4428aa 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/ListActivityHelper.php @@ -66,6 +66,9 @@ class ListActivityHelper ->leftJoin('activity.location', 'location') ->addSelect('location.name AS locationName') ->addSelect('activity.sentReceived') + ->addSelect('activity.comment.comment AS commentText') + ->addSelect('activity.comment.date AS commentDate') + ->addSelect('JSON_BUILD_OBJECT(\'uid\', activity.comment.userId, \'d\', activity.comment.date) AS commentUser') ->addSelect('JSON_BUILD_OBJECT(\'uid\', IDENTITY(activity.createdBy), \'d\', activity.createdAt) AS createdBy') ->addSelect('activity.createdAt') ->addSelect('JSON_BUILD_OBJECT(\'uid\', IDENTITY(activity.updatedBy), \'d\', activity.updatedAt) AS updatedBy') @@ -87,6 +90,8 @@ class ListActivityHelper 'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel($key), 'createdBy', 'updatedBy' => $this->userHelper->getLabel($key, $values, $key), 'date' => $this->dateTimeHelper->getLabel(self::MSG_KEY.$key), + 'commentDate' => $this->dateTimeHelper->getLabel(self::MSG_KEY.'comment_date'), + 'commentUser' => $this->userHelper->getLabel($key, $values, self::MSG_KEY.'comment_user'), 'attendeeName' => function ($value) { if ('_header' === $value) { return 'Attendee'; @@ -176,6 +181,9 @@ class ListActivityHelper 'usersNames', 'thirdPartiesIds', 'thirdPartiesNames', + 'commentText', + 'commentDate', + 'commentUser', 'createdBy', 'createdAt', 'updatedBy', diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php index 28c607acd..3b8f53303 100644 --- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php @@ -88,8 +88,8 @@ class ActivityType extends AbstractType if (null !== $options['data']->getPerson()) { $builder->add('scope', ScopePickerType::class, [ - 'center' => $options['center'], 'role' => ActivityVoter::CREATE === (string) $options['role'] ? ActivityVoter::CREATE_PERSON : (string) $options['role'], + 'center' => $options['center'], 'required' => true, ]); } diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialAction.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialAction.vue index 8172b2b6f..503977dbd 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialAction.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialAction.vue @@ -43,11 +43,23 @@ export default { span.badge { @include badge_social($social-action-color); font-size: 95%; + white-space: normal; + word-wrap: break-word; + word-break: break-word; + display: inline-block; + max-width: 100%; margin-bottom: 5px; margin-right: 1em; - max-width: 100%; /* Adjust as needed */ - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; + text-align: left; + line-height: 1.2em; + + &::before { + position: absolute; + left: 11px; + top: 0; + margin: 0 0.3em 0 -0.75em; + } + position: relative; + padding-left: 1.5em; } diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialIssue.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialIssue.vue index 9dbedf2ea..ef1c82a35 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialIssue.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/SocialIssuesAcc/CheckSocialIssue.vue @@ -43,7 +43,22 @@ export default { span.badge { @include badge_social($social-issue-color); font-size: 95%; + white-space: normal; + word-wrap: break-word; + word-break: break-word; + display: inline-block; + max-width: 100%; margin-bottom: 5px; margin-right: 1em; + text-align: left; + + &::before { + position: absolute; + left: 11px; + top: 0; + margin: 0 0.3em 0 -0.75em; + } + position: relative; + padding-left: 1.5em; } diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 883310df9..63c61d8e4 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -10,7 +10,7 @@ Attendee: Présence de l'usager attendee: présence de l'usager list_reasons: liste des sujets user_username: nom de l'utilisateur -circle_name: nom du cercle +circle_name: nom du service Remark: Commentaire No comments: Aucun commentaire Add a new activity: Ajouter une nouvel échange @@ -20,7 +20,7 @@ not present: absent Delete: Supprimer Update: Mettre à jour Update activity: Modifier l'échange -Scope: Cercle +Scope: Service Activity data: Données de l'échange Activity location: Localisation de l'échange No reason associated: Aucun sujet @@ -398,13 +398,15 @@ export: sent received: Envoyé ou reçu emergency: Urgence accompanying course id: Identifiant du parcours - course circles: Cercles du parcours + course circles: Services du parcours travelTime: Durée de déplacement durationTime: Durée id: Identifiant List activities linked to an accompanying course: Liste les échanges liés à un parcours en fonction de différents filtres. List activity linked to a course: Liste des échanges liés à un parcours - + commentText: Commentaire + comment_date: Date de la dernière édition du commentaire + comment_user: Dernière édition par filter: activity: diff --git a/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/ChillAsideActivityExtension.php b/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/ChillAsideActivityExtension.php index 056f29ba1..6fa123146 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/ChillAsideActivityExtension.php +++ b/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/ChillAsideActivityExtension.php @@ -25,6 +25,7 @@ final class ChillAsideActivityExtension extends Extension implements PrependExte $config = $this->processConfiguration($configuration, $configs); $container->setParameter('chill_aside_activity.form.time_duration', $config['form']['time_duration']); + $container->setParameter('chill_aside_activity.show_concerned_persons_count', 'visible' === $config['show_concerned_persons_count']); $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config')); $loader->load('services.yaml'); @@ -38,6 +39,24 @@ final class ChillAsideActivityExtension extends Extension implements PrependExte { $this->prependRoute($container); $this->prependCruds($container); + $this->prependTwigConfig($container); + } + + protected function prependTwigConfig(ContainerBuilder $container) + { + // Get the configuration for this bundle + $chillAsideActivityConfig = $container->getExtensionConfig($this->getAlias()); + $config = $this->processConfiguration($this->getConfiguration($chillAsideActivityConfig, $container), $chillAsideActivityConfig); + + // Add configuration to twig globals + $twigConfig = [ + 'globals' => [ + 'chill_aside_activity_config' => [ + 'show_concerned_persons_count' => 'visible' === $config['show_concerned_persons_count'], + ], + ], + ]; + $container->prependExtensionConfig('twig', $twigConfig); } protected function prependCruds(ContainerBuilder $container) diff --git a/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php b/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php index 241a545a8..66f3d3c86 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php @@ -141,6 +141,12 @@ class Configuration implements ConfigurationInterface ->end() ->end() ->end() + ->end() + ->enumNode('show_concerned_persons_count') + ->values(['hidden', 'visible']) + ->defaultValue('hidden') + ->info('Show the concerned persons count field in aside activity forms and views') + ->end() ->end(); return $treeBuilder; diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php index b7671c61a..0082deaf9 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php @@ -62,6 +62,10 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface #[ORM\ManyToOne(targetEntity: User::class)] private User $updatedBy; + #[Assert\GreaterThanOrEqual(0)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true)] + private ?int $concernedPersonsCount = 0; + public function getAgent(): ?User { return $this->agent; @@ -186,4 +190,16 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface return $this; } + + public function getConcernedPersonsCount(): ?int + { + return $this->concernedPersonsCount; + } + + public function setConcernedPersonsCount(?int $concernedPersonsCount): self + { + $this->concernedPersonsCount = $concernedPersonsCount; + + return $this; + } } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByConcernedPersonsCountAggregator.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByConcernedPersonsCountAggregator.php new file mode 100644 index 000000000..444c49269 --- /dev/null +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Aggregator/ByConcernedPersonsCountAggregator.php @@ -0,0 +1,86 @@ +addSelect('aside.concernedPersonsCount AS by_concerned_persons_count_aggregator') + ->addGroupBy('by_concerned_persons_count_aggregator'); + } + + public function applyOn(): string + { + return Declarations::ASIDE_ACTIVITY_TYPE; + } + + public function buildForm(FormBuilderInterface $builder): void + { + // No form needed + } + + public function getNormalizationVersion(): int + { + return 1; + } + + public function normalizeFormData(array $formData): array + { + return []; + } + + public function denormalizeFormData(array $formData, int $fromVersion): array + { + return []; + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getLabels($key, array $values, $data): callable + { + return function ($value): string { + if ('_header' === $value) { + return 'export.aggregator.Concerned persons count'; + } + + if (null === $value) { + return 'export.aggregator.No concerned persons count specified'; + } + + return (string) $value; + }; + } + + public function getQueryKeys($data): array + { + return ['by_concerned_persons_count_aggregator']; + } + + public function getTitle(): string + { + return 'export.aggregator.Group by concerned persons count'; + } +} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumConcernedPersonsCountAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumConcernedPersonsCountAsideActivity.php new file mode 100644 index 000000000..ab22302c2 --- /dev/null +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/SumConcernedPersonsCountAsideActivity.php @@ -0,0 +1,116 @@ +getTitle(); + + return static fn ($value) => $labels[$value]; + } + + public function getQueryKeys($data): array + { + return ['export_sum_concerned_persons_count']; + } + + public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array + { + return $query->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getTitle(): string + { + return 'export.Sum concerned persons count for aside activities'; + } + + public function getType(): string + { + return Declarations::ASIDE_ACTIVITY_TYPE; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder + { + $qb = $this->repository->createQueryBuilder('aside'); + + $qb->select('SUM(COALESCE(aside.concernedPersonsCount, 0)) as export_sum_concerned_persons_count'); + + return $qb; + } + + public function requiredRole(): string + { + return AsideActivityVoter::STATS; + } + + public function supportsModifiers(): array + { + return [ + Declarations::ASIDE_ACTIVITY_TYPE, + ]; + } +} diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php index d6fcb821c..ea04fdc42 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php @@ -21,6 +21,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; @@ -29,11 +30,13 @@ use Symfony\Component\OptionsResolver\OptionsResolver; final class AsideActivityFormType extends AbstractType { private readonly array $timeChoices; + private readonly bool $showConcernedPersonsCount; public function __construct( ParameterBagInterface $parameterBag, ) { $this->timeChoices = $parameterBag->get('chill_aside_activity.form.time_duration'); + $this->showConcernedPersonsCount = $parameterBag->get('chill_aside_activity.show_concerned_persons_count'); } public function buildForm(FormBuilderInterface $builder, array $options) @@ -76,6 +79,16 @@ final class AsideActivityFormType extends AbstractType ->add('location', PickUserLocationType::class) ; + if ($this->showConcernedPersonsCount) { + $builder->add('concernedPersonsCount', IntegerType::class, [ + 'label' => 'Concerned persons count', + 'required' => false, + 'attr' => [ + 'min' => 0, + ], + ]); + } + foreach (['duration'] as $fieldName) { $builder->get($fieldName) ->addModelTransformer($durationTimeTransformer); diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig index 0a8648749..0d06e5ba9 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig @@ -42,6 +42,11 @@ {%- if entity.location.name is defined -%}