assets.rb 586 B

123456789101112131415161718192021222324252627282930313233
  1. # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
  2. module History::Assets
  3. =begin
  4. get all assets / related models for this history entry
  5. history = History.find(123)
  6. result = history.assets( assets_if_exists )
  7. returns
  8. result = {
  9. :users => {
  10. 123 => user_model_123,
  11. 1234 => user_model_1234,
  12. }
  13. }
  14. =end
  15. def assets (data)
  16. if !data[ User.to_app_model ] || !data[ User.to_app_model ][ self['created_by_id'] ]
  17. user = User.lookup( :id => self['created_by_id'] )
  18. data = user.assets( data )
  19. end
  20. data
  21. end
  22. end