From f0445ea7981c20f6131aad9fbf3097148f7838fc Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 13 Feb 2023 19:30:09 +0100 Subject: [PATCH] FIX [documents][parcours] only show document menu entry when parcours is no longer draft --- src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php | 3 ++- .../Resources/views/AccompanyingCourseDocument/index.html.twig | 2 +- .../Resources/views/PersonDocument/index.html.twig | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php b/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php index 41d31ced3..9aa85bebf 100644 --- a/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php +++ b/src/Bundle/ChillDocStoreBundle/Menu/MenuBuilder.php @@ -14,6 +14,7 @@ namespace Chill\DocStoreBundle\Menu; use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter; use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter; use Chill\MainBundle\Routing\LocalMenuBuilderInterface; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Knp\Menu\MenuItem; use LogicException; use Symfony\Component\Security\Core\Security; @@ -60,7 +61,7 @@ final class MenuBuilder implements LocalMenuBuilderInterface { $course = $parameters['accompanyingCourse']; - if ($this->security->isGranted(AccompanyingCourseDocumentVoter::SEE, $course)) { + if ($this->security->isGranted(AccompanyingCourseDocumentVoter::SEE, $course) && !(AccompanyingPeriod::STEP_DRAFT === $course->getStep())) { $menu->addChild($this->translator->trans('Documents'), [ 'route' => 'accompanying_course_document_index', 'routeParameters' => [ diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/index.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/index.html.twig index 7a013260c..931f52e72 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/index.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/index.html.twig @@ -36,9 +36,9 @@ {{ chill_pagination(pagination) }} + {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE', accompanyingCourse) and not accompanyingCourse.getStep() is same as('DRAFT') %}
- {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE', accompanyingCourse) %}