Skip to content

Commit

Permalink
check amount when creating an invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Apr 4, 2017
1 parent 2873ed7 commit 09efcda
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions www/%username/invoices/new.spt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ if request.method == 'POST':
if invoice_nature != 'expense':
raise response.error(400, "bad `nature` value (in POST data)")
amount = parse_decimal(body['amount'])
if amount <= 0:
raise response.error(400, "`amount` must be greater than 0")
description = body['description'].strip()
if len(description) < 5:
raise response.error(400, _("The description is too short."))
Expand Down

0 comments on commit 09efcda

Please sign in to comment.