- Timestamp:
- Jul 7, 2014, 10:31:19 PM (11 years ago)
- Branches:
- master
- Children:
- 922e0e5
- Parents:
- 56c7337
- git-author:
- Alex Dehnert <adehnert@…> (07/07/14 22:31:19)
- git-committer:
- Alex Dehnert <adehnert@…> (07/07/14 22:31:19)
- Location:
- remit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
remit/remit_templates/vouchers/ReimbursementRequest_review.html
r56c7337 r638b547 121 121 122 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 130 {% if approve_form %} 131 <h3>Approve this reimbursement request:</h3> 132 {% if approve_message %} 133 <p>{{ approve_message }}</p> 134 {% else %} 135 {% if perms.vouchers.change_reimbursementrequest %} 136 <p>Optionally, <a href='{% url "admin:vouchers_reimbursementrequest_change" rr.pk %}'>change this request first</a>.</p> 137 {% endif %} 138 <form method="post" action=""> 139 <table class='pretty-table'> 140 {{ approve_form.as_table }} 141 142 <tr> 143 <th colspan='2'><input type="submit" name="approve" value="Approve" /></td> 144 </tr> 145 </table> 146 {% csrf_token %} 147 </form> 148 {% endif %} 123 {% if show_approve or approve_message %} 124 <h3>Approve this reimbursement request:</h3> 125 {% if approve_message %} 126 <div class='messagebox {{approve_level}}box'> 127 <p>{{approve_message}}</p> 128 </div> 129 {% else %} 130 {% if perms.vouchers.change_reimbursementrequest %} 131 <p>Optionally, <a href='{% url "admin:vouchers_reimbursementrequest_change" rr.pk %}'>change this request first</a>.</p> 132 {% endif %} 133 <form method="post" action="."> 134 <th colspan='2'><input type="submit" name="approve" value="Approve as RFP" /></td> 135 {% csrf_token %} 136 </form> 137 {% endif %} 149 138 {% endif %} 150 139 -
remit/vouchers/views.py
r56c7337 r638b547 262 262 and request_obj.approval_status == vouchers.models.APPROVAL_STATE_PENDING) 263 263 post_approve = (http_request.method == 'POST' and 'approve' in http_request.REQUEST) 264 approve_message = '' 265 approve_level = '' 264 266 if show_approve: 265 # Voucherize form 266 # Prefill from certs / config 267 initial = {} 268 initial['name'] = '%s %s' % (http_request.user.first_name, http_request.user.last_name, ) 269 if settings.SIGNATORY_EMAIL: 270 initial['email'] = settings.SIGNATORY_EMAIL 271 else: 272 initial['email'] = http_request.user.email 273 274 approve_message = '' 275 if post_approve: 276 approve_form = VoucherizeForm(http_request.POST) 277 if approve_form.is_valid(): 278 request_obj.approve( 279 approver=http_request.user, 280 signatory_name=approve_form.cleaned_data['name'], 281 signatory_email=approve_form.cleaned_data['email'], 282 ) 283 approve_message = 'Created new voucher from request' 284 else: 285 approve_form = VoucherizeForm(initial=initial) 267 if not request_obj.documentation: 268 approve_message = "Documentation must be uploaded (above) before approving RFPs." 269 approve_level = 'warn' 270 elif post_approve: 271 request_obj.approve_as_rfp(approver=http_request.user) 272 approve_message = 'Queued RFP from request.' 273 approve_level = 'info' 274 elif post_approve: 275 approve_message = "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." 276 approve_level = 'error' 286 277 287 278 context = { … … 290 281 'new': new, 291 282 'doc_form': doc_upload_form, 283 'show_approve': show_approve, 284 'approve_message': approve_message, 285 'approve_level': approve_level, 292 286 } 293 if show_approve:294 context['approve_form'] = approve_form295 context['approve_message'] = approve_message296 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."298 287 if show_email: 299 288 context['email_options'] = email_options
Note: See TracChangeset
for help on using the changeset viewer.