collection_ticket.rb 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
  2. module ExtraCollection
  3. def session( collections, assets, user )
  4. # all ticket stuff
  5. collections[ Macro.to_app_model ] = []
  6. Macro.all.each do |item|
  7. assets = item.assets(assets)
  8. end
  9. collections[ Ticket::StateType.to_app_model ] = []
  10. Ticket::StateType.all.each do |item|
  11. assets = item.assets(assets)
  12. end
  13. collections[ Ticket::State.to_app_model ] = []
  14. Ticket::State.all.each do |item|
  15. assets = item.assets(assets)
  16. end
  17. collections[ Ticket::Priority.to_app_model ] = []
  18. Ticket::Priority.all.each do |item|
  19. assets = item.assets(assets)
  20. end
  21. collections[ Ticket::Article::Type.to_app_model ] = []
  22. Ticket::Article::Type.all.each do |item|
  23. assets = item.assets(assets)
  24. end
  25. collections[ Ticket::Article::Sender.to_app_model ] = []
  26. Ticket::Article::Sender.all.each do |item|
  27. assets = item.assets(assets)
  28. end
  29. if user.permissions?(['ticket.agent', 'admin.channel_email'])
  30. # all signatures
  31. collections[ Signature.to_app_model ] = []
  32. Signature.all.each do |item|
  33. assets = item.assets(assets)
  34. end
  35. # all email addresses
  36. collections[ EmailAddress.to_app_model ] = []
  37. EmailAddress.all.each do |item|
  38. assets = item.assets(assets)
  39. end
  40. end
  41. [collections, assets]
  42. end
  43. module_function :session
  44. end