Add the time specification to the invoice_form view; update it

Generation of a time specification appendix can be enabled for each invoice
indepently on whether it is or is not enabled for the customer.  However,
whether it is enabled by default when an invoice is created, that does
follow the setting for the customer.
This commit is contained in:
Paul van Tilburg 2013-07-13 22:32:45 +02:00
parent 7a58ae9331
commit afd037b95e
1 changed files with 8 additions and 0 deletions

View File

@ -1056,6 +1056,7 @@ module StopTime::Controllers
invoice = Invoice.create(:number => number)
invoice.customer = Customer.find(customer_id)
invoice.company_info = CompanyInfo.last
invoice.include_specification = invoice.customer.time_specification
# Handle the hourly rated tasks first by looking at the selected time
# entries.
@ -1143,6 +1144,7 @@ module StopTime::Controllers
def post(customer_id, invoice_number)
invoice = Invoice.find_by_number(invoice_number)
invoice.paid = @input.has_key? "paid"
invoice.include_specification = @input.has_key? "include_specification"
invoice.save
redirect R(CustomersNInvoicesX, customer_id, invoice_number)
@ -2040,6 +2042,12 @@ module StopTime::Views
_form_input_checkbox("paid")
end
end
div.control_group do
label.control_label "Include specification?"
div.controls do
_form_input_checkbox("include_specification")
end
end
div.form_actions do
button.btn.btn_primary "Update", :type => :submit,
:name => "update", :value => "Update"