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) %}