history_log.rb 785 B

123456789101112131415161718192021222324252627282930
  1. # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
  2. module Ticket::Article::HistoryLog
  3. =begin
  4. create log activity for this article
  5. article = Ticket::Article.find(123)
  6. result = article.history_create( 'created', user_id )
  7. returns
  8. result = true # false
  9. =end
  10. def history_log (type, user_id, data = {})
  11. # if Ticketdata[:data[:Article has changed, remember related ticket to be able
  12. # to show article changes in ticket history
  13. data[:o_id] = self['id']
  14. data[:history_type] = type
  15. data[:history_object] = self.class.name
  16. data[:related_o_id] = self['ticket_id']
  17. data[:related_history_object] = 'Ticket'
  18. data[:created_by_id] = user_id
  19. History.add(data)
  20. end
  21. end