Make the VAT rate of a task editable via the form, default to global VAT rate

This is the last commit needed to support VAT rates per tasks (closes: #e7b5a7).
This commit is contained in:
Paul van Tilburg 2012-09-28 16:08:45 +02:00
parent b45bb356ef
commit 8b943d788c
1 changed files with 6 additions and 1 deletions

View File

@ -835,6 +835,7 @@ module StopTime::Controllers
@task.hourly_rate = @input.hourly_rate @task.hourly_rate = @input.hourly_rate
# FIXME: catch invalid task types! # FIXME: catch invalid task types!
end end
@task.vat_rate = @input.vat_rate
@task.save @task.save
if @task.invalid? if @task.invalid?
@errors = @task.errors @errors = @task.errors
@ -867,7 +868,8 @@ module StopTime::Controllers
def get(customer_id) def get(customer_id)
@customer = Customer.find(customer_id) @customer = Customer.find(customer_id)
@customer_list = Customer.all.map { |c| [c.id, c.shortest_name] } @customer_list = Customer.all.map { |c| [c.id, c.shortest_name] }
@task = Task.new(:hourly_rate => @customer.hourly_rate) @task = Task.new(:hourly_rate => @customer.hourly_rate,
:vat_rate => @config["vat_rate"])
@input = @task.attributes @input = @task.attributes
@input["type"] = @task.type # FIXME: find nicer way! @input["type"] = @task.type # FIXME: find nicer way!
@input["customer"] = @customer.id @input["customer"] = @customer.id
@ -1718,6 +1720,9 @@ module StopTime::Views
end end
end end
end end
li do
_form_input_with_label("VAT rate", "vat_rate", :text)
end
if @task.billed? if @task.billed?
li do li do
label "Billed in invoice" label "Billed in invoice"