collection_ticket.rb 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # Copyright (C) 2012-2023 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. collections[ Ticket::TimeAccounting::Type.to_app_model ] = []
  27. Ticket::TimeAccounting::Type.all.each do |item|
  28. assets = item.assets(assets)
  29. end
  30. if user.permissions?(['ticket.agent', 'admin.channel_email'])
  31. collections[ Macro.to_app_model ] = []
  32. Macro.all.each do |item|
  33. assets = item.assets(assets)
  34. end
  35. collections[ TextModule.to_app_model ] = []
  36. TextModule.all.each do |item|
  37. assets = item.assets(assets)
  38. end
  39. collections[ Signature.to_app_model ] = []
  40. Signature.all.each do |item|
  41. assets = item.assets(assets)
  42. end
  43. collections[ EmailAddress.to_app_model ] = []
  44. EmailAddress.all.each do |item|
  45. assets = item.assets(assets)
  46. end
  47. end
  48. [collections, assets]
  49. end
  50. end