Added Customer#shortest_name

This commit is contained in:
Paul van Tilburg 2011-12-22 16:32:47 +01:00
parent f59cb4eb3c
commit 48490991cc
1 changed files with 5 additions and 0 deletions

View File

@ -95,6 +95,11 @@ module StopTime::Models
has_many :invoices
has_many :time_entries, :through => :tasks
# Returns the short name if set, otherwise the full name.
def shortest_name
short_name.present? ? short_name : name
end
# Returns a list of tasks that have not been billed via in invoice.
def unbilled_tasks
tasks.all(:conditions => ["invoice_id IS NULL"], :order => "name ASC")