Reorder the invoices when retrieving the last invoice

This commit is contained in:
Paul van Tilburg 2014-02-09 14:40:28 +01:00
parent fd6b853154
commit acd2ab46e4
1 changed files with 1 additions and 1 deletions

View File

@ -1052,7 +1052,7 @@ module StopTime::Controllers
return redirect R(CustomersN, customer_id) if @input.cancel
# Create the invoice.
last = Invoice.last
last = Invoice.reorder('number ASC').last
number = if last
last_year = last.number.to_s[0..3].to_i
if Time.now.year > last_year