From 18af2ca70b3ef76b7047e9275c296b1e25c05230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 11 Sep 2024 21:52:34 +0200 Subject: [PATCH] Handle null transitionBy and improve display logic Added checks for null transitionBy cases in workflow templates to display "Automated transition" when applicable. Also improved conditional rendering for 'destUser' and 'ccUser' fields to avoid empty elements. --- .../views/Workflow/_history.html.twig | 8 +++-- .../views/Workflow/macro_breadcrumb.html.twig | 30 +++++++++++-------- .../translations/messages.fr.yml | 1 + 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_history.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_history.html.twig index a56656102..670d27ecc 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_history.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_history.html.twig @@ -40,11 +40,13 @@ {% set forward = workflow_metadata(step.entityWorkflow, 'isForward', transition) %}
- {% if step.transitionBy is not null %}
- {{ step.transitionBy|chill_entity_render_box({'at_date': step.transitionAt}) }} + {%- if step.transitionBy is not null -%} + {{ step.transitionBy|chill_entity_render_box({'at_date': step.transitionAt}) }} + {% else %} + {{ 'workflow.Automated transition'|trans }} + {%- endif -%}
- {% endif %}
{{ step.transitionAt|format_datetime('long', 'medium') }}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig index 71d1efcf1..e3087769f 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig @@ -3,24 +3,28 @@ {% if step.previous is not null %}
  • {{ 'By'|trans ~ ' : ' }} - {{ step.previous.transitionBy|chill_entity_render_box({'at_date': step.previous.transitionAt }) }} + {% if step.previous.transitionBy is not null %}{{ step.previous.transitionBy|chill_entity_render_box({'at_date': step.previous.transitionAt }) }}{% else %}{{ 'workflow.Automated transition'|trans }}{% endif %}
  • {{ 'Le'|trans ~ ' : ' }} {{ step.previous.transitionAt|format_datetime('short', 'short') }}
  • -
  • - {{ 'workflow.For'|trans ~ ' : ' }} - - {% for d in step.destUser %}{{ d|chill_entity_render_string({'at_date': step.previous.transitionAt}) }}{% if not loop.last %}, {% endif %}{% endfor %} - -
  • -
  • - {{ 'workflow.Cc'|trans ~ ' : ' }} - - {% for u in step.ccUser %}{{ u|chill_entity_render_string({'at_date': step.previous.transitionAt }) }}{% if not loop.last %}, {% endif %}{% endfor %} - -
  • + {% if step.destUser|length > 0 %} +
  • + {{ 'workflow.For'|trans ~ ' : ' }} + + {% for d in step.destUser %}{{ d|chill_entity_render_string({'at_date': step.previous.transitionAt}) }}{% if not loop.last %}, {% endif %}{% endfor %} + +
  • + {% endif %} + {% if step.ccUser|length > 0 %} +
  • + {{ 'workflow.Cc'|trans ~ ' : ' }} + + {% for u in step.ccUser %}{{ u|chill_entity_render_string({'at_date': step.previous.transitionAt }) }}{% if not loop.last %}, {% endif %}{% endfor %} + +
  • + {% endif %} {% else %}
  • {{ 'workflow.Created by'|trans ~ ' : ' }} diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index f5c2cfc46..0c0fce51c 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -530,6 +530,7 @@ workflow: Put on hold: Mettre en attente Remove hold: Enlever la mise en attente On hold: En attente + Automated transition: Transition automatique signature_zone: title: Appliquer les signatures électroniques