KatjaGlassConsulting / ApprovalBundle

A Kimai Plugin to manage weekly approval workflow
MIT License
11 stars 14 forks source link

Timesheet rejection Email Says "Approved" if no reason is provided #54

Open duyanhtruong opened 1 month ago

duyanhtruong commented 1 month ago

The email logic in Resources/views/approvedChangeStatus.email.twig has a small issue: If the timesheet is rejected but the approver leaves the reason blank, then an email like this will be sent:

image

The title says "rejected" but the message still says "approved"

Proposed solution: I modified the logic in approvedChangeStatus.email.twig to be:

{% block report %}
    {% if reason is not null %}
        <p>{{ 'email.hello' | trans }} {{ submitter }},</p>
        {% if reason != '' %}
            <p>{{ approver }} {{ 'email.reject.message' | trans }} {{ week }}</p>
            <p>{{ 'email.reason' | trans }} {{ reason }}</p>
        {% else %}
            <p>{{ approver }} {{ 'email.reject.message' | trans }} {{ week }}</p>
        {% endif %}
        <a href="{{ url }}">{{ week }}</a>
    {% else %}
        <p>{{ 'email.hello' | trans }} {{ submitter }},</p>
        <p>{{ approver }} {{ 'email.approved.message' | trans }} {{ week }}</p>
        <a href="{{ url }}">{{ week }}</a>
    {% endif %}
{% endblock %}

The above logic seems to fix this bug

KatjaGlassConsulting commented 3 weeks ago

Thanks for this hint, I will implement this soon.