Changeset 407

Show
Ignore:
Timestamp:
01/12/07 15:22:41 (2 years ago)
Author:
jarmo
Message:
  • Added support for cmms_work_order_comments. Closes #248.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/models/work_order.rb

    r370 r407  
    3232  exports_automatic_field 'cmms_work_order_working_time', :float, :working_time 
    3333  exports_automatic_field 'cmms_work_order_priority', :integer, :priority 
     34  exports_automatic_field 'cmms_work_order_comments', :string, :comments_as_string 
    3435 
    3536 
     
    306307  end 
    307308 
     309  def comments_as_string 
     310    comments = self.work_order_events.find(:all, :readonly => true).collect { |event| [event.created_at, event.creator, event.comment_text] } 
     311    result = [] 
     312    for creation_date, creator, text in comments 
     313      result.push(format_date(creation_date) + ' - ' + creator.login_and_name + ' - ' + text.gsub("\n", '   ')) 
     314    end 
     315    return result.join('  |  ') 
     316  end 
     317 
    308318protected 
    309319 

© 2004-2007 Norfello Oy All Rights Reserved