diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.html.twig index e9147ed4a..299183cca 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_workflow.html.twig @@ -1,64 +1,72 @@ {% import "@ChillDocStore/Macro/macro.html.twig" as m %} {% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %} -
-
-
-
- -
-
-

{{ document.title }}

+{% if document is null %} +
+ {{ 'workflow.Document deleted'|trans }} +
+{% else %} +
+
+
+
+ +
+
+

{{ document.title }}

- {{ mm.mimeIcon(document.object.type) }} + {{ mm.mimeIcon(document.object.type) }} - {% if document.description is not empty %} -
- {{ document.description }} -
- {% endif %} + {% if document.description is not empty %} +
+ {{ document.description }} +
+ {% endif %} +
-
-{% set freezed = false %} -{% for step in entity_workflow.stepsChained %} - {% if loop.last %} - {% if step.previous is not null and step.previous.freezeAfter == true %} - {% set freezed = true %} - {% endif %} - {% endif %} -{% endfor %} - -{% if display_action is defined and display_action == true %} -
    - {% if document.course != null and is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', document.course) %} -
  • - - {{ 'Course number'|trans }} {{ document.course.id }} - -
  • - {% endif %} -
  • - {{ m.download_button(document.object, document.title) }} -
  • -
  • - {% if chill_document_is_editable(document.object) %} - {% if not freezed %} - {{ document.object|chill_document_edit_button({'title': document.title|e('html') }) }} - {% else %} - - {{ 'Update document'|trans }} - + {% set freezed = false %} + {% for step in entity_workflow.stepsChained %} + {% if loop.last %} + {% if step.previous is not null and step.previous.freezeAfter == true %} + {% set freezed = true %} {% endif %} {% endif %} - {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %} + {% endfor %} + + {% if display_action is defined and display_action == true %} + + {% if chill_document_is_editable(document.object) %} + {% if not freezed %} +
  • + {{ document.object|chill_document_edit_button({'title': document.title|e('html') }) }} +
  • + {% else %} +
  • + + {{ 'Update document'|trans }} + +
  • + {% endif %} + {% endif %} + {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %} +
  • + +
  • + {% endif %} +
+ {% endif %} {% endif %} diff --git a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php index 8e94dbd83..96787a6fc 100644 --- a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php +++ b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php @@ -65,6 +65,10 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler { $doc = $this->getRelatedEntity($entityWorkflow); + if (null === $doc) { + return $this->translator->trans('workflow.Document deleted'); + } + return $this->translator->trans('workflow.Document (n°%doc%)', ['%doc%' => $entityWorkflow->getRelatedEntityId()]) . ' - ' . $doc->getTitle(); } diff --git a/src/Bundle/ChillDocStoreBundle/translations/messages.fr.yml b/src/Bundle/ChillDocStoreBundle/translations/messages.fr.yml index 17326b299..400e37236 100644 --- a/src/Bundle/ChillDocStoreBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillDocStoreBundle/translations/messages.fr.yml @@ -63,3 +63,6 @@ Create new DocumentCategory: Créer une nouvelle catégorie de document # WOPI EDIT online_edit_document: Éditer en ligne + +workflow: + Document deleted: Document supprimé