From 5b4f47bfaa06d3be9050ddd0222ceb0423feecb0 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 17 Dec 2024 16:04:05 +0100 Subject: [PATCH] Add translation, make reason required, and change template for form --- .../Controller/CalendarController.php | 10 ++++++++-- .../ChillCalendarBundle/translations/messages.fr.yml | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php index bffe42a2f..80fdf9bd7 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php @@ -163,6 +163,11 @@ class CalendarController extends AbstractController public function cancelAction(Calendar $calendar, Request $request): Response { + // Add voter + // Deal with sms being sent or not + // Communicate cancellation with the remote calendar. + + $this->denyAccessUnlessGranted(CalendarVoter::EDIT, $calendar); [$person, $accompanyingPeriod] = [$calendar->getPerson(), $calendar->getAccompanyingPeriod()]; @@ -183,10 +188,11 @@ class CalendarController extends AbstractController $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $this->em->persist($calendar); + + $calendar->setStatus($calendar::STATUS_CANCELED); $this->em->flush(); - $this->addFlash('success', $this->translator->trans('calender.calendar item has been canceled!')); + $this->addFlash('success', $this->translator->trans('chill_calendar.calendar_canceled')); return new RedirectResponse($redirectRoute); } diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index 2dc48c099..a0e70f6c8 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -49,6 +49,7 @@ chill_calendar: cancel_calendar_item: Annuler rendez-vous calendar_canceled: Le rendez-vous a été annulé cancel_calendar_item: Annuler rendez-vous + calendar_canceled: Le rendez-vous a été annulé Document: Document d'un rendez-vous form: The main user is mandatory. He will organize the appointment.: L'utilisateur principal est obligatoire. Il est l'organisateur de l'événement.