<commit_before>{% macro renderTransitionButton(workflow, transition, workflowItem, transitionData) %}
    {% import 'OroUIBundle::macros.html.twig' as ui %}

    {% if transition.displayType == 'dialog' and (transitionData['dialog-url'] is not defined or not transitionData['dialog-url']) and transition.hasForm() %}
        {% set transitionData = transitionData|merge({
            'dialog-url': path(
                'oro_workflow_widget_transition_form',
                {
                    workflowItemId: workflowItem.id,
                    transitionName: transition.name
                }
            )
        }) %}
    {% endif %}

    {% if transitionData['transition-url'] is not defined or not transitionData['transition-url'] %}
        {% set transitionData = transitionData|merge({'transition-url':
            path(
                'oro_api_workflow_transit',
                {
                    workflowItemId: workflowItem.id,
                    transitionName: transition.name
                }
            )
        }) %}
    {% endif %}

    {% if transitionData['transition-condition-messages'] %}
        {% set conditionMessages = [] %}
        {% for error in transitionData['transition-condition-messages'] %}
            {% set conditionMessages = conditionMessages|merge(['<li>' ~ error.message|trans(error.parameters) ~ '</li>']) %}
        {% endfor %}
        {% if conditionMessages|length %}
            {% set transitionData = transitionData|merge({
                'transition-condition-messages': '<ol>' ~ conditionMessages|join ~ '</ol>'
            }) %}
        {% else %}
            {% set transitionData = transitionData|merge({
                'transition-condition-messages': ''
            }) %}
        {% endif %}
    {% endif %}

    {% set data = transitionData|merge({
        'page-component-module': 'oroworkflow/js/app/components/button-component',
        'page-component-options': {'displayType': transition.displayType}|json_encode,
    }) %}

    {% if transition.frontendOptions is defined and transition.frontendOptions.dialog is defined %}
        {% set data = data|merge({
            'data-dialog-options': transition.frontendOptions.dialog|json_encode|raw
        }) %}
    {% endif %}
<commit_msg>BAP-12481: Update Workflow Twig Templates - fix conditions errors<commit_after>{% macro renderTransitionButton(workflow, transition, workflowItem, transitionData) %}
    {% import 'OroUIBundle::macros.html.twig' as ui %}

    {% if transition.displayType == 'dialog' and (transitionData['dialog-url'] is not defined or not transitionData['dialog-url']) and transition.hasForm() %}
        {% set transitionData = transitionData|merge({
            'dialog-url': path(
                'oro_workflow_widget_transition_form',
                {
                    workflowItemId: workflowItem.id,
                    transitionName: transition.name
                }
            )
        }) %}
    {% endif %}

    {% if transitionData['transition-url'] is not defined or not transitionData['transition-url'] %}
        {% set transitionData = transitionData|merge({'transition-url':
            path(
                'oro_api_workflow_transit',
                {
                    workflowItemId: workflowItem.id,
                    transitionName: transition.name
                }
            )
        }) %}
    {% endif %}

    {% if transitionData['transition-condition-messages'] is defined %}
        {% set conditionMessages = [] %}
        {% for error in transitionData['transition-condition-messages'] %}
            {% set conditionMessages = conditionMessages|merge(['<li>' ~ error.message|trans(error.parameters) ~ '</li>']) %}
        {% endfor %}
        {% if conditionMessages|length %}
            {% set transitionData = transitionData|merge({
                'transition-condition-messages': '<ol>' ~ conditionMessages|join ~ '</ol>'
            }) %}
        {% else %}
            {% set transitionData = transitionData|merge({
                'transition-condition-messages': ''
            }) %}
        {% endif %}
    {% endif %}

    {% set data = transitionData|merge({
        'page-component-module': 'oroworkflow/js/app/components/button-component',
        'page-component-options': {'displayType': transition.displayType}|json_encode,
    }) %}

    {% if transition.frontendOptions is defined and transition.frontendOptions.dialog is defined %}
        {% set data = data|merge({
            'data-dialog-options': transition.frontendOptions.dialog|json_encode|raw
        }) %}
    {% endif %}

{'fraction_non_alphanumeric': 0.13279721799608782, 'fraction_numerical': 0.0010867202782003911, 'mean_word_length': 2.2204338698390482, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6271125', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1116, 'n_words': 217}