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/package.json b/package.json index 3b9d4c70a..2873e1317 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..86052c2be --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Menu/AccompanyingCourseQuickMenuBuilder.php @@ -0,0 +1,51 @@ +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/Tests/Form/Type/TranslatableActivityTypeTest.php b/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php index c6ecc377c..6715af3ed 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityTypeTest.php @@ -60,7 +60,7 @@ final class TranslatableActivityTypeTest extends KernelTestCase $this->assertInstanceOf( ActivityType::class, $form->getData()['type'], - 'The data is an instance of Chill\\ActivityBundle\\Entity\\ActivityType' + 'The data is an instance of Chill\ActivityBundle\Entity\ActivityType' ); $this->assertEquals($type->getId(), $form->getData()['type']->getId()); 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..6b5108d57 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseQuickMenuBuilder.php @@ -0,0 +1,50 @@ +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/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php index 94b488ddd..84797f6f1 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteEventConverter.php @@ -37,12 +37,12 @@ class RemoteEventConverter * valid when the remote string contains also a timezone, like in * lastModifiedDate. */ - final public const REMOTE_DATETIMEZONE_FORMAT = 'Y-m-d\\TH:i:s.u?P'; + final public const REMOTE_DATETIMEZONE_FORMAT = 'Y-m-d\TH:i:s.u?P'; /** * Same as above, but sometimes the date is expressed with only 6 milliseconds. */ - final public const REMOTE_DATETIMEZONE_FORMAT_ALT = 'Y-m-d\\TH:i:s.uP'; + final public const REMOTE_DATETIMEZONE_FORMAT_ALT = 'Y-m-d\TH:i:s.uP'; private const REMOTE_DATE_FORMAT = 'Y-m-d\TH:i:s.u0'; 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