Changeset 56c7337


Ignore:
Timestamp:
Jul 7, 2014, 10:07:17 PM (10 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master
Children:
638b547
Parents:
80d8926
git-author:
Alex Dehnert <adehnert@…> (07/07/14 22:07:17)
git-committer:
Alex Dehnert <adehnert@…> (07/07/14 22:07:17)
Message:

Show error when a request can't be approved

This reduces confusion when a request gets approved twice (by different users,
or accidentally opening a tab twice).

Location:
remit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • remit/remit_templates/vouchers/ReimbursementRequest_review.html

    r0445831 r56c7337  
    120120{% endif %}
    121121
     122
     123{% if approve_error %}
     124<div class='messagebox errorbox'>
     125<h3>Approval Error</h3>
     126<p>{{approve_error}}</p>
     127</div>
     128{% endif %}
     129
    122130{% if approve_form %}
    123131<h3>Approve this reimbursement request:</h3>
  • remit/vouchers/views.py

    r2b31097 r56c7337  
    261261    show_approve = (http_request.user.has_perm('vouchers.can_approve')
    262262        and request_obj.approval_status == vouchers.models.APPROVAL_STATE_PENDING)
     263    post_approve = (http_request.method == 'POST' and 'approve' in http_request.REQUEST)
    263264    if show_approve:
    264265        # Voucherize form
     
    272273
    273274        approve_message = ''
    274         if http_request.method == 'POST' and 'approve' in http_request.REQUEST:
     275        if post_approve:
    275276            approve_form = VoucherizeForm(http_request.POST)
    276277            if approve_form.is_valid():
     
    293294        context['approve_form'] = approve_form
    294295        context['approve_message'] = approve_message
     296    elif post_approve:
     297        context['approve_error'] = "You attempted to approve a reimbursement request that you could not approve. Most likely, either the voucher has already been approved, or you do not have adequate permissions."
    295298    if show_email:
    296299        context['email_options'] = email_options
Note: See TracChangeset for help on using the changeset viewer.