From 47fca9df2a931341ab18e3c90887a9031523a8d9 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Sun, 14 Jul 2013 14:32:02 +0200 Subject: [PATCH] Handle billed fixed-cost tasks correctly in the customer_form view Billed fixed-cost tasks will have no active task once they are billed, because invoicing a fixed-cost will not split off a task but manipulate the active one into being billed. --- stoptime.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/stoptime.rb b/stoptime.rb index a9f1620..490c4ec 100644 --- a/stoptime.rb +++ b/stoptime.rb @@ -817,7 +817,13 @@ module StopTime::Controllers cur_active_task = nil @tasks.each do |task| if task.billed? - @billed_tasks[cur_active_task] << task + if cur_active_task.nil? + # Apparently there is no active task anymore, probably + # it was a fixed-cost task + @billed_tasks[task] = [] + else + @billed_tasks[cur_active_task] << task + end else cur_active_task = task @billed_tasks[task] = []