Added Task#comment_or_name to return the comment if set and the task is billed

This commit is contained in:
Paul van Tilburg 2011-12-02 22:16:27 +01:00
parent c7d32e8611
commit e4202b8048
1 changed files with 10 additions and 0 deletions

View File

@ -184,6 +184,16 @@ module StopTime::Models
end
end
end
# Returns an invoice comment if the task is billed and if it is
# set, otherwise the name.
def comment_or_name
if billed? and self.invoice_comment.present?
self.invoice_comment
else
self.name
end
end
end
# == The time entry class