From f85ca3f34fb15fce9838b6f9abe089ccecbfa70d Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Fri, 6 Jan 2012 16:32:19 +0100 Subject: [PATCH] Order the tasks in the customer_form view by name and invoice ID --- stoptime.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stoptime.rb b/stoptime.rb index c24ae46..f91963a 100644 --- a/stoptime.rb +++ b/stoptime.rb @@ -636,6 +636,7 @@ module StopTime::Controllers def get @customer = Customer.new(:hourly_rate => @config['hourly_rate']) @input = @customer.attributes + @tasks = [] @target = [Customers] @button = "create" @@ -655,6 +656,7 @@ module StopTime::Controllers def get(customer_id) @customer = Customer.find(customer_id) @input = @customer.attributes + @tasks = @customer.tasks.all(:order => "name, invoice_id ASC") @invoices = @customer.invoices @invoices.each do |i| @input["paid_#{i.number}"] = true if i.paid? @@ -1521,7 +1523,7 @@ module StopTime::Views form :action => R(CustomersNTasks, @customer.id), :method => :post do h2 "Projects & Tasks" select :name => "task_id", :size => 10 do - @customer.tasks.each do |task| + @tasks.each do |task| if task.billed? option(:value => task.id, :disabled => true) { task.name + " (#{task.invoice.number})" }