mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
accompanying course: re-open: translations + fine-tuning
This commit is contained in:
@@ -282,51 +282,26 @@ class AccompanyingCourseController extends Controller
|
||||
*/
|
||||
public function reOpenAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response
|
||||
{
|
||||
//$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $accompanyingCourse);
|
||||
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $accompanyingCourse);
|
||||
|
||||
// $form = $this->createForm(AccompanyingCourseType::class, $accompanyingCourse, [
|
||||
// 'validation_groups' => [AccompanyingPeriod::STEP_CLOSED],
|
||||
// ]);
|
||||
if (null === $accompanyingCourse) {
|
||||
throw $this->createNotFoundException('period not found');
|
||||
}
|
||||
|
||||
$form = $this->createFormBuilder([])->getForm();
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
|
||||
$accompanyingCourse->reOpen();
|
||||
$em->flush();
|
||||
$this->getDoctrine()->getManager()->flush();
|
||||
|
||||
return $this->redirectToRoute('chill_person_accompanying_course_index', [
|
||||
'accompanying_period_id' => $accompanyingCourse->getId(),
|
||||
]);
|
||||
|
||||
//TODO: delete motif de cloture and date de cloture (NULL)
|
||||
//TODO: which redirection?
|
||||
//TODO workflow stuff?
|
||||
//TODO: error handling
|
||||
// $workflow = $this->registry->get($accompanyingCourse);
|
||||
|
||||
// if ($workflow->can($accompanyingCourse, 'close')) {
|
||||
// $workflow->apply($accompanyingCourse, 'close');
|
||||
|
||||
// $em->flush();
|
||||
|
||||
// return $this->redirectToRoute('chill_person_accompanying_course_index', [
|
||||
// 'accompanying_period_id' => $accompanyingCourse->getId(),
|
||||
// ]);
|
||||
// }
|
||||
// /** @var ConstraintViolationListInterface $errors */
|
||||
// $errors = $this->validator->validate($accompanyingCourse, null, [$accompanyingCourse::STEP_CLOSED]);
|
||||
// $this->addFlash('error', $this->translator->trans('It is not possible to close this course'));
|
||||
|
||||
// foreach ($errors as $e) {
|
||||
// /** @var ConstraintViolationInterface $e */
|
||||
// $this->addFlash('error', $e->getMessage());
|
||||
// }
|
||||
}
|
||||
|
||||
return $this->render('@ChillPerson/AccompanyingCourse/reopen.html.twig', [
|
||||
return $this->render('@ChillPerson/AccompanyingCourse/re_open.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
'accompanyingCourse' => $accompanyingCourse,
|
||||
]);
|
||||
|
Reference in New Issue
Block a user