From a35d45630839c335dfddaabed6899edd721c2225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 4 Jun 2025 16:54:44 +0200 Subject: [PATCH 01/16] Fix participant condition in list_with_period.html.twig Updated the condition to properly handle cases where the first participation's person is not the current person. --- .../Resources/views/Person/list_with_period.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig index 7d06c51c3..670ce2ec7 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -96,7 +96,7 @@ {% endif %} - {% if acp.currentParticipations|length > 1 %} + {% if acp.currentParticipations|length > 1 or (acp.currentParticipations|first).person is not same as person %}

From fca10ada717b84bfe9dce44ddb36c7a1f3592ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 4 Jun 2025 16:54:58 +0200 Subject: [PATCH 02/16] Fix translation keys and participant pluralization in list_with_period.html.twig Updated French translations for "Participants" and improved pluralization handling in accompanying_period keys. Modified list_with_period.html.twig to dynamically translate "Participants" based on the count of current participations. --- .changes/unreleased/Fixed-20250604-165550.yaml | 6 ++++++ .../Resources/views/Person/list_with_period.html.twig | 2 +- .../translations/messages+intl-icu.fr.yaml | 8 ++++++++ src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .changes/unreleased/Fixed-20250604-165550.yaml diff --git a/.changes/unreleased/Fixed-20250604-165550.yaml b/.changes/unreleased/Fixed-20250604-165550.yaml new file mode 100644 index 000000000..0544c9402 --- /dev/null +++ b/.changes/unreleased/Fixed-20250604-165550.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: Display the list of participant in the results, even if there is only one participant and that the search result display the requestor +time: 2025-06-04T16:55:50.107852336+02:00 +custom: + Issue: "390" + SchemaChange: No schema change diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig index 670ce2ec7..41bc51864 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -100,7 +100,7 @@

- {{ 'Participants'|trans }} + {{ 'accompanying_period.Participants_without_count'|trans({count: acp.currentParticipations|length}) }}

diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index 830e21d2d..6e42a362b 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -13,6 +13,14 @@ Requestor: >- neutral {Demandeur·euse} } +accompanying_period: + Participants_without_count: >- + {count, plural, + =0 {Participant} + =1 {Participant} + other {Participants} + } + person: from_the: depuis le And himself: >- diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 9bce912a0..0f62e4f5b 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -208,7 +208,7 @@ Pediod closing form is not valid: Le formulaire n'est pas valide Accompanying user: Accompagnant No accompanying user: Aucun accompagnant No data given: Pas d'information -Participants: Usagers impliquées +Participants: Usagers impliqués Create an accompanying course: Créer un parcours Accompanying courses of users: Parcours des utilisateurs This accompanying course is still a draft: Ce parcours est encore à l'état brouillon. From 7d0fe0665184a008ec3213b7cf849f8ff6d3fa70 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 11 Jun 2025 16:46:04 +0200 Subject: [PATCH 03/16] Fix admin entity edit actions for event admin entities and activity reason (category) entities --- .../ActivityReasonCategoryController.php | 28 ++----------------- .../Controller/ActivityReasonController.php | 24 +--------------- .../ActivityReasonCategory/index.html.twig | 2 +- .../Controller/EventTypeController.php | 4 +-- .../Controller/RoleController.php | 2 +- .../Controller/StatusController.php | 2 +- 6 files changed, 8 insertions(+), 54 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php index 0d337416b..b5af48674 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php @@ -48,28 +48,6 @@ class ActivityReasonCategoryController extends AbstractController ]); } - /** - * Displays a form to edit an existing ActivityReasonCategory entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/edit', name: 'chill_activity_activityreasoncategory_edit')] - public function editAction(mixed $id) - { - $em = $this->managerRegistry->getManager(); - - $entity = $em->getRepository(ActivityReasonCategory::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.'); - } - - $editForm = $this->createEditForm($entity); - - return $this->render('@ChillActivity/ActivityReasonCategory/edit.html.twig', [ - 'entity' => $entity, - 'edit_form' => $editForm->createView(), - ]); - } - /** * Lists all ActivityReasonCategory entities. */ @@ -122,7 +100,7 @@ class ActivityReasonCategoryController extends AbstractController /** * Edits an existing ActivityReasonCategory entity. */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/update', name: 'chill_activity_activityreasoncategory_update', methods: ['POST', 'PUT'])] + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/update', name: 'chill_activity_activityreasoncategory_update')] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); @@ -139,7 +117,7 @@ class ActivityReasonCategoryController extends AbstractController if ($editForm->isSubmitted() && $editForm->isValid()) { $em->flush(); - return $this->redirectToRoute('chill_activity_activityreasoncategory_edit', ['id' => $id]); + return $this->redirectToRoute('chill_activity_activityreasoncategory', ['id' => $id]); } return $this->render('@ChillActivity/ActivityReasonCategory/edit.html.twig', [ @@ -178,7 +156,7 @@ class ActivityReasonCategoryController extends AbstractController { $form = $this->createForm(ActivityReasonCategoryType::class, $entity, [ 'action' => $this->generateUrl('chill_activity_activityreasoncategory_update', ['id' => $entity->getId()]), - 'method' => 'PUT', + 'method' => 'POST', ]); $form->add('submit', SubmitType::class, ['label' => 'Update']); diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php index 37d04d367..77dd6c9d4 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php @@ -50,28 +50,6 @@ class ActivityReasonController extends AbstractController ]); } - /** - * Displays a form to edit an existing ActivityReason entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/edit', name: 'chill_activity_activityreason_edit')] - public function editAction(mixed $id) - { - $em = $this->managerRegistry->getManager(); - - $entity = $em->getRepository(ActivityReason::class)->find($id); - - if (null === $entity) { - throw new NotFoundHttpException('Unable to find ActivityReason entity.'); - } - - $editForm = $this->createEditForm($entity); - - return $this->render('@ChillActivity/ActivityReason/edit.html.twig', [ - 'entity' => $entity, - 'edit_form' => $editForm->createView(), - ]); - } - /** * Lists all ActivityReason entities. */ @@ -180,7 +158,7 @@ class ActivityReasonController extends AbstractController { $form = $this->createForm(ActivityReasonType::class, $entity, [ 'action' => $this->generateUrl('chill_activity_activityreason_update', ['id' => $entity->getId()]), - 'method' => 'PUT', + 'method' => 'POST', ]); $form->add('submit', SubmitType::class, ['label' => 'Update']); diff --git a/src/Bundle/ChillActivityBundle/Resources/views/ActivityReasonCategory/index.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/ActivityReasonCategory/index.html.twig index 5f48180b3..e56c874b1 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/ActivityReasonCategory/index.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/ActivityReasonCategory/index.html.twig @@ -26,7 +26,7 @@
  • - +
  • diff --git a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php index f7b1b205c..97719d64d 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php @@ -87,12 +87,10 @@ class EventTypeController extends AbstractController } $editForm = $this->createEditForm($entity); - $deleteForm = $this->createDeleteForm($id); return $this->render('@ChillEvent/EventType/edit.html.twig', [ 'entity' => $entity, 'edit_form' => $editForm->createView(), - 'delete_form' => $deleteForm->createView(), ]); } @@ -228,7 +226,7 @@ class EventTypeController extends AbstractController 'chill_eventtype_admin_update', ['id' => $entity->getId()] ), - 'method' => 'PUT', + 'method' => 'POST', ]); $form->add('submit', SubmitType::class, ['label' => 'Update']); diff --git a/src/Bundle/ChillEventBundle/Controller/RoleController.php b/src/Bundle/ChillEventBundle/Controller/RoleController.php index 1ff205dfc..10e978a6b 100644 --- a/src/Bundle/ChillEventBundle/Controller/RoleController.php +++ b/src/Bundle/ChillEventBundle/Controller/RoleController.php @@ -226,7 +226,7 @@ class RoleController extends AbstractController 'chill_event_admin_role_update', ['id' => $entity->getId()] ), - 'method' => 'PUT', + 'method' => 'POST', ]); $form->add('submit', SubmitType::class, ['label' => 'Update']); diff --git a/src/Bundle/ChillEventBundle/Controller/StatusController.php b/src/Bundle/ChillEventBundle/Controller/StatusController.php index 3b302500d..f83fa9480 100644 --- a/src/Bundle/ChillEventBundle/Controller/StatusController.php +++ b/src/Bundle/ChillEventBundle/Controller/StatusController.php @@ -222,7 +222,7 @@ class StatusController extends AbstractController { $form = $this->createForm(StatusType::class, $entity, [ 'action' => $this->generateUrl('chill_event_admin_status_update', ['id' => $entity->getId()]), - 'method' => 'PUT', + 'method' => 'POST', ]); $form->add('submit', SubmitType::class, ['label' => 'Update']); From f680a35f49b580fcbb7e942a8fa8feb7f56017b0 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 11 Jun 2025 17:10:56 +0200 Subject: [PATCH 04/16] Improve admin templates for event admin entities + activity reason (category) entities and remove delete and show actions for coherence --- .../unreleased/Fixed-20250611-164623.yaml | 6 ++ .../ActivityReasonCategoryController.php | 19 ------ .../Controller/ActivityReasonController.php | 21 +----- .../views/ActivityReason/index.html.twig | 7 +- .../ActivityReasonCategory/index.html.twig | 5 +- .../Controller/EventTypeController.php | 64 ------------------- .../Controller/RoleController.php | 64 ------------------- .../Controller/StatusController.php | 63 ------------------ .../Resources/views/EventType/edit.html.twig | 2 +- .../Resources/views/EventType/index.html.twig | 7 +- .../Resources/views/EventType/new.html.twig | 2 +- .../Resources/views/EventType/show.html.twig | 7 +- .../Resources/views/Role/edit.html.twig | 4 +- .../Resources/views/Role/index.html.twig | 7 +- .../Resources/views/Role/new.html.twig | 2 +- .../Resources/views/Role/show.html.twig | 7 +- .../Resources/views/Status/edit.html.twig | 2 +- .../Resources/views/Status/index.html.twig | 7 +- .../Resources/views/Status/new.html.twig | 2 +- .../Resources/views/Status/show.html.twig | 7 +- 20 files changed, 26 insertions(+), 279 deletions(-) create mode 100644 .changes/unreleased/Fixed-20250611-164623.yaml diff --git a/.changes/unreleased/Fixed-20250611-164623.yaml b/.changes/unreleased/Fixed-20250611-164623.yaml new file mode 100644 index 000000000..8bb956c34 --- /dev/null +++ b/.changes/unreleased/Fixed-20250611-164623.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: Fix admin entity edit actions for event admin entities and activity reason (category) entities +time: 2025-06-11T16:46:23.113506434+02:00 +custom: + Issue: "" + SchemaChange: No schema change diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php index b5af48674..6ccddcc97 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php @@ -78,25 +78,6 @@ class ActivityReasonCategoryController extends AbstractController ]); } - /** - * Finds and displays a ActivityReasonCategory entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/show', name: 'chill_activity_activityreasoncategory_show')] - public function showAction(mixed $id) - { - $em = $this->managerRegistry->getManager(); - - $entity = $em->getRepository(ActivityReasonCategory::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.'); - } - - return $this->render('@ChillActivity/ActivityReasonCategory/show.html.twig', [ - 'entity' => $entity, - ]); - } - /** * Edits an existing ActivityReasonCategory entity. */ diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php index 77dd6c9d4..0167273c5 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php @@ -80,29 +80,10 @@ class ActivityReasonController extends AbstractController ]); } - /** - * Finds and displays a ActivityReason entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/show', name: 'chill_activity_activityreason_show')] - public function showAction(mixed $id) - { - $em = $this->managerRegistry->getManager(); - - $entity = $em->getRepository(ActivityReason::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find ActivityReason entity.'); - } - - return $this->render('@ChillActivity/ActivityReason/show.html.twig', [ - 'entity' => $entity, - ]); - } - /** * Edits an existing ActivityReason entity. */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/update', name: 'chill_activity_activityreason_update', methods: ['POST', 'PUT'])] + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/update', name: 'chill_activity_activityreason_update')] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); diff --git a/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/index.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/index.html.twig index 855c9386d..ee36958c3 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/index.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/index.html.twig @@ -3,7 +3,7 @@ {% block admin_content %}

    {{ 'ActivityReason list'|trans }}

    - +
    @@ -29,10 +29,7 @@ diff --git a/src/Bundle/ChillActivityBundle/Resources/views/ActivityReasonCategory/index.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/ActivityReasonCategory/index.html.twig index e56c874b1..f64ce359d 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/ActivityReasonCategory/index.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/ActivityReasonCategory/index.html.twig @@ -3,7 +3,7 @@ {% block admin_content %}

    {{ 'ActivityReasonCategory list'|trans }}

    -
    {{ 'Name'|trans }}
    • - -
    • -
    • - +
    +
    @@ -22,9 +22,6 @@ {% for entity in entities %} - + - +
    {{ 'Name'|trans }}
      -
    • - -
    • diff --git a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php index 97719d64d..969e60cb7 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php @@ -48,30 +48,6 @@ class EventTypeController extends AbstractController ]); } - /** - * Deletes a EventType entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/delete', name: 'chill_eventtype_admin_delete', methods: ['POST', 'DELETE'])] - public function deleteAction(Request $request, mixed $id) - { - $form = $this->createDeleteForm($id); - $form->handleRequest($request); - - if ($form->isSubmitted() && $form->isValid()) { - $em = $this->managerRegistry->getManager(); - $entity = $em->getRepository(EventType::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find EventType entity.'); - } - - $em->remove($entity); - $em->flush(); - } - - return $this->redirectToRoute('chill_eventtype_admin'); - } - /** * Displays a form to edit an existing EventType entity. */ @@ -124,28 +100,6 @@ class EventTypeController extends AbstractController ]); } - /** - * Finds and displays a EventType entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/show', name: 'chill_eventtype_admin_show')] - public function showAction(mixed $id) - { - $em = $this->managerRegistry->getManager(); - - $entity = $em->getRepository(EventType::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find EventType entity.'); - } - - $deleteForm = $this->createDeleteForm($id); - - return $this->render('@ChillEvent/EventType/show.html.twig', [ - 'entity' => $entity, - 'delete_form' => $deleteForm->createView(), - ]); - } - /** * Edits an existing EventType entity. */ @@ -160,7 +114,6 @@ class EventTypeController extends AbstractController throw $this->createNotFoundException('Unable to find EventType entity.'); } - $deleteForm = $this->createDeleteForm($id); $editForm = $this->createEditForm($entity); $editForm->handleRequest($request); @@ -173,7 +126,6 @@ class EventTypeController extends AbstractController return $this->render('@ChillEvent/EventType/edit.html.twig', [ 'entity' => $entity, 'edit_form' => $editForm->createView(), - 'delete_form' => $deleteForm->createView(), ]); } @@ -196,22 +148,6 @@ class EventTypeController extends AbstractController return $form; } - /** - * Creates a form to delete a EventType entity by id. - * - * @return \Symfony\Component\Form\FormInterface The form - */ - private function createDeleteForm(mixed $id) - { - return $this->createFormBuilder() - ->setAction($this->generateUrl( - 'chill_eventtype_admin_delete', - ['id' => $id] - )) - ->add('submit', SubmitType::class, ['label' => 'Delete']) - ->getForm(); - } - /** * Creates a form to edit a EventType entity. * diff --git a/src/Bundle/ChillEventBundle/Controller/RoleController.php b/src/Bundle/ChillEventBundle/Controller/RoleController.php index 10e978a6b..9d0c38c92 100644 --- a/src/Bundle/ChillEventBundle/Controller/RoleController.php +++ b/src/Bundle/ChillEventBundle/Controller/RoleController.php @@ -48,30 +48,6 @@ class RoleController extends AbstractController ]); } - /** - * Deletes a Role entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/delete', name: 'chill_event_admin_role_delete', methods: ['POST', 'DELETE'])] - public function deleteAction(Request $request, mixed $id) - { - $form = $this->createDeleteForm($id); - $form->handleRequest($request); - - if ($form->isSubmitted() && $form->isValid()) { - $em = $this->managerRegistry->getManager(); - $entity = $em->getRepository(Role::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find Role entity.'); - } - - $em->remove($entity); - $em->flush(); - } - - return $this->redirectToRoute('chill_event_admin_role'); - } - /** * Displays a form to edit an existing Role entity. */ @@ -87,12 +63,10 @@ class RoleController extends AbstractController } $editForm = $this->createEditForm($entity); - $deleteForm = $this->createDeleteForm($id); return $this->render('@ChillEvent/Role/edit.html.twig', [ 'entity' => $entity, 'edit_form' => $editForm->createView(), - 'delete_form' => $deleteForm->createView(), ]); } @@ -126,28 +100,6 @@ class RoleController extends AbstractController ]); } - /** - * Finds and displays a Role entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/show', name: 'chill_event_admin_role_show')] - public function showAction(mixed $id) - { - $em = $this->managerRegistry->getManager(); - - $entity = $em->getRepository(Role::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find Role entity.'); - } - - $deleteForm = $this->createDeleteForm($id); - - return $this->render('@ChillEvent/Role/show.html.twig', [ - 'entity' => $entity, - 'delete_form' => $deleteForm->createView(), - ]); - } - /** * Edits an existing Role entity. */ @@ -162,7 +114,6 @@ class RoleController extends AbstractController throw $this->createNotFoundException('Unable to find Role entity.'); } - $deleteForm = $this->createDeleteForm($id); $editForm = $this->createEditForm($entity); $editForm->handleRequest($request); @@ -175,7 +126,6 @@ class RoleController extends AbstractController return $this->render('@ChillEvent/Role/edit.html.twig', [ 'entity' => $entity, 'edit_form' => $editForm->createView(), - 'delete_form' => $deleteForm->createView(), ]); } @@ -198,20 +148,6 @@ class RoleController extends AbstractController return $form; } - /** - * Creates a form to delete a Role entity by id. - * - * @return \Symfony\Component\Form\FormInterface The form - */ - private function createDeleteForm(mixed $id) - { - return $this->createFormBuilder() - ->setAction($this->generateUrl('chill_event_admin_role_delete', ['id' => $id])) - ->setMethod('DELETE') - ->add('submit', SubmitType::class, ['label' => 'Delete']) - ->getForm(); - } - /** * Creates a form to edit a Role entity. * diff --git a/src/Bundle/ChillEventBundle/Controller/StatusController.php b/src/Bundle/ChillEventBundle/Controller/StatusController.php index f83fa9480..1001fe269 100644 --- a/src/Bundle/ChillEventBundle/Controller/StatusController.php +++ b/src/Bundle/ChillEventBundle/Controller/StatusController.php @@ -48,30 +48,6 @@ class StatusController extends AbstractController ]); } - /** - * Deletes a Status entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/delete', name: 'chill_event_admin_status_delete', methods: ['POST', 'DELETE'])] - public function deleteAction(Request $request, mixed $id) - { - $form = $this->createDeleteForm($id); - $form->handleRequest($request); - - if ($form->isSubmitted() && $form->isValid()) { - $em = $this->managerRegistry->getManager(); - $entity = $em->getRepository(Status::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find Status entity.'); - } - - $em->remove($entity); - $em->flush(); - } - - return $this->redirectToRoute('chill_event_admin_status'); - } - /** * Displays a form to edit an existing Status entity. */ @@ -87,12 +63,10 @@ class StatusController extends AbstractController } $editForm = $this->createEditForm($entity); - $deleteForm = $this->createDeleteForm($id); return $this->render('@ChillEvent/Status/edit.html.twig', [ 'entity' => $entity, 'edit_form' => $editForm->createView(), - 'delete_form' => $deleteForm->createView(), ]); } @@ -126,28 +100,6 @@ class StatusController extends AbstractController ]); } - /** - * Finds and displays a Status entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/show', name: 'chill_event_admin_status_show')] - public function showAction(mixed $id) - { - $em = $this->managerRegistry->getManager(); - - $entity = $em->getRepository(Status::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find Status entity.'); - } - - $deleteForm = $this->createDeleteForm($id); - - return $this->render('@ChillEvent/Status/show.html.twig', [ - 'entity' => $entity, - 'delete_form' => $deleteForm->createView(), - ]); - } - /** * Edits an existing Status entity. */ @@ -162,7 +114,6 @@ class StatusController extends AbstractController throw $this->createNotFoundException('Unable to find Status entity.'); } - $deleteForm = $this->createDeleteForm($id); $editForm = $this->createEditForm($entity); $editForm->handleRequest($request); @@ -175,7 +126,6 @@ class StatusController extends AbstractController return $this->render('@ChillEvent/Status/edit.html.twig', [ 'entity' => $entity, 'edit_form' => $editForm->createView(), - 'delete_form' => $deleteForm->createView(), ]); } @@ -198,19 +148,6 @@ class StatusController extends AbstractController return $form; } - /** - * Creates a form to delete a Status entity by id. - * - * @return \Symfony\Component\Form\FormInterface The form - */ - private function createDeleteForm(mixed $id) - { - return $this->createFormBuilder() - ->setAction($this->generateUrl('chill_event_admin_status_delete', ['id' => $id])) - ->add('submit', SubmitType::class, ['label' => 'Delete']) - ->getForm(); - } - /** * Creates a form to edit a Status entity. * diff --git a/src/Bundle/ChillEventBundle/Resources/views/EventType/edit.html.twig b/src/Bundle/ChillEventBundle/Resources/views/EventType/edit.html.twig index 151a9ec0c..28a5b22e8 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/EventType/edit.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/EventType/edit.html.twig @@ -8,7 +8,7 @@ {{ form_row(edit_form.name) }} {{ form_row(edit_form.active) }} -
        +
        • {{ 'Back to the list'|trans }}
        • diff --git a/src/Bundle/ChillEventBundle/Resources/views/EventType/index.html.twig b/src/Bundle/ChillEventBundle/Resources/views/EventType/index.html.twig index 0a0154b3a..e55122d96 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/EventType/index.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/EventType/index.html.twig @@ -16,14 +16,11 @@
    {{ entity.id }}{{ entity.id }} {{ entity.name|localize_translatable_string }}{{ entity.active }}
      -
    • - -
    • diff --git a/src/Bundle/ChillEventBundle/Resources/views/EventType/new.html.twig b/src/Bundle/ChillEventBundle/Resources/views/EventType/new.html.twig index 3474ddd01..778f2cf73 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/EventType/new.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/EventType/new.html.twig @@ -8,7 +8,7 @@ {{ form_row(form.name) }} {{ form_row(form.active) }} -
        +
        • {{ 'Back to the list'|trans }}
        • diff --git a/src/Bundle/ChillEventBundle/Resources/views/EventType/show.html.twig b/src/Bundle/ChillEventBundle/Resources/views/EventType/show.html.twig index d50a97f15..ce879a719 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/EventType/show.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/EventType/show.html.twig @@ -21,17 +21,12 @@
    -
      + {% endblock %} diff --git a/src/Bundle/ChillEventBundle/Resources/views/Role/edit.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Role/edit.html.twig index 41ad81b90..04dab6188 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Role/edit.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Role/edit.html.twig @@ -8,12 +8,12 @@ {{ form_row(edit_form.type) }} {{ form_row(edit_form.active) }} -
        +
        • {{ 'Back to the list'|trans }}
        • - {{ form_row(edit_form.submit, { 'attr': { 'class' : 'btn btn-edit' }}) }} + {{ form_row(edit_form.submit, { 'attr': { 'class' : 'btn btn-update' }}) }}
        diff --git a/src/Bundle/ChillEventBundle/Resources/views/Role/index.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Role/index.html.twig index e7e9afe1b..67654bd34 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Role/index.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Role/index.html.twig @@ -17,15 +17,12 @@ {% for entity in entities %} - {{ entity.id }} + {{ entity.id }} {{ entity.name|localize_translatable_string }} {{ entity.type.name|localize_translatable_string }} - {{ entity.active }} +
          -
        • - -
        • diff --git a/src/Bundle/ChillEventBundle/Resources/views/Role/new.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Role/new.html.twig index 15363c02c..df9cf1dcf 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Role/new.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Role/new.html.twig @@ -9,7 +9,7 @@ {{ form_row(form.type) }} {{ form_row(form.active) }} -
            +
            • {{ 'Back to the list'|trans }}
            • diff --git a/src/Bundle/ChillEventBundle/Resources/views/Role/show.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Role/show.html.twig index 9fe7e3adf..4452b96e4 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Role/show.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Role/show.html.twig @@ -25,17 +25,12 @@ -
                + {% endblock %} diff --git a/src/Bundle/ChillEventBundle/Resources/views/Status/edit.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Status/edit.html.twig index 00ee2d25c..408af3b79 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Status/edit.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Status/edit.html.twig @@ -9,7 +9,7 @@ {{ form_row(edit_form.type) }} {{ form_row(edit_form.active) }} -
                  +
                  • {{ 'Back to the list'|trans }}
                  • diff --git a/src/Bundle/ChillEventBundle/Resources/views/Status/index.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Status/index.html.twig index 64336b0d1..2f71e0d2e 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Status/index.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Status/index.html.twig @@ -17,15 +17,12 @@ {% for entity in entities %} - {{ entity.id }} + {{ entity.id }} {{ entity.name|localize_translatable_string }} {{ entity.type.name|localize_translatable_string }} - {{ entity.active }} +
                      -
                    • - -
                    • diff --git a/src/Bundle/ChillEventBundle/Resources/views/Status/new.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Status/new.html.twig index 0e0b788ad..162de1d48 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Status/new.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Status/new.html.twig @@ -9,7 +9,7 @@ {{ form_row(form.type) }} {{ form_row(form.active) }} -
                        +
                        • {{ 'Back to the list'|trans }}
                        • diff --git a/src/Bundle/ChillEventBundle/Resources/views/Status/show.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Status/show.html.twig index ce0aaae98..ca5371100 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Status/show.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Status/show.html.twig @@ -25,17 +25,12 @@ -
                            + {% endblock %} From c2842148c6b28cb075f693a5e214cad4de15d4ec Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 17 Jun 2025 19:26:23 +0200 Subject: [PATCH 05/16] Improve UX with better labeling in person resource form --- .changes/unreleased/UX-20250617-192650.yaml | 6 ++++++ .../ChillPersonBundle/Form/PersonResourceType.php | 10 ++++------ .../Resources/views/PersonResource/form.html.twig | 12 ++++++------ .../ChillPersonBundle/translations/messages.fr.yml | 4 ++++ 4 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 .changes/unreleased/UX-20250617-192650.yaml diff --git a/.changes/unreleased/UX-20250617-192650.yaml b/.changes/unreleased/UX-20250617-192650.yaml new file mode 100644 index 000000000..810758b10 --- /dev/null +++ b/.changes/unreleased/UX-20250617-192650.yaml @@ -0,0 +1,6 @@ +kind: UX +body: Improve labeling of fields in person resource creation form +time: 2025-06-17T19:26:50.599703116+02:00 +custom: + Issue: "" + SchemaChange: No schema change diff --git a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php index 2063b0e21..1412733bc 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php @@ -16,10 +16,8 @@ use Chill\MainBundle\Form\Type\CommentType; use Chill\PersonBundle\Entity\Person\PersonResource; use Chill\PersonBundle\Entity\Person\PersonResourceKind; use Chill\PersonBundle\Form\Type\PickPersonDynamicType; -use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Chill\PersonBundle\Templating\Entity\ResourceKindRender; use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType; -use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender; use Doctrine\ORM\EntityRepository; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; @@ -29,7 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PersonResourceType extends AbstractType { - public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly TranslatorInterface $translator) {} public function buildForm(FormBuilderInterface $builder, array $options) { @@ -52,13 +50,13 @@ final class PersonResourceType extends AbstractType }, ]) ->add('person', PickPersonDynamicType::class, [ - 'label' => 'Usager', + 'label' => $this->translator->trans('person_resource.person_non_prof'), ]) ->add('thirdparty', PickThirdpartyDynamicType::class, [ - 'label' => 'Tiers', + 'label' => $this->translator->trans('person_resource.thirdparty_prof'), ]) ->add('freetext', ChillTextareaType::class, [ - 'label' => 'Description libre', + 'label' => $this->translator->trans('person_resource.freetext'), 'required' => false, ]) ->add('comment', CommentType::class, [ diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig index 9bda2856b..5542074fa 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig @@ -10,28 +10,28 @@
                            {% if resource is defined and resource.person is not null %} - + {% else %} - + {% endif %}
                            {% if resource is defined and resource.thirdparty is not null %} - + {% else %} - + {% endif %}
                            {% if resource is defined and resource.freeText is not null %} - + {% else %} - + {% endif %}
    diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 9bce912a0..94e6083ca 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -265,6 +265,10 @@ no comment found: "Aucun commentaire" Select a type: "Choisissez un type" Select a person: "Choisissez un usager" Kind: "Type" +person_resource: + person_non_prof: "Usager/ Tiers non-professionnel" + thirdparty_prof: "Tiers professionnel" + freetext: "Description libre" # pickAPersonType From 456f00566d93d21075f2942c1602c082a9255fd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 26 Jun 2025 12:19:49 +0200 Subject: [PATCH 06/16] update juni guidelines --- .junie/guidelines.md | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/.junie/guidelines.md b/.junie/guidelines.md index 8ef0b7c8d..eace2f4fa 100644 --- a/.junie/guidelines.md +++ b/.junie/guidelines.md @@ -22,7 +22,7 @@ Chill is a comprehensive web application built as a set of Symfony bundles. It i - **Backend**: PHP 8.3+, Symfony 5.4 - **Frontend**: JavaScript/TypeScript, Vue.js 3, Bootstrap 5 - **Build Tools**: Webpack Encore, Yarn -- **Database**: PostgreSQL with materialized views +- **Database**: PostgreSQL with materialized views. We do not support other databases. - **Other Services**: Redis, AMQP (RabbitMQ), SMTP ## Project Structure @@ -149,6 +149,42 @@ Key configuration files: - `package.json`: JavaScript dependencies and scripts - `.env`: Default environment variables. Must usually not be updated: use `.env.local` instead. +### Database migrations + +Each time a doctrine entity is created, we generate migration to adapt the database. + +The migration are created using the command `symfony console doctrine:migrations:diff --no-interaction --namespace `, where the namespace is the relevant namespace for migration. As this is a bash script, do not forget to quote the `\` (`\` must become `\\` in your command). + +Each bundle has his own namespace for migration (always ask me to confirm that command, with a list of updated / created entities so that I can confirm you that it is ok): + +- `Chill\Bundle\ActivityBundle` writes migrations to `Chill\Migrations\Activity`; +- `Chill\Bundle\BudgetBundle` writes migrations to `Chill\Migrations\Budget`; +- `Chill\Bundle\CustomFieldsBundle` writes migrations to `Chill\Migrations\CustomFields`; +- `Chill\Bundle\DocGeneratorBundle` writes migrations to `Chill\Migrations\DocGenerator`; +- `Chill\Bundle\DocStoreBundle` writes migrations to `Chill\Migrations\DocStore`; +- `Chill\Bundle\EventBundle` writes migrations to `Chill\Migrations\Event`; +- `Chill\Bundle\CalendarBundle` writes migrations to `Chill\Migrations\Calendar`; +- `Chill\Bundle\FamilyMembersBundle` writes migrations to `Chill\Migrations\FamilyMembers`; +- `Chill\Bundle\FranceTravailApiBundle` writes migrations to `Chill\Migrations\FranceTravailApi`; +- `Chill\Bundle\JobBundle` writes migrations to `Chill\Migrations\Job`; +- `Chill\Bundle\MainBundle` writes migrations to `Chill\Migrations\Main`; +- `Chill\Bundle\PersonBundle` writes migrations to `Chill\Migrations\Person`; +- `Chill\Bundle\ReportBundle` writes migrations to `Chill\Migrations\Report`; +- `Chill\Bundle\TaskBundle` writes migrations to `Chill\Migrations\Task`; +- `Chill\Bundle\ThirdPartyBundle` writes migrations to `Chill\Migrations\ThirdParty`; +- `Chill\Bundle\TicketBundle` writes migrations to `Chill\Migrations\Ticket`; +- `Chill\Bundle\WopiBundle` writes migrations to `Chill\Migrations\Wopi`; + +Once created the, comment's classes should be removed and a description of the changes made to the entities should be added to the migrations, using the `getDescription` method. The migration should not be cleaned by any artificial intelligence, as modifying this migration is error prone. + +### Guidelines related to code structure and requirements + +#### Usage of clock + +When we need to use a DateTime or DateTimeImmutable that need to express "now", we prefer the usage of +`Symfony\Component\Clock\ClockInterface`, where possible. This is usually not possible in doctrine entities, +where injection does not work when restoring an entity from database, but usually possible in services. + ### Testing Information The project uses PHPUnit for testing. Each bundle has its own test suite, and there's also a global test suite at the root level. @@ -218,7 +254,7 @@ class TicketTest extends TestCase #### Test Database -For tests that require a database, the project uses an in-memory SQLite database by default. You can configure a different database for testing in the `.env.test` file. +For tests that require a database, the project uses postgresql database filled by fixtures (usage of doctrine-fixtures). You can configure a different database for testing in the `.env.test` file. ### Code Quality Tools From 786c60a50dbcdff46fe3759766efbb2f65357aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 26 Jun 2025 12:21:19 +0200 Subject: [PATCH 07/16] Send data dumps as email attachments instead of links, update translations, and add unit tests for the handler. --- .../unreleased/Fixed-20250626-122030.yaml | 6 + .../Email/send_data_dump_to_admin.txt.twig | 6 +- .../Messenger/RequestGenerationHandler.php | 33 ++--- .../RequestGenerationHandlerTest.php | 132 ++++++++++++++++++ .../translations/messages+intl-icu.fr.yml | 4 +- .../translations/messages.fr.yml | 6 +- 6 files changed, 162 insertions(+), 25 deletions(-) create mode 100644 .changes/unreleased/Fixed-20250626-122030.yaml create mode 100644 src/Bundle/ChillDocGeneratorBundle/Tests/Service/Messenger/RequestGenerationHandlerTest.php diff --git a/.changes/unreleased/Fixed-20250626-122030.yaml b/.changes/unreleased/Fixed-20250626-122030.yaml new file mode 100644 index 000000000..72ad87552 --- /dev/null +++ b/.changes/unreleased/Fixed-20250626-122030.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: 'Doc Generation: the "dump only" method send the document as an email attachment.' +time: 2025-06-26T12:20:30.083601058+02:00 +custom: + Issue: "393" + SchemaChange: No schema change diff --git a/src/Bundle/ChillDocGeneratorBundle/Resources/views/Email/send_data_dump_to_admin.txt.twig b/src/Bundle/ChillDocGeneratorBundle/Resources/views/Email/send_data_dump_to_admin.txt.twig index 566bfbfa3..6e4228041 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Resources/views/Email/send_data_dump_to_admin.txt.twig +++ b/src/Bundle/ChillDocGeneratorBundle/Resources/views/Email/send_data_dump_to_admin.txt.twig @@ -1,7 +1,5 @@ {{ 'docgen.data_dump_email.Dear'|trans }} -{{ 'docgen.data_dump_email.data_dump_ready_and_link'|trans }} +{{ 'docgen.data_dump_email.data_dump_ready_and_attached'|trans }} -{{ link }} - -{{ 'docgen.data_dump_email.link_valid_until'|trans({validity: validity}) }} +{{ 'docgen.data_dump_email.filename'|trans({filename: filename}) }} diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php index dbd45fde0..9dd20af91 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php @@ -11,13 +11,13 @@ declare(strict_types=1); namespace Chill\DocGeneratorBundle\Service\Messenger; -use Chill\DocGeneratorBundle\Repository\DocGeneratorTemplateRepository; -use Chill\DocGeneratorBundle\Service\Generator\Generator; +use Chill\DocGeneratorBundle\Repository\DocGeneratorTemplateRepositoryInterface; use Chill\DocGeneratorBundle\Service\Generator\GeneratorException; -use Chill\DocStoreBundle\AsyncUpload\TempUrlGeneratorInterface; +use Chill\DocGeneratorBundle\Service\Generator\GeneratorInterface; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Exception\StoredObjectManagerException; -use Chill\DocStoreBundle\Repository\StoredObjectRepository; +use Chill\DocStoreBundle\Repository\StoredObjectRepositoryInterface; +use Chill\DocStoreBundle\Service\StoredObjectManagerInterface; use Chill\MainBundle\Repository\UserRepositoryInterface; use Doctrine\ORM\EntityManagerInterface; use Psr\Log\LoggerInterface; @@ -37,15 +37,15 @@ class RequestGenerationHandler implements MessageHandlerInterface private const LOG_PREFIX = '[docgen message handler] '; public function __construct( - private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, + private readonly DocGeneratorTemplateRepositoryInterface $docGeneratorTemplateRepository, private readonly EntityManagerInterface $entityManager, - private readonly Generator $generator, + private readonly GeneratorInterface $generator, private readonly LoggerInterface $logger, - private readonly StoredObjectRepository $storedObjectRepository, + private readonly StoredObjectRepositoryInterface $storedObjectRepository, private readonly UserRepositoryInterface $userRepository, private readonly MailerInterface $mailer, - private readonly TempUrlGeneratorInterface $tempUrlGenerator, private readonly TranslatorInterface $translator, + private readonly StoredObjectManagerInterface $storedObjectManager, ) {} public function __invoke(RequestGenerationMessage $message) @@ -90,7 +90,7 @@ class RequestGenerationHandler implements MessageHandlerInterface $this->sendDataDump($destinationStoredObject, $message); } else { - $destinationStoredObject = $this->generator->generateDocFromTemplate( + $this->generator->generateDocFromTemplate( $template, $message->getEntityId(), $message->getContextGenerationData(), @@ -122,19 +122,20 @@ class RequestGenerationHandler implements MessageHandlerInterface private function sendDataDump(StoredObject $destinationStoredObject, RequestGenerationMessage $message): void { - $url = $this->tempUrlGenerator->generate('GET', $destinationStoredObject->getFilename(), 3600); - $parts = []; - parse_str(parse_url($url->url)['query'], $parts); - $validity = \DateTimeImmutable::createFromFormat('U', $parts['temp_url_expires']); + // Get the content of the document + $content = $this->storedObjectManager->read($destinationStoredObject); + $filename = $destinationStoredObject->getFilename(); + $contentType = $destinationStoredObject->getType(); + // Create the email with the document as an attachment $email = (new TemplatedEmail()) ->to($message->getSendResultToEmail()) ->textTemplate('@ChillDocGenerator/Email/send_data_dump_to_admin.txt.twig') ->context([ - 'link' => $url->url, - 'validity' => $validity, + 'filename' => $filename, ]) - ->subject($this->translator->trans('docgen.data_dump_email.subject')); + ->subject($this->translator->trans('docgen.data_dump_email.subject')) + ->attach($content, $filename, $contentType); $this->mailer->send($email); } diff --git a/src/Bundle/ChillDocGeneratorBundle/Tests/Service/Messenger/RequestGenerationHandlerTest.php b/src/Bundle/ChillDocGeneratorBundle/Tests/Service/Messenger/RequestGenerationHandlerTest.php new file mode 100644 index 000000000..a0af351a4 --- /dev/null +++ b/src/Bundle/ChillDocGeneratorBundle/Tests/Service/Messenger/RequestGenerationHandlerTest.php @@ -0,0 +1,132 @@ +setPrivateProperty($template, 'id', 1); + + $storedObject = new StoredObject(); + $this->setPrivateProperty($storedObject, 'id', 2); + + $creator = new User(); + $creator->setEmail('test@example.com'); + $this->setPrivateProperty($creator, 'id', 3); + + $docGeneratorTemplateRepository = $this->prophesize(DocGeneratorTemplateRepositoryInterface::class); + $docGeneratorTemplateRepository->find(1)->willReturn($template); + + $storedObjectRepository = $this->prophesize(StoredObjectRepositoryInterface::class); + $storedObjectRepository->find(2)->willReturn($storedObject); + + $userRepository = $this->prophesize(UserRepositoryInterface::class); + $userRepository->find(3)->willReturn($creator); + + // Create a mock for the Query object + $query = $this->prophesize(Query::class); + $query->setParameter('id', 2)->willReturn($query->reveal()); + $query->execute()->shouldBeCalled(); + + // Create a mock for the EntityManager + $entityManager = $this->prophesize(EntityManagerInterface::class); + $entityManager->createQuery(Argument::containingString('UPDATE'))->willReturn($query->reveal()); + $entityManager->flush()->shouldBeCalled(); + + $generator = $this->prophesize(GeneratorInterface::class); + $generator->generateDocFromTemplate( + $template, + 123, // entityId + ['key' => 'value'], // contextGenerationData + $storedObject, + $creator + ) + ->willReturn($storedObject)->shouldBeCalled(); + + $logger = new NullLogger(); + + $mailer = $this->prophesize(MailerInterface::class); + + $translator = $this->prophesize(TranslatorInterface::class); + + $storedObjectManager = $this->prophesize(StoredObjectManagerInterface::class); + + // Create handler + $handler = new RequestGenerationHandler( + $docGeneratorTemplateRepository->reveal(), + $entityManager->reveal(), + $generator->reveal(), + $logger, + $storedObjectRepository->reveal(), + $userRepository->reveal(), + $mailer->reveal(), + $translator->reveal(), + $storedObjectManager->reveal() + ); + + // Create message + $message = new RequestGenerationMessage( + $creator, + $template, + 123, // entityId + $storedObject, + ['key' => 'value'], // contextGenerationData + false, // isTest + null, // sendResultToEmail + false // dumpOnly + ); + + // Invoke handler + $handler->__invoke($message); + + // Assertions + // The assertions are handled by the shouldBeCalled() expectations on the mocks + $this->assertTrue(true); // Just to have an assertion in the test + } + + private function setPrivateProperty(object $object, string $propertyName, $value): void + { + $reflection = new \ReflectionClass($object); + $property = $reflection->getProperty($propertyName); + $property->setAccessible(true); + $property->setValue($object, $value); + } +} diff --git a/src/Bundle/ChillDocGeneratorBundle/translations/messages+intl-icu.fr.yml b/src/Bundle/ChillDocGeneratorBundle/translations/messages+intl-icu.fr.yml index df20907c9..6bbaa5f7d 100644 --- a/src/Bundle/ChillDocGeneratorBundle/translations/messages+intl-icu.fr.yml +++ b/src/Bundle/ChillDocGeneratorBundle/translations/messages+intl-icu.fr.yml @@ -1,4 +1,2 @@ docgen: - data_dump_email: - link_valid_until: >- - Ce lien est valide jusqu'au {validity, date, full}, {validity, time, medium} + # No ICU messages needed for data_dump_email anymore diff --git a/src/Bundle/ChillDocGeneratorBundle/translations/messages.fr.yml b/src/Bundle/ChillDocGeneratorBundle/translations/messages.fr.yml index 1fdf14c02..c1601ea6e 100644 --- a/src/Bundle/ChillDocGeneratorBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillDocGeneratorBundle/translations/messages.fr.yml @@ -34,8 +34,10 @@ docgen: data_dump_email: subject: Contenu des données de génération de document disponible Dear: Cher - data_dump_ready_and_link: >- - Le contenu des données est disponible. Vous pouvez le télécharger à l'aide du lien suivant: + data_dump_ready_and_attached: >- + Le contenu des données est disponible. Vous le trouverez en pièce jointe à cet email. + filename: >- + Nom du fichier: %filename% From 0b580658def7ba12b0b29b7b8fcd6f2c46d27162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 26 Jun 2025 14:38:12 +0200 Subject: [PATCH 08/16] Remove unnecessary workflow deletion logic when in the initial position --- .changes/unreleased/Feature-20250626-143735.yaml | 6 ++++++ .../Service/Workflow/CancelStaleWorkflowHandler.php | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 .changes/unreleased/Feature-20250626-143735.yaml diff --git a/.changes/unreleased/Feature-20250626-143735.yaml b/.changes/unreleased/Feature-20250626-143735.yaml new file mode 100644 index 000000000..b1a447016 --- /dev/null +++ b/.changes/unreleased/Feature-20250626-143735.yaml @@ -0,0 +1,6 @@ +kind: Feature +body: Do not remove workflow which are automatically canceled after staling for more than 30 days +time: 2025-06-26T14:37:35.267672192+02:00 +custom: + Issue: "" + SchemaChange: No schema change diff --git a/src/Bundle/ChillMainBundle/Service/Workflow/CancelStaleWorkflowHandler.php b/src/Bundle/ChillMainBundle/Service/Workflow/CancelStaleWorkflowHandler.php index d392df1ca..4dec39572 100644 --- a/src/Bundle/ChillMainBundle/Service/Workflow/CancelStaleWorkflowHandler.php +++ b/src/Bundle/ChillMainBundle/Service/Workflow/CancelStaleWorkflowHandler.php @@ -58,7 +58,6 @@ final readonly class CancelStaleWorkflowHandler $transitions = $workflowComponent->getEnabledTransitions($workflow); $transitionApplied = false; - $wasInInitialPosition = 'initial' === $workflow->getStep(); foreach ($transitions as $transition) { if ($this->willTransitionLeadToFinalNegative($transition, $metadataStore)) { @@ -80,10 +79,6 @@ final readonly class CancelStaleWorkflowHandler throw new UnrecoverableMessageHandlingException(sprintf('No valid transition found for EntityWorkflow %d.', $workflowId)); } - if ($wasInInitialPosition) { - $this->em->remove($workflow); - } - $this->em->flush(); } From 298044bc82ba16e3e3205466098ac0921d6bc305 Mon Sep 17 00:00:00 2001 From: LenaertsJ Date: Mon, 30 Jun 2025 08:44:24 +0000 Subject: [PATCH 09/16] Improve admin templates for event admin entities + activity reason (category)... --- .../unreleased/Fixed-20250611-164623.yaml | 6 ++ .changes/unreleased/UX-20250617-192650.yaml | 6 ++ .../ActivityReasonCategoryController.php | 47 +------------ .../Controller/ActivityReasonController.php | 45 +----------- .../views/ActivityReason/index.html.twig | 7 +- .../ActivityReasonCategory/index.html.twig | 7 +- .../Controller/EventTypeController.php | 68 +------------------ .../Controller/RoleController.php | 66 +----------------- .../Controller/StatusController.php | 65 +----------------- .../Resources/views/EventType/edit.html.twig | 2 +- .../Resources/views/EventType/index.html.twig | 7 +- .../Resources/views/EventType/new.html.twig | 2 +- .../Resources/views/EventType/show.html.twig | 7 +- .../Resources/views/Role/edit.html.twig | 4 +- .../Resources/views/Role/index.html.twig | 7 +- .../Resources/views/Role/new.html.twig | 2 +- .../Resources/views/Role/show.html.twig | 7 +- .../Resources/views/Status/edit.html.twig | 2 +- .../Resources/views/Status/index.html.twig | 7 +- .../Resources/views/Status/new.html.twig | 2 +- .../Resources/views/Status/show.html.twig | 7 +- .../Form/PersonResourceType.php | 10 ++- .../views/PersonResource/form.html.twig | 12 ++-- .../translations/messages.fr.yml | 4 ++ 24 files changed, 54 insertions(+), 345 deletions(-) create mode 100644 .changes/unreleased/Fixed-20250611-164623.yaml create mode 100644 .changes/unreleased/UX-20250617-192650.yaml diff --git a/.changes/unreleased/Fixed-20250611-164623.yaml b/.changes/unreleased/Fixed-20250611-164623.yaml new file mode 100644 index 000000000..8bb956c34 --- /dev/null +++ b/.changes/unreleased/Fixed-20250611-164623.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: Fix admin entity edit actions for event admin entities and activity reason (category) entities +time: 2025-06-11T16:46:23.113506434+02:00 +custom: + Issue: "" + SchemaChange: No schema change diff --git a/.changes/unreleased/UX-20250617-192650.yaml b/.changes/unreleased/UX-20250617-192650.yaml new file mode 100644 index 000000000..810758b10 --- /dev/null +++ b/.changes/unreleased/UX-20250617-192650.yaml @@ -0,0 +1,6 @@ +kind: UX +body: Improve labeling of fields in person resource creation form +time: 2025-06-17T19:26:50.599703116+02:00 +custom: + Issue: "" + SchemaChange: No schema change diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php index 0d337416b..6ccddcc97 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonCategoryController.php @@ -48,28 +48,6 @@ class ActivityReasonCategoryController extends AbstractController ]); } - /** - * Displays a form to edit an existing ActivityReasonCategory entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/edit', name: 'chill_activity_activityreasoncategory_edit')] - public function editAction(mixed $id) - { - $em = $this->managerRegistry->getManager(); - - $entity = $em->getRepository(ActivityReasonCategory::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.'); - } - - $editForm = $this->createEditForm($entity); - - return $this->render('@ChillActivity/ActivityReasonCategory/edit.html.twig', [ - 'entity' => $entity, - 'edit_form' => $editForm->createView(), - ]); - } - /** * Lists all ActivityReasonCategory entities. */ @@ -100,29 +78,10 @@ class ActivityReasonCategoryController extends AbstractController ]); } - /** - * Finds and displays a ActivityReasonCategory entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/show', name: 'chill_activity_activityreasoncategory_show')] - public function showAction(mixed $id) - { - $em = $this->managerRegistry->getManager(); - - $entity = $em->getRepository(ActivityReasonCategory::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.'); - } - - return $this->render('@ChillActivity/ActivityReasonCategory/show.html.twig', [ - 'entity' => $entity, - ]); - } - /** * Edits an existing ActivityReasonCategory entity. */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/update', name: 'chill_activity_activityreasoncategory_update', methods: ['POST', 'PUT'])] + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/update', name: 'chill_activity_activityreasoncategory_update')] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); @@ -139,7 +98,7 @@ class ActivityReasonCategoryController extends AbstractController if ($editForm->isSubmitted() && $editForm->isValid()) { $em->flush(); - return $this->redirectToRoute('chill_activity_activityreasoncategory_edit', ['id' => $id]); + return $this->redirectToRoute('chill_activity_activityreasoncategory', ['id' => $id]); } return $this->render('@ChillActivity/ActivityReasonCategory/edit.html.twig', [ @@ -178,7 +137,7 @@ class ActivityReasonCategoryController extends AbstractController { $form = $this->createForm(ActivityReasonCategoryType::class, $entity, [ 'action' => $this->generateUrl('chill_activity_activityreasoncategory_update', ['id' => $entity->getId()]), - 'method' => 'PUT', + 'method' => 'POST', ]); $form->add('submit', SubmitType::class, ['label' => 'Update']); diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php index 37d04d367..0167273c5 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityReasonController.php @@ -50,28 +50,6 @@ class ActivityReasonController extends AbstractController ]); } - /** - * Displays a form to edit an existing ActivityReason entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/edit', name: 'chill_activity_activityreason_edit')] - public function editAction(mixed $id) - { - $em = $this->managerRegistry->getManager(); - - $entity = $em->getRepository(ActivityReason::class)->find($id); - - if (null === $entity) { - throw new NotFoundHttpException('Unable to find ActivityReason entity.'); - } - - $editForm = $this->createEditForm($entity); - - return $this->render('@ChillActivity/ActivityReason/edit.html.twig', [ - 'entity' => $entity, - 'edit_form' => $editForm->createView(), - ]); - } - /** * Lists all ActivityReason entities. */ @@ -102,29 +80,10 @@ class ActivityReasonController extends AbstractController ]); } - /** - * Finds and displays a ActivityReason entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/show', name: 'chill_activity_activityreason_show')] - public function showAction(mixed $id) - { - $em = $this->managerRegistry->getManager(); - - $entity = $em->getRepository(ActivityReason::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find ActivityReason entity.'); - } - - return $this->render('@ChillActivity/ActivityReason/show.html.twig', [ - 'entity' => $entity, - ]); - } - /** * Edits an existing ActivityReason entity. */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/update', name: 'chill_activity_activityreason_update', methods: ['POST', 'PUT'])] + #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/update', name: 'chill_activity_activityreason_update')] public function updateAction(Request $request, mixed $id) { $em = $this->managerRegistry->getManager(); @@ -180,7 +139,7 @@ class ActivityReasonController extends AbstractController { $form = $this->createForm(ActivityReasonType::class, $entity, [ 'action' => $this->generateUrl('chill_activity_activityreason_update', ['id' => $entity->getId()]), - 'method' => 'PUT', + 'method' => 'POST', ]); $form->add('submit', SubmitType::class, ['label' => 'Update']); diff --git a/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/index.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/index.html.twig index 855c9386d..ee36958c3 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/index.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/ActivityReason/index.html.twig @@ -3,7 +3,7 @@ {% block admin_content %}

    {{ 'ActivityReason list'|trans }}

    - +
    @@ -29,10 +29,7 @@ diff --git a/src/Bundle/ChillActivityBundle/Resources/views/ActivityReasonCategory/index.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/ActivityReasonCategory/index.html.twig index 5f48180b3..f64ce359d 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/ActivityReasonCategory/index.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/ActivityReasonCategory/index.html.twig @@ -3,7 +3,7 @@ {% block admin_content %}

    {{ 'ActivityReasonCategory list'|trans }}

    -
    {{ 'Name'|trans }}
    • - -
    • -
    • - +
    +
    @@ -23,10 +23,7 @@ diff --git a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php index f7b1b205c..969e60cb7 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventTypeController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventTypeController.php @@ -48,30 +48,6 @@ class EventTypeController extends AbstractController ]); } - /** - * Deletes a EventType entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/delete', name: 'chill_eventtype_admin_delete', methods: ['POST', 'DELETE'])] - public function deleteAction(Request $request, mixed $id) - { - $form = $this->createDeleteForm($id); - $form->handleRequest($request); - - if ($form->isSubmitted() && $form->isValid()) { - $em = $this->managerRegistry->getManager(); - $entity = $em->getRepository(EventType::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find EventType entity.'); - } - - $em->remove($entity); - $em->flush(); - } - - return $this->redirectToRoute('chill_eventtype_admin'); - } - /** * Displays a form to edit an existing EventType entity. */ @@ -87,12 +63,10 @@ class EventTypeController extends AbstractController } $editForm = $this->createEditForm($entity); - $deleteForm = $this->createDeleteForm($id); return $this->render('@ChillEvent/EventType/edit.html.twig', [ 'entity' => $entity, 'edit_form' => $editForm->createView(), - 'delete_form' => $deleteForm->createView(), ]); } @@ -126,28 +100,6 @@ class EventTypeController extends AbstractController ]); } - /** - * Finds and displays a EventType entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/show', name: 'chill_eventtype_admin_show')] - public function showAction(mixed $id) - { - $em = $this->managerRegistry->getManager(); - - $entity = $em->getRepository(EventType::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find EventType entity.'); - } - - $deleteForm = $this->createDeleteForm($id); - - return $this->render('@ChillEvent/EventType/show.html.twig', [ - 'entity' => $entity, - 'delete_form' => $deleteForm->createView(), - ]); - } - /** * Edits an existing EventType entity. */ @@ -162,7 +114,6 @@ class EventTypeController extends AbstractController throw $this->createNotFoundException('Unable to find EventType entity.'); } - $deleteForm = $this->createDeleteForm($id); $editForm = $this->createEditForm($entity); $editForm->handleRequest($request); @@ -175,7 +126,6 @@ class EventTypeController extends AbstractController return $this->render('@ChillEvent/EventType/edit.html.twig', [ 'entity' => $entity, 'edit_form' => $editForm->createView(), - 'delete_form' => $deleteForm->createView(), ]); } @@ -198,22 +148,6 @@ class EventTypeController extends AbstractController return $form; } - /** - * Creates a form to delete a EventType entity by id. - * - * @return \Symfony\Component\Form\FormInterface The form - */ - private function createDeleteForm(mixed $id) - { - return $this->createFormBuilder() - ->setAction($this->generateUrl( - 'chill_eventtype_admin_delete', - ['id' => $id] - )) - ->add('submit', SubmitType::class, ['label' => 'Delete']) - ->getForm(); - } - /** * Creates a form to edit a EventType entity. * @@ -228,7 +162,7 @@ class EventTypeController extends AbstractController 'chill_eventtype_admin_update', ['id' => $entity->getId()] ), - 'method' => 'PUT', + 'method' => 'POST', ]); $form->add('submit', SubmitType::class, ['label' => 'Update']); diff --git a/src/Bundle/ChillEventBundle/Controller/RoleController.php b/src/Bundle/ChillEventBundle/Controller/RoleController.php index 1ff205dfc..9d0c38c92 100644 --- a/src/Bundle/ChillEventBundle/Controller/RoleController.php +++ b/src/Bundle/ChillEventBundle/Controller/RoleController.php @@ -48,30 +48,6 @@ class RoleController extends AbstractController ]); } - /** - * Deletes a Role entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/delete', name: 'chill_event_admin_role_delete', methods: ['POST', 'DELETE'])] - public function deleteAction(Request $request, mixed $id) - { - $form = $this->createDeleteForm($id); - $form->handleRequest($request); - - if ($form->isSubmitted() && $form->isValid()) { - $em = $this->managerRegistry->getManager(); - $entity = $em->getRepository(Role::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find Role entity.'); - } - - $em->remove($entity); - $em->flush(); - } - - return $this->redirectToRoute('chill_event_admin_role'); - } - /** * Displays a form to edit an existing Role entity. */ @@ -87,12 +63,10 @@ class RoleController extends AbstractController } $editForm = $this->createEditForm($entity); - $deleteForm = $this->createDeleteForm($id); return $this->render('@ChillEvent/Role/edit.html.twig', [ 'entity' => $entity, 'edit_form' => $editForm->createView(), - 'delete_form' => $deleteForm->createView(), ]); } @@ -126,28 +100,6 @@ class RoleController extends AbstractController ]); } - /** - * Finds and displays a Role entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/show', name: 'chill_event_admin_role_show')] - public function showAction(mixed $id) - { - $em = $this->managerRegistry->getManager(); - - $entity = $em->getRepository(Role::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find Role entity.'); - } - - $deleteForm = $this->createDeleteForm($id); - - return $this->render('@ChillEvent/Role/show.html.twig', [ - 'entity' => $entity, - 'delete_form' => $deleteForm->createView(), - ]); - } - /** * Edits an existing Role entity. */ @@ -162,7 +114,6 @@ class RoleController extends AbstractController throw $this->createNotFoundException('Unable to find Role entity.'); } - $deleteForm = $this->createDeleteForm($id); $editForm = $this->createEditForm($entity); $editForm->handleRequest($request); @@ -175,7 +126,6 @@ class RoleController extends AbstractController return $this->render('@ChillEvent/Role/edit.html.twig', [ 'entity' => $entity, 'edit_form' => $editForm->createView(), - 'delete_form' => $deleteForm->createView(), ]); } @@ -198,20 +148,6 @@ class RoleController extends AbstractController return $form; } - /** - * Creates a form to delete a Role entity by id. - * - * @return \Symfony\Component\Form\FormInterface The form - */ - private function createDeleteForm(mixed $id) - { - return $this->createFormBuilder() - ->setAction($this->generateUrl('chill_event_admin_role_delete', ['id' => $id])) - ->setMethod('DELETE') - ->add('submit', SubmitType::class, ['label' => 'Delete']) - ->getForm(); - } - /** * Creates a form to edit a Role entity. * @@ -226,7 +162,7 @@ class RoleController extends AbstractController 'chill_event_admin_role_update', ['id' => $entity->getId()] ), - 'method' => 'PUT', + 'method' => 'POST', ]); $form->add('submit', SubmitType::class, ['label' => 'Update']); diff --git a/src/Bundle/ChillEventBundle/Controller/StatusController.php b/src/Bundle/ChillEventBundle/Controller/StatusController.php index 3b302500d..1001fe269 100644 --- a/src/Bundle/ChillEventBundle/Controller/StatusController.php +++ b/src/Bundle/ChillEventBundle/Controller/StatusController.php @@ -48,30 +48,6 @@ class StatusController extends AbstractController ]); } - /** - * Deletes a Status entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/delete', name: 'chill_event_admin_status_delete', methods: ['POST', 'DELETE'])] - public function deleteAction(Request $request, mixed $id) - { - $form = $this->createDeleteForm($id); - $form->handleRequest($request); - - if ($form->isSubmitted() && $form->isValid()) { - $em = $this->managerRegistry->getManager(); - $entity = $em->getRepository(Status::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find Status entity.'); - } - - $em->remove($entity); - $em->flush(); - } - - return $this->redirectToRoute('chill_event_admin_status'); - } - /** * Displays a form to edit an existing Status entity. */ @@ -87,12 +63,10 @@ class StatusController extends AbstractController } $editForm = $this->createEditForm($entity); - $deleteForm = $this->createDeleteForm($id); return $this->render('@ChillEvent/Status/edit.html.twig', [ 'entity' => $entity, 'edit_form' => $editForm->createView(), - 'delete_form' => $deleteForm->createView(), ]); } @@ -126,28 +100,6 @@ class StatusController extends AbstractController ]); } - /** - * Finds and displays a Status entity. - */ - #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/show', name: 'chill_event_admin_status_show')] - public function showAction(mixed $id) - { - $em = $this->managerRegistry->getManager(); - - $entity = $em->getRepository(Status::class)->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find Status entity.'); - } - - $deleteForm = $this->createDeleteForm($id); - - return $this->render('@ChillEvent/Status/show.html.twig', [ - 'entity' => $entity, - 'delete_form' => $deleteForm->createView(), - ]); - } - /** * Edits an existing Status entity. */ @@ -162,7 +114,6 @@ class StatusController extends AbstractController throw $this->createNotFoundException('Unable to find Status entity.'); } - $deleteForm = $this->createDeleteForm($id); $editForm = $this->createEditForm($entity); $editForm->handleRequest($request); @@ -175,7 +126,6 @@ class StatusController extends AbstractController return $this->render('@ChillEvent/Status/edit.html.twig', [ 'entity' => $entity, 'edit_form' => $editForm->createView(), - 'delete_form' => $deleteForm->createView(), ]); } @@ -198,19 +148,6 @@ class StatusController extends AbstractController return $form; } - /** - * Creates a form to delete a Status entity by id. - * - * @return \Symfony\Component\Form\FormInterface The form - */ - private function createDeleteForm(mixed $id) - { - return $this->createFormBuilder() - ->setAction($this->generateUrl('chill_event_admin_status_delete', ['id' => $id])) - ->add('submit', SubmitType::class, ['label' => 'Delete']) - ->getForm(); - } - /** * Creates a form to edit a Status entity. * @@ -222,7 +159,7 @@ class StatusController extends AbstractController { $form = $this->createForm(StatusType::class, $entity, [ 'action' => $this->generateUrl('chill_event_admin_status_update', ['id' => $entity->getId()]), - 'method' => 'PUT', + 'method' => 'POST', ]); $form->add('submit', SubmitType::class, ['label' => 'Update']); diff --git a/src/Bundle/ChillEventBundle/Resources/views/EventType/edit.html.twig b/src/Bundle/ChillEventBundle/Resources/views/EventType/edit.html.twig index 151a9ec0c..28a5b22e8 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/EventType/edit.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/EventType/edit.html.twig @@ -8,7 +8,7 @@ {{ form_row(edit_form.name) }} {{ form_row(edit_form.active) }} -
      +
      • {{ 'Back to the list'|trans }}
      • diff --git a/src/Bundle/ChillEventBundle/Resources/views/EventType/index.html.twig b/src/Bundle/ChillEventBundle/Resources/views/EventType/index.html.twig index 0a0154b3a..e55122d96 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/EventType/index.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/EventType/index.html.twig @@ -16,14 +16,11 @@
    {% for entity in entities %} - + - +
    {{ 'Name'|trans }}
    • - -
    • -
    • - +
    {{ entity.id }}{{ entity.id }} {{ entity.name|localize_translatable_string }}{{ entity.active }}
      -
    • - -
    • diff --git a/src/Bundle/ChillEventBundle/Resources/views/EventType/new.html.twig b/src/Bundle/ChillEventBundle/Resources/views/EventType/new.html.twig index 3474ddd01..778f2cf73 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/EventType/new.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/EventType/new.html.twig @@ -8,7 +8,7 @@ {{ form_row(form.name) }} {{ form_row(form.active) }} -
        +
        • {{ 'Back to the list'|trans }}
        • diff --git a/src/Bundle/ChillEventBundle/Resources/views/EventType/show.html.twig b/src/Bundle/ChillEventBundle/Resources/views/EventType/show.html.twig index d50a97f15..ce879a719 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/EventType/show.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/EventType/show.html.twig @@ -21,17 +21,12 @@
    -
      + {% endblock %} diff --git a/src/Bundle/ChillEventBundle/Resources/views/Role/edit.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Role/edit.html.twig index 41ad81b90..04dab6188 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Role/edit.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Role/edit.html.twig @@ -8,12 +8,12 @@ {{ form_row(edit_form.type) }} {{ form_row(edit_form.active) }} -
        +
        • {{ 'Back to the list'|trans }}
        • - {{ form_row(edit_form.submit, { 'attr': { 'class' : 'btn btn-edit' }}) }} + {{ form_row(edit_form.submit, { 'attr': { 'class' : 'btn btn-update' }}) }}
        diff --git a/src/Bundle/ChillEventBundle/Resources/views/Role/index.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Role/index.html.twig index e7e9afe1b..67654bd34 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Role/index.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Role/index.html.twig @@ -17,15 +17,12 @@ {% for entity in entities %} - {{ entity.id }} + {{ entity.id }} {{ entity.name|localize_translatable_string }} {{ entity.type.name|localize_translatable_string }} - {{ entity.active }} +
          -
        • - -
        • diff --git a/src/Bundle/ChillEventBundle/Resources/views/Role/new.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Role/new.html.twig index 15363c02c..df9cf1dcf 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Role/new.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Role/new.html.twig @@ -9,7 +9,7 @@ {{ form_row(form.type) }} {{ form_row(form.active) }} -
            +
            • {{ 'Back to the list'|trans }}
            • diff --git a/src/Bundle/ChillEventBundle/Resources/views/Role/show.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Role/show.html.twig index 9fe7e3adf..4452b96e4 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Role/show.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Role/show.html.twig @@ -25,17 +25,12 @@ -
                + {% endblock %} diff --git a/src/Bundle/ChillEventBundle/Resources/views/Status/edit.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Status/edit.html.twig index 00ee2d25c..408af3b79 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Status/edit.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Status/edit.html.twig @@ -9,7 +9,7 @@ {{ form_row(edit_form.type) }} {{ form_row(edit_form.active) }} -
                  +
                  • {{ 'Back to the list'|trans }}
                  • diff --git a/src/Bundle/ChillEventBundle/Resources/views/Status/index.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Status/index.html.twig index 64336b0d1..2f71e0d2e 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Status/index.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Status/index.html.twig @@ -17,15 +17,12 @@ {% for entity in entities %} - {{ entity.id }} + {{ entity.id }} {{ entity.name|localize_translatable_string }} {{ entity.type.name|localize_translatable_string }} - {{ entity.active }} +
                      -
                    • - -
                    • diff --git a/src/Bundle/ChillEventBundle/Resources/views/Status/new.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Status/new.html.twig index 0e0b788ad..162de1d48 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Status/new.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Status/new.html.twig @@ -9,7 +9,7 @@ {{ form_row(form.type) }} {{ form_row(form.active) }} -
                        +
                        • {{ 'Back to the list'|trans }}
                        • diff --git a/src/Bundle/ChillEventBundle/Resources/views/Status/show.html.twig b/src/Bundle/ChillEventBundle/Resources/views/Status/show.html.twig index ce0aaae98..ca5371100 100644 --- a/src/Bundle/ChillEventBundle/Resources/views/Status/show.html.twig +++ b/src/Bundle/ChillEventBundle/Resources/views/Status/show.html.twig @@ -25,17 +25,12 @@ -
                            + {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php index 2063b0e21..1412733bc 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php @@ -16,10 +16,8 @@ use Chill\MainBundle\Form\Type\CommentType; use Chill\PersonBundle\Entity\Person\PersonResource; use Chill\PersonBundle\Entity\Person\PersonResourceKind; use Chill\PersonBundle\Form\Type\PickPersonDynamicType; -use Chill\PersonBundle\Templating\Entity\PersonRenderInterface; use Chill\PersonBundle\Templating\Entity\ResourceKindRender; use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType; -use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender; use Doctrine\ORM\EntityRepository; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; @@ -29,7 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PersonResourceType extends AbstractType { - public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly PersonRenderInterface $personRender, private readonly ThirdPartyRender $thirdPartyRender, private readonly TranslatorInterface $translator) {} + public function __construct(private readonly ResourceKindRender $resourceKindRender, private readonly TranslatorInterface $translator) {} public function buildForm(FormBuilderInterface $builder, array $options) { @@ -52,13 +50,13 @@ final class PersonResourceType extends AbstractType }, ]) ->add('person', PickPersonDynamicType::class, [ - 'label' => 'Usager', + 'label' => $this->translator->trans('person_resource.person_non_prof'), ]) ->add('thirdparty', PickThirdpartyDynamicType::class, [ - 'label' => 'Tiers', + 'label' => $this->translator->trans('person_resource.thirdparty_prof'), ]) ->add('freetext', ChillTextareaType::class, [ - 'label' => 'Description libre', + 'label' => $this->translator->trans('person_resource.freetext'), 'required' => false, ]) ->add('comment', CommentType::class, [ diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig index 9bda2856b..5542074fa 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/form.html.twig @@ -10,28 +10,28 @@
                            {% if resource is defined and resource.person is not null %} - + {% else %} - + {% endif %}
                            {% if resource is defined and resource.thirdparty is not null %} - + {% else %} - + {% endif %}
                            {% if resource is defined and resource.freeText is not null %} - + {% else %} - + {% endif %}
    diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 9bce912a0..94e6083ca 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -265,6 +265,10 @@ no comment found: "Aucun commentaire" Select a type: "Choisissez un type" Select a person: "Choisissez un usager" Kind: "Type" +person_resource: + person_non_prof: "Usager/ Tiers non-professionnel" + thirdparty_prof: "Tiers professionnel" + freetext: "Description libre" # pickAPersonType From 27d344c97dafeaf495fe5bc9109e0793ba75a5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 30 Jun 2025 11:00:42 +0200 Subject: [PATCH 10/16] Release v3.12.0 --- .changes/unreleased/DX-20250430-144550.yaml | 6 --- .changes/unreleased/DX-20250528-165813.yaml | 6 --- .../unreleased/Feature-20250424-142211.yaml | 7 --- .../unreleased/Feature-20250520-095628.yaml | 6 --- .../unreleased/Feature-20250523-133341.yaml | 6 --- .../unreleased/Feature-20250523-133434.yaml | 6 --- .../unreleased/Feature-20250626-143735.yaml | 6 --- .../unreleased/Fixed-20250424-133943.yaml | 7 --- .../unreleased/Fixed-20250424-163746.yaml | 7 --- .../unreleased/Fixed-20250505-102715.yaml | 6 --- .../unreleased/Fixed-20250514-145339.yaml | 6 --- .../unreleased/Fixed-20250611-164623.yaml | 6 --- .../unreleased/Fixed-20250619-170142.yaml | 7 --- .../unreleased/Fixed-20250626-122030.yaml | 6 --- .changes/unreleased/UX-20250423-172624.yaml | 6 --- .changes/unreleased/UX-20250617-192650.yaml | 6 --- .changes/v3.12.0.md | 22 ++++++++++ CHANGELOG.md | 43 +++++++++++++++++++ 18 files changed, 65 insertions(+), 100 deletions(-) delete mode 100644 .changes/unreleased/DX-20250430-144550.yaml delete mode 100644 .changes/unreleased/DX-20250528-165813.yaml delete mode 100644 .changes/unreleased/Feature-20250424-142211.yaml delete mode 100644 .changes/unreleased/Feature-20250520-095628.yaml delete mode 100644 .changes/unreleased/Feature-20250523-133341.yaml delete mode 100644 .changes/unreleased/Feature-20250523-133434.yaml delete mode 100644 .changes/unreleased/Feature-20250626-143735.yaml delete mode 100644 .changes/unreleased/Fixed-20250424-133943.yaml delete mode 100644 .changes/unreleased/Fixed-20250424-163746.yaml delete mode 100644 .changes/unreleased/Fixed-20250505-102715.yaml delete mode 100644 .changes/unreleased/Fixed-20250514-145339.yaml delete mode 100644 .changes/unreleased/Fixed-20250611-164623.yaml delete mode 100644 .changes/unreleased/Fixed-20250619-170142.yaml delete mode 100644 .changes/unreleased/Fixed-20250626-122030.yaml delete mode 100644 .changes/unreleased/UX-20250423-172624.yaml delete mode 100644 .changes/unreleased/UX-20250617-192650.yaml create mode 100644 .changes/v3.12.0.md diff --git a/.changes/unreleased/DX-20250430-144550.yaml b/.changes/unreleased/DX-20250430-144550.yaml deleted file mode 100644 index 7d9f0c32b..000000000 --- a/.changes/unreleased/DX-20250430-144550.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: DX -body: Remove dead code for wopi-link module -time: 2025-04-30T14:45:50.406111606+02:00 -custom: - Issue: "352" - SchemaChange: No schema change diff --git a/.changes/unreleased/DX-20250528-165813.yaml b/.changes/unreleased/DX-20250528-165813.yaml deleted file mode 100644 index f13945e76..000000000 --- a/.changes/unreleased/DX-20250528-165813.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: DX -body: Replace library node-sass by sass, and upgrade bootstrap to version 5.3 (yarn upgrade / install is required) -time: 2025-05-28T16:58:13.226870341+02:00 -custom: - Issue: "" - SchemaChange: No schema change diff --git a/.changes/unreleased/Feature-20250424-142211.yaml b/.changes/unreleased/Feature-20250424-142211.yaml deleted file mode 100644 index e1f5297c3..000000000 --- a/.changes/unreleased/Feature-20250424-142211.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Feature -body: Add the document file name to the document title when a user upload a document, - unless there is already a document title. -time: 2025-04-24T14:22:11.800975422+02:00 -custom: - Issue: "377" - SchemaChange: No schema change diff --git a/.changes/unreleased/Feature-20250520-095628.yaml b/.changes/unreleased/Feature-20250520-095628.yaml deleted file mode 100644 index 4b1fba30c..000000000 --- a/.changes/unreleased/Feature-20250520-095628.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Feature -body: Add desactivation date for social action and issue csv export -time: 2025-05-20T09:56:28.108941934+02:00 -custom: - Issue: "" - SchemaChange: No schema change diff --git a/.changes/unreleased/Feature-20250523-133341.yaml b/.changes/unreleased/Feature-20250523-133341.yaml deleted file mode 100644 index 1a5513a0d..000000000 --- a/.changes/unreleased/Feature-20250523-133341.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Feature -body: Add Emoji and Fullscreen feature to ckeditor configuration -time: 2025-05-23T13:33:41.645095128+02:00 -custom: - Issue: "" - SchemaChange: No schema change diff --git a/.changes/unreleased/Feature-20250523-133434.yaml b/.changes/unreleased/Feature-20250523-133434.yaml deleted file mode 100644 index 31dced03a..000000000 --- a/.changes/unreleased/Feature-20250523-133434.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Feature -body: Create editor which allow us to toggle between rich and simple text editor -time: 2025-05-23T13:34:34.56795603+02:00 -custom: - Issue: "321" - SchemaChange: No schema change diff --git a/.changes/unreleased/Feature-20250626-143735.yaml b/.changes/unreleased/Feature-20250626-143735.yaml deleted file mode 100644 index b1a447016..000000000 --- a/.changes/unreleased/Feature-20250626-143735.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Feature -body: Do not remove workflow which are automatically canceled after staling for more than 30 days -time: 2025-06-26T14:37:35.267672192+02:00 -custom: - Issue: "" - SchemaChange: No schema change diff --git a/.changes/unreleased/Fixed-20250424-133943.yaml b/.changes/unreleased/Fixed-20250424-133943.yaml deleted file mode 100644 index c11c42ac0..000000000 --- a/.changes/unreleased/Fixed-20250424-133943.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Fixed -body: trying to prevent bug of typeerror in doc-history + improved display of document - history -time: 2025-04-24T13:39:43.878468232+02:00 -custom: - Issue: "376" - SchemaChange: No schema change diff --git a/.changes/unreleased/Fixed-20250424-163746.yaml b/.changes/unreleased/Fixed-20250424-163746.yaml deleted file mode 100644 index 79c07b080..000000000 --- a/.changes/unreleased/Fixed-20250424-163746.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Fixed -body: Display previous participation in acc course work even if the person has left - the acc course -time: 2025-04-24T16:37:46.970203594+02:00 -custom: - Issue: "381" - SchemaChange: No schema change diff --git a/.changes/unreleased/Fixed-20250505-102715.yaml b/.changes/unreleased/Fixed-20250505-102715.yaml deleted file mode 100644 index 5d47c25af..000000000 --- a/.changes/unreleased/Fixed-20250505-102715.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixed -body: Fix display of text in calendar events -time: 2025-05-05T10:27:15.461493066+02:00 -custom: - Issue: "372" - SchemaChange: No schema change diff --git a/.changes/unreleased/Fixed-20250514-145339.yaml b/.changes/unreleased/Fixed-20250514-145339.yaml deleted file mode 100644 index 862ea764b..000000000 --- a/.changes/unreleased/Fixed-20250514-145339.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixed -body: Add missing translation for user_group.no_user_groups -time: 2025-05-14T14:53:39.53927329+02:00 -custom: - Issue: "" - SchemaChange: No schema change diff --git a/.changes/unreleased/Fixed-20250611-164623.yaml b/.changes/unreleased/Fixed-20250611-164623.yaml deleted file mode 100644 index 8bb956c34..000000000 --- a/.changes/unreleased/Fixed-20250611-164623.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixed -body: Fix admin entity edit actions for event admin entities and activity reason (category) entities -time: 2025-06-11T16:46:23.113506434+02:00 -custom: - Issue: "" - SchemaChange: No schema change diff --git a/.changes/unreleased/Fixed-20250619-170142.yaml b/.changes/unreleased/Fixed-20250619-170142.yaml deleted file mode 100644 index d9ee78e1b..000000000 --- a/.changes/unreleased/Fixed-20250619-170142.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Fixed -body: | - Allow null and cast as string to setContent method for NewsItem -time: 2025-06-19T17:01:42.125730402+02:00 -custom: - Issue: "392" - SchemaChange: No schema change diff --git a/.changes/unreleased/Fixed-20250626-122030.yaml b/.changes/unreleased/Fixed-20250626-122030.yaml deleted file mode 100644 index 72ad87552..000000000 --- a/.changes/unreleased/Fixed-20250626-122030.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixed -body: 'Doc Generation: the "dump only" method send the document as an email attachment.' -time: 2025-06-26T12:20:30.083601058+02:00 -custom: - Issue: "393" - SchemaChange: No schema change diff --git a/.changes/unreleased/UX-20250423-172624.yaml b/.changes/unreleased/UX-20250423-172624.yaml deleted file mode 100644 index 2a17e4195..000000000 --- a/.changes/unreleased/UX-20250423-172624.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: UX -body: Remove default filter in_progress for the page 'my tasks'; Allows for new tasks to be displayed upon opening of the page -time: 2025-04-23T17:26:24.45777387+02:00 -custom: - Issue: "374" - SchemaChange: No schema change diff --git a/.changes/unreleased/UX-20250617-192650.yaml b/.changes/unreleased/UX-20250617-192650.yaml deleted file mode 100644 index 810758b10..000000000 --- a/.changes/unreleased/UX-20250617-192650.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: UX -body: Improve labeling of fields in person resource creation form -time: 2025-06-17T19:26:50.599703116+02:00 -custom: - Issue: "" - SchemaChange: No schema change diff --git a/.changes/v3.12.0.md b/.changes/v3.12.0.md new file mode 100644 index 000000000..cfed2e013 --- /dev/null +++ b/.changes/v3.12.0.md @@ -0,0 +1,22 @@ +## v3.12.0 - 2025-06-30 +### Feature +* ([#377](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/377)) Add the document file name to the document title when a user upload a document, unless there is already a document title. +* Add desactivation date for social action and issue csv export +* Add Emoji and Fullscreen feature to ckeditor configuration +* ([#321](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/321)) Create editor which allow us to toggle between rich and simple text editor +* Do not remove workflow which are automatically canceled after staling for more than 30 days +### Fixed +* ([#376](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/376)) trying to prevent bug of typeerror in doc-history + improved display of document history +* ([#381](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/381)) Display previous participation in acc course work even if the person has left the acc course +* ([#372](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/372)) Fix display of text in calendar events +* Add missing translation for user_group.no_user_groups +* Fix admin entity edit actions for event admin entities and activity reason (category) entities +* ([#392](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/392)) Allow null and cast as string to setContent method for NewsItem + +* ([#393](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/393)) Doc Generation: the "dump only" method send the document as an email attachment. +### DX +* ([#352](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/352)) Remove dead code for wopi-link module +* Replace library node-sass by sass, and upgrade bootstrap to version 5.3 (yarn upgrade / install is required) +### UX +* ([#374](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/374)) Remove default filter in_progress for the page 'my tasks'; Allows for new tasks to be displayed upon opening of the page +* Improve labeling of fields in person resource creation form diff --git a/CHANGELOG.md b/CHANGELOG.md index b1b9aa894..f28c3cefd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,49 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## v3.12.0 - 2025-06-30 +### Feature +* ([#377](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/377)) Add the document file name to the document title when a user upload a document, unless there is already a document title. +* Add desactivation date for social action and issue csv export +* Add Emoji and Fullscreen feature to ckeditor configuration +* ([#321](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/321)) Create editor which allow us to toggle between rich and simple text editor +* Do not remove workflow which are automatically canceled after staling for more than 30 days +### Fixed +* ([#376](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/376)) trying to prevent bug of typeerror in doc-history + improved display of document history +* ([#381](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/381)) Display previous participation in acc course work even if the person has left the acc course +* ([#372](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/372)) Fix display of text in calendar events +* Add missing translation for user_group.no_user_groups +* Fix admin entity edit actions for event admin entities and activity reason (category) entities +* ([#392](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/392)) Allow null and cast as string to setContent method for NewsItem + +* ([#393](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/393)) Doc Generation: the "dump only" method send the document as an email attachment. +### DX +* ([#352](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/352)) Remove dead code for wopi-link module +* Replace library node-sass by sass, and upgrade bootstrap to version 5.3 (yarn upgrade / install is required) +### UX +* ([#374](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/374)) Remove default filter in_progress for the page 'my tasks'; Allows for new tasks to be displayed upon opening of the page +* Improve labeling of fields in person resource creation form + +## v3.11.0 - 2025-04-17 +### Feature +* ([#365](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/365)) Add counters of actions and activities, with 2 boxes to (1) show the number of active actions on total actions and (2) show the number of activities in a accompanying period, and pills in menus for showing the number of active actions and the number of activities. +* ([#364](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/364)) Added a second phone number "telephone2" to the thirdParty entity. Adapted twig templates and vuejs apps to handle this phone number + + **Schema Change**: Add columns or tables +* Signature: add a button to go directly to the signature zone, even if there is only one +### Fixed +* Fixed wrong translations in the on-the-fly for creation of thirdParty +* Fixed update of phone number in on-the-fly edition of thirdParty +* Fixed closing of modal when editing thirdParty in accompanying course works +* Shorten the delay between two execution of AccompanyingPeriodStepChangeCronjob, to ensure at least one execution in a day +* ([#102](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/102)) Fix display of title in document list +* When cleaning the old stored object versions, do not throw an error if the stored object is not found on disk +* Add consistent log prefix and key to logs when stale workflows are automatically canceled +* ([#380](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/380)) Remove the "not null" validation constraint on recently added properties on HouseholdComposition + +### DX +* Add new chill-col style for displaying title and aside in a flex table + ## v3.10.3 - 2025-03-18 ### DX * Eslint fixes From 2d8cda30b90a88e47be8504b286589ff57369007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 30 Jun 2025 20:32:17 +0200 Subject: [PATCH 11/16] Add `localizeString` method to `PickTemplate` component for string localization --- .../Resources/public/vuejs/_components/PickTemplate.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue b/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue index 6639b0477..1bcc95fd0 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue +++ b/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue @@ -58,6 +58,7 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkList.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkList.vue new file mode 100644 index 000000000..c3615c959 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkList.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkSelectorModal.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkSelectorModal.vue new file mode 100644 index 000000000..ad6c4c82f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkSelectorModal.vue @@ -0,0 +1,101 @@ + + + diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/show.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/show.html.twig index 438a6fb7f..176861d75 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/show.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/show.html.twig @@ -68,6 +68,14 @@ {% endif %}

    + {% if work.accompanyingPeriod.getWorks|length > 1 %} +
  • + + + {{ 'Merge'|trans }} + +
  • + {% endif %} {% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', work) %}
  • + +
    +

    {{ 'acpw_duplicate.to keep'|trans ~ ':' }}

    +
    +
    + {{ details.details(acpw, accompanyingCourse) }} +
    +
    +
    + +

    {{ 'acpw_duplicate.Assign duplicate'|trans }}

    + {{ form_start(form) }} + {%- if form.acpw is defined -%} + {{ form_row(form.acpw) }} +
    + {% endif %} + {{ form_rest(form) }} + +
    + + {{ form_end(form) }} + +
  • +{% endblock %} + +{% block js %} + {{ parent() }} + {{ encore_entry_script_tags('mod_duplicate_selector') }} +{% endblock %} + +{% block css %} + {{ parent() }} + {{ encore_entry_link_tags('mod_duplicate_selector') }} +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriodWorkDuplicate/confirm.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriodWorkDuplicate/confirm.html.twig new file mode 100644 index 000000000..92d65b7c3 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriodWorkDuplicate/confirm.html.twig @@ -0,0 +1,72 @@ +{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %} + +{% import '@ChillPerson/AccompanyingPeriodWorkDuplicate/_details.html.twig' as details %} + +{% block title %}{{ 'acpw_duplicate.title'|trans }}{% endblock %} + +{% block content %} +
    + +

    {{ 'acpw_duplicate.title'|trans }}

    +
    +

    {{ 'acpw_duplicate.description'|trans }}

    +
    + +
    +
    +

    {{ 'acpw_duplicate.to delete'|trans ~ ':' }}

    +
    +
    + {{ details.details(acpw2, accompanyingCourse) }} +
    +
    +
    +
    + +
    +
    +

    {{ 'acpw_duplicate.to keep'|trans ~ ':' }}

    +
    +
    + {{ details.details(acpw, accompanyingCourse) }} +
    +
    +
    +
    + + {{ form_start(form) }} + +
    + +
    +
    + {{ form_widget(form.confirm) }} +
    +
    + {{ form_label(form.confirm) }} +
    +
    +
    + + + + {{ form_end(form) }} + +
    +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriodWork/AccompanyingPeriodWorkMergeService.php b/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriodWork/AccompanyingPeriodWorkMergeService.php new file mode 100644 index 000000000..ba0f93ce3 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriodWork/AccompanyingPeriodWorkMergeService.php @@ -0,0 +1,112 @@ +em->wrapInTransaction(function (EntityManagerInterface $entityManager) use ($toKeep, $toDelete) { + $this->alterStartDate($toKeep, $toDelete); + $this->alterEndDate($toKeep, $toDelete); + $this->concatenateComments($toKeep, $toDelete); + $this->transferWorkflowsSQL($toKeep, $toDelete); + $this->updateReferencesSQL($toKeep, $toDelete); + $entityManager->remove($toDelete); + }); + + return $toKeep; + } + + private function transferWorkflowsSQL(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete): void + { + $this->em->getConnection()->executeQuery( + "UPDATE chill_main_workflow_entity w + SET relatedentityid = :toKeepId + WHERE w.relatedentityid = :toDeleteId + AND w.relatedentityclass = 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork'", + ['toKeepId' => $toKeep->getId(), 'toDeleteId' => $toDelete->getId()] + ); + } + + private function alterStartDate(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete): void + { + $startDate = min($toKeep->getStartDate(), $toDelete->getStartDate()); + $toKeep->setStartDate($startDate); + } + + private function alterEndDate(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete): void + { + if (null === $toKeep->getEndDate() || null === $toDelete->getEndDate()) { + $toKeep->setEndDate(null); + + return; + } + + $endDate = max($toKeep->getEndDate(), $toDelete->getEndDate()); + $toKeep->setEndDate($endDate); + } + + private function concatenateComments(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete): void + { + $toKeep->setNote($toKeep->getNote()."\n\n-----------------\n\n".$toDelete->getNote()); + $toKeep->getPrivateComment()->concatenateComments($toDelete->getPrivateComment()); + } + + private function updateReferencesSQL(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete): void + { + foreach ($toDelete->getAccompanyingPeriodWorkEvaluations() as $evaluation) { + $toKeep->addAccompanyingPeriodWorkEvaluation($evaluation); + } + + foreach ($toDelete->getReferrers() as $referrer) { + // we only keep the current referrer + $toKeep->addReferrer($referrer); + } + + foreach ($toDelete->getPersons() as $person) { + $toKeep->addPerson($person); + } + + if (null === $toKeep->getHandlingThierParty()) { + $toKeep->setHandlingThierParty($toDelete->getHandlingThierParty()); + } + + foreach ($toDelete->getThirdParties() as $thirdParty) { + $toKeep->addThirdParty($thirdParty); + } + + foreach ($toDelete->getGoals() as $goal) { + $toKeep->addGoal($goal); + } + + foreach ($toDelete->getResults() as $result) { + $toKeep->addResult($result); + } + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Service/AccompanyingPeriodWork/AccompanyingPeriodWorkMergeServiceTest.php b/src/Bundle/ChillPersonBundle/Tests/Service/AccompanyingPeriodWork/AccompanyingPeriodWorkMergeServiceTest.php new file mode 100644 index 000000000..e69c8beee --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Service/AccompanyingPeriodWork/AccompanyingPeriodWorkMergeServiceTest.php @@ -0,0 +1,205 @@ +prophesize(EntityManagerInterface::class); + $entityManager->wrapInTransaction(Argument::type('callable'))->will(function ($args) use ($entityManager) { + call_user_func_array($args[0], [$entityManager->reveal()]); + })->shouldBeCalled(); + $entityManager->remove($toRemove)->shouldBeCalled(); + + $connection = $this->prophesize(Connection::class); + $connection->executeQuery(Argument::type('string'), Argument::type('array'))->shouldBeCalled(); + + $entityManager->getConnection()->willReturn($connection->reveal()); + + return new AccompanyingPeriodWorkMergeService($entityManager->reveal()); + } + + /** + * @dataProvider provideStartDateMoveData + */ + public function testStartDateMove(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete, ?\DateTime $expected): void + { + $service = $this->buildMergeService($toDelete); + $return = $service->merge($toKeep, $toDelete); + + self::assertEquals($expected, $return->getStartDate()); + } + + public static function provideStartDateMoveData(): array + { + return [ + 'Earliest date kept when toKeep is earlier' => [ + (new AccompanyingPeriodWork())->setStartDate(new \DateTime('2023-01-01')), + (new AccompanyingPeriodWork())->setStartDate(new \DateTime('2023-06-01')), + new \DateTime('2023-01-01'), + ], + 'Earliest date kept when toDelete is earlier' => [ + (new AccompanyingPeriodWork())->setStartDate(new \DateTime('2023-06-01')), + (new AccompanyingPeriodWork())->setStartDate(new \DateTime('2023-01-01')), + new \DateTime('2023-01-01'), + ], + 'Same start dates remain unchanged' => [ + (new AccompanyingPeriodWork())->setStartDate(new \DateTime('2023-01-01')), + (new AccompanyingPeriodWork())->setStartDate(new \DateTime('2023-01-01')), + new \DateTime('2023-01-01'), + ], + ]; + } + + /** + * @dataProvider provideEndDateMoveData + */ + public function testEndDateMove(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete, ?\DateTimeImmutable $expected): void + { + $service = $this->buildMergeService($toDelete); + $return = $service->merge($toKeep, $toDelete); + + self::assertEquals($expected, $return->getEndDate()); + } + + public static function provideEndDateMoveData(): array + { + return [ + 'Oldest date kept when toKeep is older' => [ + (new AccompanyingPeriodWork())->setEndDate(new \DateTimeImmutable('2022-01-01'))->setStartDate(new \DateTime('2021-01-01')), + (new AccompanyingPeriodWork())->setEndDate(new \DateTimeImmutable('2023-06-01'))->setStartDate(new \DateTime('2021-01-01')), + new \DateTimeImmutable('2023-06-01'), + ], + 'Oldest date kept when toDelete is older' => [ + (new AccompanyingPeriodWork())->setEndDate(new \DateTimeImmutable('2023-06-01'))->setStartDate(new \DateTime('2021-01-01')), + (new AccompanyingPeriodWork())->setEndDate(new \DateTimeImmutable('2022-01-01'))->setStartDate(new \DateTime('2021-01-01')), + new \DateTimeImmutable('2023-06-01'), + ], + 'Same end dates remain unchanged' => [ + (new AccompanyingPeriodWork())->setEndDate(new \DateTimeImmutable('2023-01-01'))->setStartDate(new \DateTime('2021-01-01')), + (new AccompanyingPeriodWork())->setEndDate(new \DateTimeImmutable('2023-01-01'))->setStartDate(new \DateTime('2021-01-01')), + new \DateTimeImmutable('2023-01-01'), + ], + 'End date is null if toKeep is null' => [ + (new AccompanyingPeriodWork())->setEndDate(null)->setStartDate(new \DateTime('2021-01-01')), + (new AccompanyingPeriodWork())->setEndDate(new \DateTimeImmutable('2023-01-01'))->setStartDate(new \DateTime('2021-01-01')), + null, + ], + 'End date is null if toDelete is null' => [ + (new AccompanyingPeriodWork())->setEndDate(new \DateTimeImmutable('2023-01-01'))->setStartDate(new \DateTime('2021-01-01')), + (new AccompanyingPeriodWork())->setEndDate(null)->setStartDate(new \DateTime('2021-01-01')), + null, + ], + 'End date is null if both are null' => [ + (new AccompanyingPeriodWork())->setEndDate(null)->setStartDate(new \DateTime('2021-01-01')), + (new AccompanyingPeriodWork())->setEndDate(null)->setStartDate(new \DateTime('2021-01-01')), + null, + ], + ]; + } + + /** + * @dataProvider provideMoveHandlingThirdPartyData + */ + public function testMoveHandlingThirdParty(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete, ?ThirdParty $expected): void + { + $service = $this->buildMergeService($toDelete); + $return = $service->merge($toKeep, $toDelete); + + self::assertSame($expected, $return->getHandlingThierParty()); + } + + public static function provideMoveHandlingThirdPartyData(): iterable + { + yield 'Third party not change when existing in kept' => [ + (new AccompanyingPeriodWork())->setStartDate(new \DateTimeImmutable('2022-01-01'))->setHandlingThierParty($tpA = new ThirdParty()), + (new AccompanyingPeriodWork())->setStartDate(new \DateTimeImmutable('2022-01-01'))->setHandlingThierParty(new ThirdParty()), + $tpA, + ]; + + yield 'Third party will change when not existing in kept' => [ + (new AccompanyingPeriodWork())->setStartDate(new \DateTimeImmutable('2022-01-01')), + (new AccompanyingPeriodWork())->setStartDate(new \DateTimeImmutable('2022-01-01'))->setHandlingThierParty($tpB = new ThirdParty()), + $tpB, + ]; + + yield 'Third party do not change when not existing in removed' => [ + (new AccompanyingPeriodWork())->setStartDate(new \DateTimeImmutable('2022-01-01'))->setHandlingThierParty($tpC = new ThirdParty()), + (new AccompanyingPeriodWork())->setStartDate(new \DateTimeImmutable('2022-01-01')), + $tpC, + ]; + } + + public function testMerge(): void + { + $accompanyingPeriodWork = new AccompanyingPeriodWork(); + $accompanyingPeriodWork->setStartDate(new \DateTime('2022-01-01')); + $accompanyingPeriodWork->addReferrer($userA = new User()); + $accompanyingPeriodWork->addReferrer($userC = new User()); + $accompanyingPeriodWork->addAccompanyingPeriodWorkEvaluation($evaluationA = new AccompanyingPeriodWorkEvaluation()); + $accompanyingPeriodWork->setNote('blabla'); + $accompanyingPeriodWork->addThirdParty($thirdPartyA = new ThirdParty()); + + $toDelete = new AccompanyingPeriodWork(); + $toDelete->setStartDate(new \DateTime('2022-01-01')); + $toDelete->addReferrer($userB = new User()); + $toDelete->addReferrer($userC); + $toDelete->addAccompanyingPeriodWorkEvaluation($evaluationB = new AccompanyingPeriodWorkEvaluation()); + $toDelete->setNote('boum'); + $toDelete->addThirdParty($thirdPartyB = new ThirdParty()); + $toDelete->addGoal($goalA = new AccompanyingPeriodWorkGoal()); + $toDelete->addResult($resultA = new Result()); + + $service = $this->buildMergeService($toDelete); + $service->merge($accompanyingPeriodWork, $toDelete); + + self::assertTrue($accompanyingPeriodWork->getReferrers()->contains($userA)); + self::assertTrue($accompanyingPeriodWork->getReferrers()->contains($userB)); + self::assertTrue($accompanyingPeriodWork->getReferrers()->contains($userC)); + + self::assertTrue($accompanyingPeriodWork->getAccompanyingPeriodWorkEvaluations()->contains($evaluationA)); + self::assertTrue($accompanyingPeriodWork->getAccompanyingPeriodWorkEvaluations()->contains($evaluationB)); + foreach ($accompanyingPeriodWork->getAccompanyingPeriodWorkEvaluations() as $evaluation) { + self::assertSame($accompanyingPeriodWork, $evaluation->getAccompanyingPeriodWork()); + } + + self::assertStringContainsString('blabla', $accompanyingPeriodWork->getNote()); + self::assertStringContainsString('boum', $toDelete->getNote()); + + self::assertTrue($accompanyingPeriodWork->getThirdParties()->contains($thirdPartyA)); + self::assertTrue($accompanyingPeriodWork->getThirdParties()->contains($thirdPartyB)); + + self::assertTrue($accompanyingPeriodWork->getGoals()->contains($goalA)); + self::assertTrue($accompanyingPeriodWork->getResults()->contains($resultA)); + } +} diff --git a/src/Bundle/ChillPersonBundle/chill.webpack.config.js b/src/Bundle/ChillPersonBundle/chill.webpack.config.js index e4c6ed3af..effbec70f 100644 --- a/src/Bundle/ChillPersonBundle/chill.webpack.config.js +++ b/src/Bundle/ChillPersonBundle/chill.webpack.config.js @@ -6,7 +6,6 @@ module.exports = function (encore, entries) { encore.addAliases({ ChillPersonAssets: __dirname + "/Resources/public", }); - encore.addEntry( "vue_household_members_editor", __dirname + "/Resources/public/vuejs/HouseholdMembersEditor/index.js", @@ -31,7 +30,6 @@ module.exports = function (encore, entries) { "vue_export_action_goal_result", __dirname + "/Resources/public/vuejs/ExportFormActionGoalResult/index.js", ); - encore.addEntry( "mod_set_referrer", __dirname + "/Resources/public/mod/AccompanyingPeriod/setReferrer.js", @@ -66,4 +64,8 @@ module.exports = function (encore, entries) { "page_create_person", __dirname + "/Resources/public/page/person/create-person.js", ); + encore.addEntry( + "mod_duplicate_selector", + __dirname + "/Resources/public/mod/DuplicateSelector/AccompanyingPeriodWorkSelector.ts", + ); }; diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 94e6083ca..17a00d525 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1502,6 +1502,18 @@ entity_display_title: Work (n°%w%): "Action d'accompagnement (n°%w%)" Accompanying Course (n°%w%): "Parcours d'accompagnement (n°%w%)" +acpw_duplicate: + title: Fusionner les actions d'accompagnement + description: Cette fusion conservera la date de début la plus ancienne, la date de fin la plus récente, toutes les évaluations, documents et workflows. Les agents traitants seront additionnés ainsi que les tiers intervenants. Les commentaires seront mis l'un à la suite de l'autre. + Select accompanying period work: Selectionner un action d'accompagnement + Assign duplicate: Désigner un action d'accompagnement doublon + Accompanying period work to delete: Action d'accompagnement à supprimer + Accompanying period work to delete explanation: Cet action d'accompagnement sera supprimé. + Accompanying period work to keep: Action d'accompagnement à conserver + to keep: Action d'accompagnement à conserver + to delete: Action d'accompagnement à supprimer + Successfully merged: Action d'accompagnement fusionnée avec succès. + my_parcours_filters: referrer_parcours_and_acpw: Agent traitant ou réferent referrer_acpw: Agent traitant d'une action diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts b/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts new file mode 100644 index 000000000..20ae3309b --- /dev/null +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/types.ts @@ -0,0 +1,47 @@ +import { + Address, + Center, + Civility, + DateTime, + User, +} from "ChillMainAssets/types"; + +export interface Thirdparty { + acronym: string | null; + active: boolean; + address: Address | null; + canonicalized: string | null; + categories: ThirdpartyCategory[]; + centers: Center[]; + children: Thirdparty[]; + civility: Civility | null; + comment: string | null; + contactDataAnonymous: boolean; + createdAt: DateTime; + createdBy: User | null; + email: string | null; + firstname: string | null; + id: number | null; + kind: string; + name: string; + nameCompany: string | null; + parent: Thirdparty | null; + profession: string; + telephone: string | null; + thirdPartyTypes: ThirdpartyType[] | null; + updatedAt: DateTime | null; + updatedBy: User | null; +} + +interface ThirdpartyType { + key: string; + value: string; +} + +export interface ThirdpartyCategory { + id: number; + active: boolean; + name: { + fr: string; + }; +} diff --git a/symfony.lock b/symfony.lock index ee44b19d8..6409f0c1d 100644 --- a/symfony.lock +++ b/symfony.lock @@ -14,6 +14,15 @@ "config/routes/annotations.yaml" ] }, + "doctrine/deprecations": { + "version": "1.1", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "1.0", + "ref": "87424683adc81d7dc305eefec1fced883084aab9" + } + }, "doctrine/doctrine-bundle": { "version": "2.13", "recipe": { From 6f7015b1520df1060d41881a151f103cd3a1bedc Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 2 Jul 2025 13:56:41 +0200 Subject: [PATCH 16/16] Fix translations of form fields in admin for social actions --- .changes/unreleased/Fixed-20250702-135534.yaml | 6 ++++++ .../Form/SocialWork/SocialActionType.php | 14 +++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 .changes/unreleased/Fixed-20250702-135534.yaml diff --git a/.changes/unreleased/Fixed-20250702-135534.yaml b/.changes/unreleased/Fixed-20250702-135534.yaml new file mode 100644 index 000000000..75a911301 --- /dev/null +++ b/.changes/unreleased/Fixed-20250702-135534.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: 'Fix translations for social action fields in admin form: results, goals, evaluations' +time: 2025-07-02T13:55:34.599050626+02:00 +custom: + Issue: "" + SchemaChange: No schema change diff --git a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php index 0b6cbe73d..31fa6f432 100644 --- a/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php +++ b/src/Bundle/ChillPersonBundle/Form/SocialWork/SocialActionType.php @@ -25,21 +25,14 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Contracts\Translation\TranslatorInterface; /** * Class SocialActionType. */ class SocialActionType extends AbstractType { - /** - * @var TranslatableStringHelper - */ - protected $translatableStringHelper; - - public function __construct(TranslatableStringHelper $translatableStringHelper) - { - $this->translatableStringHelper = $translatableStringHelper; - } + public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly TranslatorInterface $translator) {} public function buildForm(FormBuilderInterface $builder, array $options) { @@ -64,6 +57,7 @@ class SocialActionType extends AbstractType ->add('results', EntityType::class, [ 'class' => Result::class, 'required' => false, + 'label' => $this->translator->trans('person_admin.social_result'), 'multiple' => true, 'attr' => ['class' => 'select2'], 'choice_label' => fn (Result $r) => $this->translatableStringHelper->localize($r->getTitle()), @@ -74,6 +68,7 @@ class SocialActionType extends AbstractType 'required' => false, 'multiple' => true, 'attr' => ['class' => 'select2'], + 'label' => $this->translator->trans('person_admin.social_goal'), 'choice_label' => fn (Goal $g) => $this->translatableStringHelper->localize($g->getTitle()), ]) @@ -82,6 +77,7 @@ class SocialActionType extends AbstractType 'required' => false, 'multiple' => true, 'attr' => ['class' => 'select2'], + 'label' => $this->translator->trans('person_admin.social_evaluation'), 'choice_label' => fn (Evaluation $e) => $this->translatableStringHelper->localize($e->getTitle()), ])