From acd2ab46e4c9eed533a45da6abcd3986af36c1ca Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Sun, 9 Feb 2014 14:40:28 +0100 Subject: [PATCH] Reorder the invoices when retrieving the last invoice --- stoptime.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stoptime.rb b/stoptime.rb index 3376e9c..b84d684 100644 --- a/stoptime.rb +++ b/stoptime.rb @@ -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