Fixed: show list of workflow, event if some accompanying course document associated to a workflow are deleted

This commit is contained in:
Julien Fastré 2022-12-14 13:52:37 +01:00
parent 58ede06dfe
commit ba261ddeb9
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
3 changed files with 64 additions and 49 deletions

View File

@ -1,6 +1,11 @@
{% import "@ChillDocStore/Macro/macro.html.twig" as m %} {% import "@ChillDocStore/Macro/macro.html.twig" as m %}
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %} {% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
{% if document is null %}
<div class="alert alert-warning">
{{ 'workflow.Document deleted'|trans }}
</div>
{% else %}
<div class="flex-table accompanying_course_work-list"> <div class="flex-table accompanying_course_work-list">
<div class="item-bloc document-item bg-chill-llight-gray"> <div class="item-bloc document-item bg-chill-llight-gray">
<div class="row justify-content-center my-4"> <div class="row justify-content-center my-4">
@ -44,14 +49,17 @@
<li> <li>
{{ m.download_button(document.object, document.title) }} {{ m.download_button(document.object, document.title) }}
</li> </li>
<li>
{% if chill_document_is_editable(document.object) %} {% if chill_document_is_editable(document.object) %}
{% if not freezed %} {% if not freezed %}
<li>
{{ document.object|chill_document_edit_button({'title': document.title|e('html') }) }} {{ document.object|chill_document_edit_button({'title': document.title|e('html') }) }}
</li>
{% else %} {% else %}
<li>
<a class="btn btn-wopilink disabled" href="#" title="{{ 'workflow.freezed document'|trans }}"> <a class="btn btn-wopilink disabled" href="#" title="{{ 'workflow.freezed document'|trans }}">
{{ 'Update document'|trans }} {{ 'Update document'|trans }}
</a> </a>
</li>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %} {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE', document) and document.course != null %}
@ -59,6 +67,6 @@
<a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': document.course.id, 'id': document.id}) }}" class="btn btn-show"></a> <a href="{{ chill_path_add_return_path('accompanying_course_document_show', {'course': document.course.id, 'id': document.id}) }}" class="btn btn-show"></a>
</li> </li>
{% endif %} {% endif %}
</li>
</ul> </ul>
{% endif %} {% endif %}
{% endif %}

View File

@ -65,6 +65,10 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler
{ {
$doc = $this->getRelatedEntity($entityWorkflow); $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()]) return $this->translator->trans('workflow.Document (n°%doc%)', ['%doc%' => $entityWorkflow->getRelatedEntityId()])
. ' - ' . $doc->getTitle(); . ' - ' . $doc->getTitle();
} }

View File

@ -63,3 +63,6 @@ Create new DocumentCategory: Créer une nouvelle catégorie de document
# WOPI EDIT # WOPI EDIT
online_edit_document: Éditer en ligne online_edit_document: Éditer en ligne
workflow:
Document deleted: Document supprimé