collection_ticket.rb 1.5 KB

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