diff --git a/.changes/v2.20.0.md b/.changes/v2.20.0.md new file mode 100644 index 000000000..7cfb4809c --- /dev/null +++ b/.changes/v2.20.0.md @@ -0,0 +1,21 @@ +## v2.20.0 - 2024-06-05 +### Fixed +* ([#170](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/170)) Display agents traitants instead of accompanying period referrer in export list social actions. +* Added translations for choices of durations (> 5 hours) +### Feature +* ([#145](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/145)) Allow to open documents in LibreOffice locally (need configuration within security); + + This endpoint should be added to make the endpoint works properly: + + ```yaml + security: + firewalls: + dav: + pattern: ^/dav + provider: chain_provider + stateless: true + guard: + authenticators: + - Chill\DocStoreBundle\Security\Guard\JWTOnDavUrlAuthenticator + + ``` diff --git a/.changes/v2.20.1.md b/.changes/v2.20.1.md new file mode 100644 index 000000000..5493c2c17 --- /dev/null +++ b/.changes/v2.20.1.md @@ -0,0 +1,3 @@ +## v2.20.1 - 2024-06-05 +### Fixed +* Do not allow StoredObjectCreated for edit and convert buttons diff --git a/.changes/v2.21.0.md b/.changes/v2.21.0.md new file mode 100644 index 000000000..6398c4a67 --- /dev/null +++ b/.changes/v2.21.0.md @@ -0,0 +1,31 @@ +## v2.21.0 - 2024-06-18 +### Feature +* Add flash menu buttons in search results, to open directly a new calendar, or a new activity in an accompanying period +* ([#122](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/122)) Improve the list of calendar in the search results: make all calendar clicable, and display a list of calendars +* ([#282](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/282)) [export] add start date and end date on filters "filter course by referrer job" and "filter course by referrer scope" +* ([#282](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/282)) [export] the aggregator "Group by referrer" now accept a date range. +* ([#282](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/282)) [export] add date range on "group course by referrer's scope" +* ([#282](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/282)) [export] add date range on "group course by referrer's jobs" +* ([#168](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/168) In the UX, display user job and service at the time when he performs an action: + now, the job and service is shown: + * at the activity's date, + * at the appointment's date, + * when the user is marked as referrer for an accompanying period work, + * when the user apply a transition in a workflow, + * when the user updates or creates "something" ("created/updated by ... at ..."), + * or when he wrote a comment, + * … + +### Traduction francophone +* Ajout d'un menu "flash" dans les résultats de recherche, pour créer un rendez-vous ou un échange dans un parcours depuis les résultats de recherche; +* Améliore la liste des rendez-vous dans les résultats de recherche: les rendez-vous sont cliquables; +* [exports] Ajout d'intervalles de dates pour des filtres et regroupements des parcours par référent, métier du référent, service du référent; +* Affiche le métier et le service des utilisateurs à la date à laquelle il a exécuté une action. Le métier et le service est affiché: + * à la date d'un échange, + * au jour d'un rendez-vous, + * quand l'utilisateur est devenu référent d'un parcours d'accompagnement, + * quand il a appliqué une transition sur un workflow, + * quand il a mise à jour ou créé une fiche, dans les mentions "créé / mise à jour par ..., le ...", + * quand il a mis à jour un commentaire, + * … + diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b2f5e2e1..dc8f2305a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,64 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## v2.21.0 - 2024-06-18 +### Feature +* Add flash menu buttons in search results, to open directly a new calendar, or a new activity in an accompanying period +* ([#122](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/122)) Improve the list of calendar in the search results: make all calendar clicable, and display a list of calendars +* ([#282](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/282)) [export] add start date and end date on filters "filter course by referrer job" and "filter course by referrer scope" +* ([#282](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/282)) [export] the aggregator "Group by referrer" now accept a date range. +* ([#282](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/282)) [export] add date range on "group course by referrer's scope" +* ([#282](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/282)) [export] add date range on "group course by referrer's jobs" +* ([#168](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/168) In the UX, display user job and service at the time when he performs an action: + now, the job and service is shown: + * at the activity's date, + * at the appointment's date, + * when the user is marked as referrer for an accompanying period work, + * when the user apply a transition in a workflow, + * when the user updates or creates "something" ("created/updated by ... at ..."), + * or when he wrote a comment, + * … + +### Traduction francophone +* Ajout d'un menu "flash" dans les résultats de recherche, pour créer un rendez-vous ou un échange dans un parcours depuis les résultats de recherche; +* Améliore la liste des rendez-vous dans les résultats de recherche: les rendez-vous sont cliquables; +* [exports] Ajout d'intervalles de dates pour des filtres et regroupements des parcours par référent, métier du référent, service du référent; +* Affiche le métier et le service des utilisateurs à la date à laquelle il a exécuté une action. Le métier et le service est affiché: + * à la date d'un échange, + * au jour d'un rendez-vous, + * quand l'utilisateur est devenu référent d'un parcours d'accompagnement, + * quand il a appliqué une transition sur un workflow, + * quand il a mise à jour ou créé une fiche, dans les mentions "créé / mise à jour par ..., le ...", + * quand il a mis à jour un commentaire, + * … + + +## v2.20.1 - 2024-06-05 +### Fixed +* Do not allow StoredObjectCreated for edit and convert buttons + +## v2.20.0 - 2024-06-05 +### Fixed +* ([#170](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/170)) Display agents traitants instead of accompanying period referrer in export list social actions. +* Added translations for choices of durations (> 5 hours) +### Feature +* ([#145](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/145)) Allow to open documents in LibreOffice locally (need configuration within security); + + This endpoint should be added to make the endpoint works properly: + + ```yaml + security: + firewalls: + dav: + pattern: ^/dav + provider: chain_provider + stateless: true + guard: + authenticators: + - Chill\DocStoreBundle\Security\Guard\JWTOnDavUrlAuthenticator + + ``` + ## v2.19.0 - 2024-05-14 ### Feature * ([#197](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/197)) Make the script which subscribe to microsoft calendars changes more tolerant to errors or missing configuration on the microsoft side diff --git a/composer.json b/composer.json index 6cda0e9d0..026034121 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,6 @@ "doctrine/doctrine-migrations-bundle": "^3.0", "doctrine/orm": "^2.13.0", "erusev/parsedown": "^1.7", - "graylog2/gelf-php": "^1.5", "knplabs/knp-menu-bundle": "^3.0", "knplabs/knp-time-bundle": "^1.12", "knpuniversity/oauth2-client-bundle": "^2.10", @@ -92,12 +91,12 @@ "phpstan/phpstan": "^1.9", "phpstan/phpstan-deprecation-rules": "^1.1", "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": ">= 7.5", + "phpunit/phpunit": "^10.5.24", "rector/rector": "^1.1.0", "symfony/debug-bundle": "^5.4", "symfony/dotenv": "^5.4", "symfony/maker-bundle": "^1.20", - "symfony/phpunit-bridge": "^5.4", + "symfony/phpunit-bridge": "^7.1", "symfony/runtime": "^5.4", "symfony/stopwatch": "^5.4", "symfony/var-dumper": "^5.4" diff --git a/docs/source/installation/index.rst b/docs/source/installation/index.rst index 0328322e4..072a32ffb 100644 --- a/docs/source/installation/index.rst +++ b/docs/source/installation/index.rst @@ -95,7 +95,7 @@ custom developments. But most of the time, this should be fine. You have to configure some local variables, which are described in the :code:`.env` file. The secrets should not be stored in this :code:`.env` file, but instead using the `secrets management tool `_ -or in the :code:`.env.local` file, which should not be commited to the git repository. +or in the :code:`.env.local` file, which should not be committed to the git repository. You do not need to set variables for the smtp server, redis server and relatorio server, as they are generated automatically by the symfony server, from the docker compose services. @@ -114,6 +114,12 @@ you can either: - add the generated password to the secrets manager (**note**: you must add the generated hashed password to the secrets env, not the password in clear text). +- set up the jwt authentication bundle + +Some environment variables are available for the JWT authentication bundle in the :code:`.env` file. You must also run the command +:code:`symfony console lexik:jwt:generate-keypair` to generate some keys that will be stored in the paths set up in the :code:`JWT_SECRET_KEY` +and the :code:`JWT_PUBLIC_KEY` env variables. This is only required for using the stored documents in Chill. + Prepare migrations and other tools ********************************** @@ -164,7 +170,7 @@ can rely on the whole chill framework, meaning there is no need to add them to t You will require some bundles to have the following development tools: - add fixtures -- add profiler and var-dumper to debug +- add profiler and debug bundle Install fixtures **************** @@ -179,7 +185,7 @@ Install fixtures This will generate user accounts, centers, and some basic configuration. The accounts created are: :code:`center a_social`, :code:`center b_social`, :code:`center a_direction`, ... The full list is -visibile in the "users" table: :code:`docker compose exec database psql -U app -c "SELECT username FROM users"`. +visible in the "users" table: :code:`docker compose exec database psql -U app -c "SELECT username FROM users"`. The password is always :code:`password`. @@ -192,7 +198,7 @@ Add web profiler and debugger .. code-block:: bash - symfony composer require --dev symfony/web-profiler-bundle symfony/var-dumper + symfony composer require --dev symfony/web-profiler-bundle symfony/debug-bundle Working on chill bundles ************************ diff --git a/package.json b/package.json index 0244daedd..0c932b9f6 100644 --- a/package.json +++ b/package.json @@ -46,9 +46,11 @@ "@fullcalendar/vue3": "^6.1.4", "@popperjs/core": "^2.9.2", "@types/leaflet": "^1.9.3", + "@types/dompurify": "^3.0.5", "dropzone": "^5.7.6", "es6-promise": "^4.2.8", "leaflet": "^1.7.1", + "marked": "^12.0.2", "masonry-layout": "^4.2.2", "mime": "^4.0.0", "swagger-ui": "^4.15.5", diff --git a/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseQuickMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseQuickMenuBuilder.php new file mode 100644 index 000000000..2a3291515 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseQuickMenuBuilder.php @@ -0,0 +1,49 @@ +security->isGranted(ActivityVoter::CREATE, $accompanyingCourse)) { + $menu + ->addChild('Create a new activity in accompanying course', [ + 'route' => 'chill_activity_activity_new', + 'routeParameters' => [ + // 'activityType_id' => '', + 'accompanying_period_id' => $accompanyingCourse->getId(), + ], + ]) + ->setExtras([ + 'order' => 10, + 'icon' => 'plus', + ]) + ; + } + } +} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig index b3382c3de..13dfa7461 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig @@ -68,7 +68,7 @@

