Added comments to time entries.

This commit is contained in:
Paul van Tilburg 2011-11-03 22:23:50 +01:00
parent 0489d7e3cd
commit 8f2eff9410
2 changed files with 17 additions and 5 deletions

1
TODO
View File

@ -1,7 +1,6 @@
ToDo
====
* commentaar bij entries
* handmatige entries (gekocht item/opdrachtbasis) op factuur
* factureervlag per entry
* factuur vastleggen, met samenvatting commentaar

View File

@ -79,7 +79,6 @@ module StopTime::Models
class TimeEntry < Base
belongs_to :task
end
class StopTimeTables < V 1.0
@ -109,7 +108,17 @@ module StopTime::Models
end
end
end # module StopTime::Models
class CommentSupport < V 1.1
def self.up
add_column(TimeEntry.table_name, :comment, :string)
end
def self.down
remove_column(TimeEntry.table_name, :comment)
end
end
end # StopTime::Models
module StopTime::Controllers
@ -247,7 +256,8 @@ module StopTime::Controllers
@entry = TimeEntry.create(
:task_id => @input.task,
:start => @input.start,
:end => @input.end)
:end => @input.end,
:comment => @input.comment)
@entry.save
if @entry.invalid?
@errors = @entry.errors
@ -335,7 +345,8 @@ module StopTime::Views
th "Project/task"
th "Start time"
th "End time"
th "Total"
th "Comment"
th "Total time"
end
form :action => R(Timereg), :method => :post do
tr do
@ -345,6 +356,7 @@ module StopTime::Views
:value => DateTime.now.to_date.to_formatted_s + " " }
td { input :type => :text, :name => "end",
:value => DateTime.now.to_date.to_formatted_s + " " }
td { input :type => :text, :name => "comment" }
td { "N/A" }
td do
input :type => :submit, :name => "enter", :value => "Enter"
@ -358,6 +370,7 @@ module StopTime::Views
td { entry.task.name }
td { entry.start }
td { entry.end }
td { entry.comment }
td { "%.2fh" % ((entry.end - entry.start)/3600.0) }
td do
form :action => R(TimeregN, entry.id), :method => :post do