From 952435b36f1c4e9e701aded3b6931ebc0e565475 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 3 Nov 2021 16:57:45 +0100 Subject: [PATCH 01/13] Activity: correct accompanying_period_id param in twig --- .../views/Activity/confirm_deleteAccompanyingCourse.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/confirm_deleteAccompanyingCourse.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/confirm_deleteAccompanyingCourse.html.twig index fbdf45c23..5c37a889c 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/confirm_deleteAccompanyingCourse.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/confirm_deleteAccompanyingCourse.html.twig @@ -10,7 +10,7 @@ 'title' : 'Remove activity'|trans, 'confirm_question' : 'Are you sure you want to remove the activity about "%name%" ?'|trans({ '%name%' : accompanyingCourse.id } ), 'cancel_route' : 'chill_activity_activity_list', - 'cancel_parameters' : { 'accompanying_course_id' : accompanyingCourse.id, 'id' : activity.id }, + 'cancel_parameters' : { 'accompanying_period_id' : accompanyingCourse.id, 'id' : activity.id }, 'form' : delete_form } ) }} {% endblock %} From 0299500cad95cbbdee0515992422a032c00f82c3 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 3 Nov 2021 17:10:06 +0100 Subject: [PATCH 02/13] accompanyingPeriodWork: replace 'spinner' by a real spinner --- .../Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue index fe7838c4d..3be3c57e2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue @@ -26,7 +26,7 @@
-

spinner

