Fixed the 'payed' typo.

This commit is contained in:
Paul van Tilburg 2011-11-28 12:55:13 +01:00
parent b6b81308bb
commit fc377460b4
1 changed files with 28 additions and 8 deletions

View File

@ -224,7 +224,7 @@ module StopTime::Models
# #
# [id] unique identification number (Fixnum) # [id] unique identification number (Fixnum)
# [number] invoice number (Fixnum) # [number] invoice number (Fixnum)
# [payed] flag whether the invoice has been paid (TrueClass/FalseClass) # [paid] flag whether the invoice has been paid (TrueClass/FalseClass)
# [created_at] time of creation (Time) # [created_at] time of creation (Time)
# [updated_at] time of last update (Time) # [updated_at] time of last update (Time)
# #
@ -427,6 +427,26 @@ module StopTime::Models
end end
end end
class PaidFlagTypoFix < V 1.9 # :nodoc:
def self.up
add_column(Invoice.table_name, :paid, :boolean)
Invoice.all.each do |i|
i.paid = i.payed unless i.payed.blank?
i.save
end
remove_column(Invoice.table_name, :payed)
end
def self.down
add_column(Invoice.table_name, :payed, :boolean)
Invoice.all.each do |i|
i.payed = i.paid unless i.paid.blank?
i.save
end
remove_column(Invoice.table_name, :paid)
end
end
end # StopTime::Models end # StopTime::Models
# = The Stop… Camping Time! controllers # = The Stop… Camping Time! controllers
@ -800,7 +820,7 @@ module StopTime::Controllers
# with the given _customer_id_ and redirects to CustomersNInvoicesX. # with the given _customer_id_ and redirects to CustomersNInvoicesX.
def post(customer_id, invoice_number) def post(customer_id, invoice_number)
invoice = Invoice.find_by_number(invoice_number) invoice = Invoice.find_by_number(invoice_number)
invoice.payed = @input.has_key? "payed" invoice.paid = @input.has_key? "paid"
invoice.save invoice.save
redirect R(CustomersNInvoicesX, customer_id, invoice_number) redirect R(CustomersNInvoicesX, customer_id, invoice_number)
@ -1377,7 +1397,7 @@ module StopTime::Views
th "Number" th "Number"
th "Date" th "Date"
th "Period" th "Period"
th "Payed" th "Paid?"
end end
invoices.each do |invoice| invoices.each do |invoice|
tr do tr do
@ -1388,8 +1408,8 @@ module StopTime::Views
end end
td { invoice.created_at.to_formatted_s(:date_only) } td { invoice.created_at.to_formatted_s(:date_only) }
td { _format_period(invoice.period) } td { _format_period(invoice.period) }
# FIXME: really retrieve the payed flag. # FIXME: really retrieve the paid flag.
td { _form_input_checkbox("payed_#{invoice.number}") } td { _form_input_checkbox("paid_#{invoice.number}") }
end end
end end
end end
@ -1451,7 +1471,7 @@ module StopTime::Views
end end
# A view displaying the information (billed tasks and time) of an # A view displaying the information (billed tasks and time) of an
# invoice (Models::Invoice) that also allows for updating the "+payed+" # invoice (Models::Invoice) that also allows for updating the "+paid+"
# property. # property.
def invoice def invoice
h2 do h2 do
@ -1475,9 +1495,9 @@ module StopTime::Views
td.val { _format_period(@invoice.period) } td.val { _format_period(@invoice.period) }
end end
tr do tr do
td.key { b "Payed" } td.key { b "Paid?" }
td.val do td.val do
_form_input_checkbox("payed") _form_input_checkbox("paid")
input :type => :submit, :name => "update", :value => "Update" input :type => :submit, :name => "update", :value => "Update"
input :type => :reset, :name => "reset", :value => "Reset" input :type => :reset, :name => "reset", :value => "Reset"
end end