{{ 'Referrer'|trans }}

- {{ activity.user|chill_entity_render_box }} + {{ activity.user|chill_entity_render_box({'at_date': activity.date}) }}

diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/concernedGroups.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/concernedGroups.html.twig index 48eb839d7..76db92d42 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/concernedGroups.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/concernedGroups.html.twig @@ -87,7 +87,8 @@
  • {% if bloc.type == 'user' %} - {{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false }) }} + hello + {{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false, 'at_date': entity.date }) }} {% else %} {{ _self.insert_onthefly(bloc.type, item) }} @@ -114,7 +115,7 @@
  • {% if bloc.type == 'user' %} - {{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false }) }} + {{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false, 'at_date': entity.date }) }} {% else %} {{ _self.insert_onthefly(bloc.type, item) }} @@ -142,7 +143,7 @@ {% if bloc.type == 'user' %} - {{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false }) }} + {{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false, 'at_date': entity.date }) }} {%- if context == 'calendar_accompanyingCourse' or context == 'calendar_person' %} {% set invite = entity.inviteForUser(item) %} {% if invite is not null %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig index aa0bbea0c..04ea936d4 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig @@ -41,7 +41,7 @@ {% if activity.user and t.userVisible %}
  • {{ 'Referrer'|trans ~ ': ' }} - {{ activity.user|chill_entity_render_box }} + {{ activity.user|chill_entity_render_box({'at_date': activity.date}) }}
  • {% endif %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig index d4beb606a..0330377aa 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig @@ -37,7 +37,7 @@ {%- if entity.user is not null %}
    {{ 'Referrer'|trans|capitalize }}
    - {{ entity.user|chill_entity_render_box }} + {{ entity.user|chill_entity_render_box({'at_date': entity.date}) }}
    {% endif %} diff --git a/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityVoter.php b/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityVoter.php index bf2ed78a0..dd51a1f55 100644 --- a/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityVoter.php +++ b/src/Bundle/ChillActivityBundle/Security/Authorization/ActivityVoter.php @@ -145,7 +145,7 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn throw new \RuntimeException('Could not determine context of activity.'); } } elseif ($subject instanceof AccompanyingPeriod) { - if (AccompanyingPeriod::STEP_CLOSED === $subject->getStep()) { + if (AccompanyingPeriod::STEP_CLOSED === $subject->getStep() || AccompanyingPeriod::STEP_DRAFT === $subject->getStep()) { if (\in_array($attribute, [self::UPDATE, self::CREATE, self::DELETE], true)) { return false; } diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 441c23eeb..7e72bc016 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -77,6 +77,18 @@ Choose a type: Choisir un type 4 hours: 4 heures 4 hours 30: 4 heures 30 5 hours: 5 heures +5 hours 30: 5 heure 30 +6 hours: 6 heures +6 hours 30: 6 heure 30 +7 hours: 7 heures +7 hours 30: 7 heure 30 +8 hours: 8 heures +8 hours 30: 8 heure 30 +9 hours: 9 heures +9 hours 30: 9 heure 30 +10 hours: 10 heures +11 hours: 11 heures +12 hours: 12 heures Concerned groups: Parties concernées par l'échange Persons in accompanying course: Usagers du parcours Third persons: Tiers non-pro. @@ -210,6 +222,7 @@ Documents label: Libellé du champ Documents # activity type category admin ActivityTypeCategory list: Liste des catégories des types d'échange Create a new activity type category: Créer une nouvelle catégorie de type d'échange +Create a new activity in accompanying course: Créer un échange dans le parcours # activity delete Remove activity: Supprimer un échange 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 1e2711bfe..0a8648749 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/index.html.twig @@ -49,13 +49,13 @@
  • {{ 'By'|trans }}: - {{ entity.createdBy|chill_entity_render_box }} + {{ entity.createdBy|chill_entity_render_box({'at_date': entity.date}) }}
  • {{ 'For'|trans }}: - {{ entity.agent|chill_entity_render_box }} + {{ entity.agent|chill_entity_render_box({'at_date': entity.date}) }}
  • diff --git a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/view.html.twig b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/view.html.twig index 8fb487d31..4ef237336 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/view.html.twig +++ b/src/Bundle/ChillAsideActivityBundle/src/Resources/views/asideActivity/view.html.twig @@ -18,11 +18,11 @@
    {{ entity.type|chill_entity_render_box }}
    {{ 'Created by'|trans }}
    -
    {{ entity.createdBy }}
    +
    {{ entity.createdBy|chill_entity_render_box({'at_date': entity.date}) }}
    {{ 'Created for'|trans }}
    -
    {{ entity.agent }}
    - +
    {{ entity.agent|chill_entity_render_box({'at_date': entity.date}) }}
    +
    {{ 'Asideactivity location'|trans }}
    {%- if entity.location.name is defined -%}
    {{ entity.location.name }}
    diff --git a/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml b/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml index 0a324d2cd..7d3c7a20e 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml +++ b/src/Bundle/ChillAsideActivityBundle/src/translations/messages.fr.yml @@ -72,21 +72,21 @@ days: jours 1 hour 30: 1 heure 30 1 hour 45: 1 heure 45 2 hours: 2 heures -2 hours 30: 2 heure 30 +2 hours 30: 2 heures 30 3 hours: 3 heures -3 hours 30: 3 heure 30 +3 hours 30: 3 heures 30 4 hours: 4 heures -4 hours 30: 4 heure 30 +4 hours 30: 4 heures 30 5 hours: 5 heures -5 hours 30: 5 heure 30 +5 hours 30: 5 heures 30 6 hours: 6 heures -6 hours 30: 6 heure 30 +6 hours 30: 6 heures 30 7 hours: 7 heures -7 hours 30: 7 heure 30 +7 hours 30: 7 heures 30 8 hours: 8 heures -8 hours 30: 8 heure 30 +8 hours 30: 8 heures 30 9 hours: 9 heures -9 hours 30: 9 heure 30 +9 hours 30: 9 heures 30 10 hours: 10 heures 1/2 day: 1/2 jour 1 day: 1 jour diff --git a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php index 39340e117..53949d1f0 100644 --- a/src/Bundle/ChillCalendarBundle/Entity/Calendar.php +++ b/src/Bundle/ChillCalendarBundle/Entity/Calendar.php @@ -440,6 +440,16 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente return $this->startDate; } + /** + * get the date of the calendar. + * + * Useful for showing the date of the calendar event, required by twig in some places. + */ + public function getDate(): ?\DateTimeImmutable + { + return $this->getStartDate(); + } + public function getStatus(): ?string { return $this->status; diff --git a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseQuickMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseQuickMenuBuilder.php new file mode 100644 index 000000000..cfca6813f --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseQuickMenuBuilder.php @@ -0,0 +1,48 @@ +security->isGranted(CalendarVoter::CREATE, $accompanyingCourse)) { + $menu + ->addChild('Create a new calendar in accompanying course', [ + 'route' => 'chill_calendar_calendar_new', + 'routeParameters' => [ + 'accompanying_period_id' => $accompanyingCourse->getId(), + ], + ]) + ->setExtras([ + 'order' => 20, + 'icon' => 'plus', + ]) + ; + } + } +} diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/chill/chill.js b/src/Bundle/ChillCalendarBundle/Resources/public/chill/chill.js index 56a8ce563..4d96d095b 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/public/chill/chill.js +++ b/src/Bundle/ChillCalendarBundle/Resources/public/chill/chill.js @@ -1 +1,2 @@ import './scss/badge.scss'; +import './scss/calendar-list.scss'; diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/chill/scss/calendar-list.scss b/src/Bundle/ChillCalendarBundle/Resources/public/chill/scss/calendar-list.scss new file mode 100644 index 000000000..c232b78e2 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Resources/public/chill/scss/calendar-list.scss @@ -0,0 +1,26 @@ +ul.calendar-list { + list-style-type: none; + padding: 0; + & > li { + display: inline-block; + } + & > li:nth-child(n+2) { + margin-left: 0.25rem; + } +} + +div.calendar-list { + + ul.calendar-list { + display: inline-block; + } + + & > a.calendar-list__global { + display: inline-block;; + padding: 0.2rem; + min-width: 2rem; + border: 1px solid var(--bs-chill-blue); + border-radius: 0.25rem; + text-align: center; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/_list.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/_list.html.twig index 0ca2f6b73..cff5c00cc 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/_list.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/_list.html.twig @@ -55,7 +55,7 @@
    @@ -132,7 +132,7 @@
  • {{ 'Created by'|trans }} - {{ calendar.activity.createdBy|chill_entity_render_string }}, {{ 'on'|trans }} {{ calendar.activity.createdAt|format_datetime('short', 'short') }} + {{ calendar.activity.createdBy|chill_entity_render_string({'at_date': calendar.activity.createdAt}) }}, {{ 'on'|trans }} {{ calendar.activity.createdAt|format_datetime('short', 'short') }}
  • {% if is_granted('CHILL_ACTIVITY_SEE', calendar.activity) %} diff --git a/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarVoter.php b/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarVoter.php index 8f4c3a065..b7aae9349 100644 --- a/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarVoter.php +++ b/src/Bundle/ChillCalendarBundle/Security/Voter/CalendarVoter.php @@ -89,7 +89,7 @@ class CalendarVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn switch ($attribute) { case self::SEE: case self::CREATE: - if (AccompanyingPeriod::STEP_DRAFT === $subject->getStep()) { + if (AccompanyingPeriod::STEP_DRAFT === $subject->getStep() || AccompanyingPeriod::STEP_CLOSED === $subject->getStep()) { return false; } diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index d157683e0..cfb2fe057 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -26,6 +26,7 @@ The calendar item has been successfully removed.: Le rendez-vous a été supprim From the day: Du to the day: au Transform to activity: Transformer en échange +Create a new calendar in accompanying course: Créer un rendez-vous dans le parcours Will send SMS: Un SMS de rappel sera envoyé Will not send SMS: Aucun SMS de rappel ne sera envoyé SMS already sent: Un SMS a été envoyé diff --git a/src/Bundle/ChillDocGeneratorBundle/Test/DocGenNormalizerTestAbstract.php b/src/Bundle/ChillDocGeneratorBundle/Test/DocGenNormalizerTestAbstract.php new file mode 100644 index 000000000..2839be3f5 --- /dev/null +++ b/src/Bundle/ChillDocGeneratorBundle/Test/DocGenNormalizerTestAbstract.php @@ -0,0 +1,65 @@ +getNormalizer()->normalize($this->provideNotNullObject(), 'docgen', [ + AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => $this->provideDocGenExpectClass(), + ]); + $nullNormalizedObject = $this->getNormalizer()->normalize(null, 'docgen', [ + AbstractNormalizer::GROUPS => ['docgen:read'], 'docgen:expects' => $this->provideDocGenExpectClass(), + ]); + + self::assertEqualsCanonicalizing(array_keys($normalizedObject), array_keys($nullNormalizedObject)); + self::assertArrayHasKey('isNull', $nullNormalizedObject, 'each object must have an "isNull" key'); + self::assertTrue($nullNormalizedObject['isNull'], 'isNull key must be true for null objects'); + self::assertFalse($normalizedObject['isNull'], 'isNull key must be false for null objects'); + + foreach ($normalizedObject as $key => $value) { + if (in_array($key, ['isNull', 'type'])) { + continue; + } + + if (is_array($value)) { + if (array_is_list($value)) { + self::assertEquals([], $nullNormalizedObject[$key], "list must be serialized as an empty array, in {$key}"); + } else { + self::assertEqualsCanonicalizing(array_keys($value), array_keys($nullNormalizedObject[$key]), "sub-object must have the same keys, in {$key}"); + } + } elseif (is_string($value)) { + self::assertEquals('', $nullNormalizedObject[$key], 'strings must be '); + } + } + } + + /** + * @return T + */ + abstract public function provideNotNullObject(): object; + + /** + * @return class-string + */ + abstract public function provideDocGenExpectClass(): string; + + abstract public function getNormalizer(): NormalizerInterface; +} diff --git a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php index e92587f4d..4472d2177 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php @@ -313,4 +313,19 @@ class StoredObject implements Document, TrackCreationInterface return $this; } + + public function saveHistory(): void + { + if ('' === $this->getFilename()) { + return; + } + + $this->datas['history'][] = [ + 'filename' => $this->getFilename(), + 'iv' => $this->getIv(), + 'key_infos' => $this->getKeyInfos(), + 'type' => $this->getType(), + 'before' => (new \DateTimeImmutable('now'))->getTimestamp(), + ]; + } } diff --git a/src/Bundle/ChillDocStoreBundle/Form/DataMapper/StoredObjectDataMapper.php b/src/Bundle/ChillDocStoreBundle/Form/DataMapper/StoredObjectDataMapper.php index 4f2f177b4..170b1ab0a 100644 --- a/src/Bundle/ChillDocStoreBundle/Form/DataMapper/StoredObjectDataMapper.php +++ b/src/Bundle/ChillDocStoreBundle/Form/DataMapper/StoredObjectDataMapper.php @@ -57,8 +57,8 @@ class StoredObjectDataMapper implements DataMapperInterface /** @var StoredObject $viewData */ if ($viewData->getFilename() !== $forms['stored_object']->getData()['filename']) { - // we do not want to erase the previous object - $viewData = new StoredObject(); + // we want to keep the previous history + $viewData->saveHistory(); } $viewData->setFilename($forms['stored_object']->getData()['filename']); diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue index 192cdd271..b4c53eacd 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentActionButtonsGroup.vue @@ -4,13 +4,13 @@ Actions