able to see the workflow if the evaluation document has been deleted

This commit is contained in:
Julien Fastré 2022-04-07 15:54:53 +02:00
parent d9bb18e042
commit a1baf99294
4 changed files with 145 additions and 122 deletions

View File

@ -59,7 +59,13 @@ class EntityWorkflowVoter extends Voter
return true;
}
return $this->security->isGranted($entityAttribute, $handler->getRelatedEntity($subject));
$relatedEntity = $handler->getRelatedEntity($subject);
if (null === $relatedEntity) {
return true;
}
return $this->security->isGranted($entityAttribute, $relatedEntity);
case self::DELETE:
return $subject->getStep() === 'initial';

View File

@ -1,5 +1,10 @@
{%- import "@ChillDocStore/Macro/macro.html.twig" as m -%}
{% if doc is null %}
<div class="alert alert-warning">
{{ 'workflow.doc for evaluation deleted'|trans }}
</div>
{% else %}
<div class="flex-table accompanying_course_work-list">
<div class="item-bloc evaluation-item bg-chill-llight-gray">
<div class="item-row mb-2">
@ -131,3 +136,4 @@
</ul>
{% endif %}
{% endif %}
{% endif %}

View File

@ -48,6 +48,12 @@ class AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler implements EntityW
{
$doc = $this->getRelatedEntity($entityWorkflow);
if (null === $doc) {
return [
'persons' => [],
];
}
return [
'persons' => $doc->getAccompanyingPeriodWorkEvaluation()
->getAccompanyingPeriodWork()->getPersons(),
@ -58,6 +64,10 @@ class AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler implements EntityW
{
$doc = $this->getRelatedEntity($entityWorkflow);
if (null === $doc) {
return $this->translator->trans('workflow.doc for evaluation deleted');
}
return $this->translator->trans(
'workflow.Doc for evaluation (n°%eval%)',
['%eval%' => $entityWorkflow->getRelatedEntityId()]
@ -98,7 +108,7 @@ class AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler implements EntityW
return [
'entity_workflow' => $entityWorkflow,
'evaluation' => $doc->getAccompanyingPeriodWorkEvaluation(),
'evaluation' => null !== $doc ? $doc->getAccompanyingPeriodWorkEvaluation() : $doc,
'doc' => $doc,
];
}

View File

@ -581,6 +581,7 @@ My accompanying periods in draft: Mes parcours brouillons
workflow:
Doc for evaluation (n°%eval%): Document de l'évaluation n°%eval%
doc for evaluation deleted: Document supprimé dans une évaluation
period_by_user_list:
Period by user: Parcours d'accompagnement par utilisateur