+
From e195434bf40d1858534a351c2199044b251c29fa Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 3 Nov 2021 17:36:00 +0100 Subject: [PATCH 03/13] accompanyingPeriodWork: add action in controller --- .../AccompanyingCourseWorkController.php | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index 739b14e2b..2dac6315b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -11,7 +11,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Component\Form\Form; use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; class AccompanyingCourseWorkController extends AbstractController { @@ -106,4 +108,83 @@ class AccompanyingCourseWorkController extends AbstractController 'paginator' => $paginator ]); } + + + /** + * @Route( + * "{_locale}/person/accompanying-period/work/{id}/delete", + * name="chill_person_accompanying_period_work_delete", + * methods={"GET"} + * ) + */ + public function deleteWork(AccompanyingPeriodWork $work): Response + { + // TODO ACL + + $em = $this->getDoctrine()->getManager(); + dump($work); + // [$person, $accompanyingPeriod] = $this->getEntity($request); + + // /* @var $activity Activity */ + // $activity = $em->getRepository('ChillActivityBundle:Activity')->find($id); + + // if (!$activity) { + // throw $this->createNotFoundException('Unable to find Activity entity.'); + // } + + // TODO + // $this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity); + + $form = $this->createDeleteForm($work->getId()); + + // if ($request->getMethod() === Request::METHOD_DELETE) { + // $form->handleRequest($request); + + // if ($form->isValid()) { + + // // $this->logger->notice("An activity has been removed", array( + // // 'by_user' => $this->getUser()->getUsername(), + // // 'activity_id' => $activity->getId(), + // // 'person_id' => $activity->getPerson() ? $activity->getPerson()->getId() : null, + // // 'comment' => $activity->getComment()->getComment(), + // // 'scope_id' => $activity->getScope() ? $activity->getScope()->getId() : null, + // // 'reasons_ids' => $activity->getReasons() + // // ->map(function ($ar) { return $ar->getId(); }) + // // ->toArray(), + // // 'type_id' => $activity->getType()->getId(), + // // 'duration' => $activity->getDurationTime() ? $activity->getDurationTime()->format('U') : null, + // // 'date' => $activity->getDate()->format('Y-m-d'), + // // 'attendee' => $activity->getAttendee() + // // )); //TODO + + // $em->remove($work); + // $em->flush(); + + // // $this->addFlash('success', $this->get('translator') + // // ->trans("The activity has been successfully removed.")); + + // // $params = $this->buildParamsToUrl($person, $accompanyingPeriod); + // // return $this->redirectToRoute('chill_activity_activity_list', $params); + // } + // } + + return $this->render('@ChillPerson/AccompanyingCourseWork/delete.html.twig', array( + 'work' => $work, + 'delete_form' => $form->createView() + )); + } + + private function createDeleteForm(int $id): Form + { + $params['id'] = $id; + + return $this->createFormBuilder() + ->setAction($this->generateUrl('chill_person_accompanying_period_work_delete', $params)) + ->setMethod('DELETE') + ->add('submit', SubmitType::class, array('label' => 'Delete')) + ->getForm() + ; + } + + } From 6afd8ae3cdf43e01e90ea57346ad86541df48eef Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 4 Nov 2021 15:21:12 +0100 Subject: [PATCH 04/13] accompanying period work: add delete twig --- .../AccompanyingCourseWorkController.php | 5 +++-- .../AccompanyingCourseWork/delete.html.twig | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index 2dac6315b..6c5ffc7cb 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -169,8 +169,9 @@ class AccompanyingCourseWorkController extends AbstractController // } return $this->render('@ChillPerson/AccompanyingCourseWork/delete.html.twig', array( - 'work' => $work, - 'delete_form' => $form->createView() + 'accompanyingCourse' => $work->getAccompanyingPeriod(), + 'work' => $work, + 'delete_form' => $form->createView() )); } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig new file mode 100644 index 000000000..e3f2c644e --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig @@ -0,0 +1,16 @@ +{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %} + +{% set activeRouteKey = 'chill_activity_activity_list' %} + +{% block title 'Remove activity'|trans %} + +{% block content %} + {{ include('@ChillMain/Util/confirmation_template.html.twig', + { + 'title' : 'Remove activity'|trans, + 'confirm_question' : 'Are you sure you want to remove the activity about "%name%" ?'|trans({ '%name%' : work.id } ), + 'cancel_route' : 'chill_activity_activity_list', + 'cancel_parameters' : { 'accompanying_period_id' : work.id}, + 'form' : delete_form + } ) }} +{% endblock %} From d94c367e3d428dcf81466ceefaee1f8321dbaded Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 8 Nov 2021 14:47:50 +0100 Subject: [PATCH 05/13] accompanying period work: can delete the work --- .../AccompanyingCourseWorkController.php | 71 ++++++++----------- .../AccompanyingCourseWork/delete.html.twig | 12 ++-- .../list_by_accompanying_period.html.twig | 5 ++ .../translations/messages.fr.yml | 2 + 4 files changed, 42 insertions(+), 48 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index 6c5ffc7cb..ec65d08ab 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -13,6 +13,7 @@ use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Form\Form; use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository; +use Psr\Log\LoggerInterface; use Symfony\Component\Form\Extension\Core\Type\SubmitType; class AccompanyingCourseWorkController extends AbstractController @@ -21,17 +22,20 @@ class AccompanyingCourseWorkController extends AbstractController private SerializerInterface $serializer; private AccompanyingPeriodWorkRepository $workRepository; private PaginatorFactory $paginator; + protected LoggerInterface $logger; public function __construct( TranslatorInterface $trans, SerializerInterface $serializer, AccompanyingPeriodWorkRepository $workRepository, PaginatorFactory $paginator + // LoggerInterface $logger, ) { $this->trans = $trans; $this->serializer = $serializer; $this->workRepository = $workRepository; $this->paginator = $paginator; + // $this->logger = $logger; } /** @@ -114,65 +118,48 @@ class AccompanyingCourseWorkController extends AbstractController * @Route( * "{_locale}/person/accompanying-period/work/{id}/delete", * name="chill_person_accompanying_period_work_delete", - * methods={"GET"} + * methods={"GET", "POST", "DELETE"} * ) */ - public function deleteWork(AccompanyingPeriodWork $work): Response + public function deleteWork(AccompanyingPeriodWork $work, Request $request): Response { // TODO ACL - $em = $this->getDoctrine()->getManager(); dump($work); - // [$person, $accompanyingPeriod] = $this->getEntity($request); - - // /* @var $activity Activity */ - // $activity = $em->getRepository('ChillActivityBundle:Activity')->find($id); - - // if (!$activity) { - // throw $this->createNotFoundException('Unable to find Activity entity.'); - // } - - // TODO - // $this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity); $form = $this->createDeleteForm($work->getId()); - // if ($request->getMethod() === Request::METHOD_DELETE) { - // $form->handleRequest($request); + if ($request->getMethod() === Request::METHOD_DELETE) { + $form->handleRequest($request); - // if ($form->isValid()) { + if ($form->isValid()) { - // // $this->logger->notice("An activity has been removed", array( - // // 'by_user' => $this->getUser()->getUsername(), - // // 'activity_id' => $activity->getId(), - // // 'person_id' => $activity->getPerson() ? $activity->getPerson()->getId() : null, - // // 'comment' => $activity->getComment()->getComment(), - // // 'scope_id' => $activity->getScope() ? $activity->getScope()->getId() : null, - // // 'reasons_ids' => $activity->getReasons() - // // ->map(function ($ar) { return $ar->getId(); }) - // // ->toArray(), - // // 'type_id' => $activity->getType()->getId(), - // // 'duration' => $activity->getDurationTime() ? $activity->getDurationTime()->format('U') : null, - // // 'date' => $activity->getDate()->format('Y-m-d'), - // // 'attendee' => $activity->getAttendee() - // // )); //TODO + // $this->logger->notice("An accompanying period work has been removed", [ + // 'by_user' => $this->getUser()->getUsername(), + // 'work_id' => $work->getId(), + // 'accompanying_period_id' => $work->getAccompanyingPeriod()->getId() + // ]); - // $em->remove($work); - // $em->flush(); + $em->remove($work); + $em->flush(); - // // $this->addFlash('success', $this->get('translator') - // // ->trans("The activity has been successfully removed.")); + $this->addFlash( + 'success', + //$translator->trans("The accompanying period work has been successfully removed.") //TODO translation + "The accompanying period work has been successfully removed." + ); - // // $params = $this->buildParamsToUrl($person, $accompanyingPeriod); - // // return $this->redirectToRoute('chill_activity_activity_list', $params); - // } - // } + return $this->redirectToRoute('chill_person_accompanying_period_work_list', [ + 'id' => $work->getAccompanyingPeriod()->getId() + ]); + } + } - return $this->render('@ChillPerson/AccompanyingCourseWork/delete.html.twig', array( + return $this->render('@ChillPerson/AccompanyingCourseWork/delete.html.twig', [ 'accompanyingCourse' => $work->getAccompanyingPeriod(), 'work' => $work, 'delete_form' => $form->createView() - )); + ]); } private function createDeleteForm(int $id): Form @@ -182,7 +169,7 @@ class AccompanyingCourseWorkController extends AbstractController return $this->createFormBuilder() ->setAction($this->generateUrl('chill_person_accompanying_period_work_delete', $params)) ->setMethod('DELETE') - ->add('submit', SubmitType::class, array('label' => 'Delete')) + ->add('submit', SubmitType::class, ['label' => 'Delete']) ->getForm() ; } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig index e3f2c644e..dba361a24 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig @@ -1,16 +1,16 @@ {% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %} -{% set activeRouteKey = 'chill_activity_activity_list' %} +{% set activeRouteKey = 'chill_person_accompanying_period_work_list' %} -{% block title 'Remove activity'|trans %} +{% block title 'accompanying_course_work.remove'|trans %} {% block content %} {{ include('@ChillMain/Util/confirmation_template.html.twig', { - 'title' : 'Remove activity'|trans, - 'confirm_question' : 'Are you sure you want to remove the activity about "%name%" ?'|trans({ '%name%' : work.id } ), - 'cancel_route' : 'chill_activity_activity_list', - 'cancel_parameters' : { 'accompanying_period_id' : work.id}, + 'title' : 'accompanying_course_work.remove'|trans, + 'confirm_question' : 'Are you sure you want to remove the work of the accompanying period %name% ?'|trans({ '%name%' : accompanyingCourse.id } ), + 'cancel_route' : 'chill_person_accompanying_period_work_list', + 'cancel_parameters' : {'id' : accompanyingCourse.id}, 'form' : delete_form } ) }} {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig index dd8beded5..797f1bcc8 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_by_accompanying_period.html.twig @@ -103,6 +103,11 @@ href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_edit', { 'id': w.id }) }}" >{% if buttonText is not defined or buttonText == true %}{{ 'Edit'|trans }}{% endif %} +
  • + {% if buttonText is not defined or buttonText == true %}{{ 'Delete'|trans }}{% endif %} +
  • diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index af3ca6f05..96cf5a469 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -405,6 +405,7 @@ Back to household: Revenir au ménage # accompanying course work Accompanying Course Actions: Actions d'accompagnements Accompanying Course Action: Action d'accompagnement +Are you sure you want to remove the work of the accompanying period %name% ?: Êtes-vous sûr de vouloir supprimer l'action de la période d'accompagnement %name% ? accompanying_course_work: create: Créer une action Create accompanying course work: Créer une action d'accompagnement @@ -419,6 +420,7 @@ accompanying_course_work: results: Résultats - orientations goal: Objectif - motif - dispositif Any work: Aucune action d'accompagnement + remove: Supprimer une action d'accompagnement # Person addresses: Adresses de résidence From b4d21c23b27c7cfa8578f013899c789b644a3625 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 8 Nov 2021 14:50:15 +0100 Subject: [PATCH 06/13] accompanying period work: add logger interface --- .../AccompanyingCourseWorkController.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index ec65d08ab..0b56d6af2 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -28,14 +28,14 @@ class AccompanyingCourseWorkController extends AbstractController TranslatorInterface $trans, SerializerInterface $serializer, AccompanyingPeriodWorkRepository $workRepository, - PaginatorFactory $paginator - // LoggerInterface $logger, + PaginatorFactory $paginator, + LoggerInterface $logger ) { $this->trans = $trans; $this->serializer = $serializer; $this->workRepository = $workRepository; $this->paginator = $paginator; - // $this->logger = $logger; + $this->logger = $logger; } /** @@ -134,11 +134,11 @@ class AccompanyingCourseWorkController extends AbstractController if ($form->isValid()) { - // $this->logger->notice("An accompanying period work has been removed", [ - // 'by_user' => $this->getUser()->getUsername(), - // 'work_id' => $work->getId(), - // 'accompanying_period_id' => $work->getAccompanyingPeriod()->getId() - // ]); + $this->logger->notice("An accompanying period work has been removed", [ + 'by_user' => $this->getUser()->getUsername(), + 'work_id' => $work->getId(), + 'accompanying_period_id' => $work->getAccompanyingPeriod()->getId() + ]); $em->remove($work); $em->flush(); From 70524c506d5faf2494244dc58cabb0054affa6e3 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 8 Nov 2021 15:17:16 +0100 Subject: [PATCH 07/13] accompanying period work: add content to the delete page --- .../AccompanyingCourseWork/delete.html.twig | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig index dba361a24..2b47adc93 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig @@ -2,9 +2,27 @@ {% set activeRouteKey = 'chill_person_accompanying_period_work_list' %} -{% block title 'accompanying_course_work.remove'|trans %} +{% block title 'accompanying_course_work.remove'|trans %} {% block content %} + +
    +

    + {{ 'accompanying_course_work.action'|trans }} + {{ work.socialAction|chill_entity_render_string }} +

    + +
    +

    {{ "Associated peoples"|trans }}

    +
      + {% for p in work.persons %} + {{ p|chill_entity_render_box }} + {% endfor %} +
    +
    +
    + + {{ include('@ChillMain/Util/confirmation_template.html.twig', { 'title' : 'accompanying_course_work.remove'|trans, From 66c5c4c1d65e5d7fb1ece2c86262ca0a262ddd31 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 8 Nov 2021 15:52:24 +0100 Subject: [PATCH 08/13] accompanying period work: translate flash message --- .../Controller/AccompanyingCourseWorkController.php | 4 +--- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index 0b56d6af2..cf8e5cab0 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -125,7 +125,6 @@ class AccompanyingCourseWorkController extends AbstractController { // TODO ACL $em = $this->getDoctrine()->getManager(); - dump($work); $form = $this->createDeleteForm($work->getId()); @@ -145,8 +144,7 @@ class AccompanyingCourseWorkController extends AbstractController $this->addFlash( 'success', - //$translator->trans("The accompanying period work has been successfully removed.") //TODO translation - "The accompanying period work has been successfully removed." + $this->trans->trans("The accompanying period work has been successfully removed.") ); return $this->redirectToRoute('chill_person_accompanying_period_work_list', [ diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 96cf5a469..0a720af3e 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -406,6 +406,7 @@ Back to household: Revenir au ménage Accompanying Course Actions: Actions d'accompagnements Accompanying Course Action: Action d'accompagnement Are you sure you want to remove the work of the accompanying period %name% ?: Êtes-vous sûr de vouloir supprimer l'action de la période d'accompagnement %name% ? +The accompanying period work has been successfully removed.: L'action d'accompagnement a été supprimée. accompanying_course_work: create: Créer une action Create accompanying course work: Créer une action d'accompagnement From eedf5f25bd9e3ca4f857548d5f0374a1da0edc23 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 12 Nov 2021 12:00:39 +0100 Subject: [PATCH 09/13] accompanying course work: translation --- .../Resources/views/AccompanyingCourseWork/delete.html.twig | 2 +- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig index 2b47adc93..c66e5aa3d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/delete.html.twig @@ -26,7 +26,7 @@ {{ include('@ChillMain/Util/confirmation_template.html.twig', { 'title' : 'accompanying_course_work.remove'|trans, - 'confirm_question' : 'Are you sure you want to remove the work of the accompanying period %name% ?'|trans({ '%name%' : accompanyingCourse.id } ), + 'confirm_question' : 'Are you sure you want to remove this work of the accompanying period %name% ?'|trans({ '%name%' : accompanyingCourse.id } ), 'cancel_route' : 'chill_person_accompanying_period_work_list', 'cancel_parameters' : {'id' : accompanyingCourse.id}, 'form' : delete_form diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 0a720af3e..ef8e58bb1 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -405,7 +405,7 @@ Back to household: Revenir au ménage # accompanying course work Accompanying Course Actions: Actions d'accompagnements Accompanying Course Action: Action d'accompagnement -Are you sure you want to remove the work of the accompanying period %name% ?: Êtes-vous sûr de vouloir supprimer l'action de la période d'accompagnement %name% ? +Are you sure you want to remove this work of the accompanying period %name% ?: Êtes-vous sûr de vouloir supprimer cette action de la période d'accompagnement %name% ? The accompanying period work has been successfully removed.: L'action d'accompagnement a été supprimée. accompanying_course_work: create: Créer une action From 32c2d96ab620c261a5e156eeec8ba142d55cc112 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 12 Nov 2021 12:02:45 +0100 Subject: [PATCH 10/13] accompanying course work: add cascade remove on delete Accompanying Period Work --- .../Entity/AccompanyingPeriod/AccompanyingPeriodWork.php | 2 +- .../AccompanyingPeriodWorkEvaluationDocument.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 39aaf309b..8ae4212cc 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -167,7 +167,7 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\OneToMany( * targetEntity=AccompanyingPeriodWorkEvaluation::class, * mappedBy="accompanyingPeriodWork", - * cascade={"persist"}, + * cascade={"remove"}, * orphanRemoval=true * ) * @Serializer\Groups({"read"}) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php index eb07cd4d8..1dfaef99c 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php @@ -70,7 +70,8 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct /** * @ORM\ManyToOne( - * targetEntity=StoredObject::class + * targetEntity=StoredObject::class, + * cascade={"remove"}, * ) * @Serializer\Groups({"read"}) */ From fcbf1bd5587b49b80cf02687af28bd45d421a49c Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 12 Nov 2021 12:10:27 +0100 Subject: [PATCH 11/13] accompanying course work: missing translation in App.vue --- .../Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue index 3be3c57e2..7931a2a0d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue @@ -72,7 +72,7 @@ {{ $t('action.save') }} From 28afe5228a47c1e1d1852c2fae109ccb641e6712 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 12 Nov 2021 12:14:55 +0100 Subject: [PATCH 12/13] upd CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fad2c948..c899353f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ and this project adheres to +* [person]: delete accompanying period work, including related objects (cascade) (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/36) + + * [person]: Add civility to the person * [person]: Various improvements on the edit person form * [person]: Set available_languages and available_countries as parameters for use in the edit person form From 22bdf35eb0e7b2d902ed31e25ce2b13c814e4b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 12 Nov 2021 12:05:16 +0000 Subject: [PATCH 13/13] minor fixes --- .../Controller/AccompanyingCourseWorkController.php | 2 +- .../Entity/AccompanyingPeriod/AccompanyingPeriodWork.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php index cf8e5cab0..3625c7cca 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php @@ -29,7 +29,7 @@ class AccompanyingCourseWorkController extends AbstractController SerializerInterface $serializer, AccompanyingPeriodWorkRepository $workRepository, PaginatorFactory $paginator, - LoggerInterface $logger + LoggerInterface $chillLogger ) { $this->trans = $trans; $this->serializer = $serializer; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 8ae4212cc..58b27d95d 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -167,7 +167,7 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\OneToMany( * targetEntity=AccompanyingPeriodWorkEvaluation::class, * mappedBy="accompanyingPeriodWork", - * cascade={"remove"}, + * cascade={"remove", "persist"}, * orphanRemoval=true * ) * @Serializer\Groups({"read"})