2016-10-19 03:11:36 +00:00
|
|
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
2013-06-12 15:59:58 +00:00
|
|
|
|
2012-05-18 13:53:20 +00:00
|
|
|
module ExtraCollection
|
2014-08-02 21:54:54 +00:00
|
|
|
def session( collections, assets, user )
|
2012-05-18 13:53:20 +00:00
|
|
|
|
2012-10-01 18:41:08 +00:00
|
|
|
# all ticket stuff
|
2015-10-15 13:23:41 +00:00
|
|
|
collections[ Macro.to_app_model ] = []
|
2017-10-01 12:25:52 +00:00
|
|
|
Macro.all.each do |item|
|
2015-10-15 13:23:41 +00:00
|
|
|
assets = item.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2014-08-13 00:12:38 +00:00
|
|
|
collections[ Ticket::StateType.to_app_model ] = []
|
2017-10-01 12:25:52 +00:00
|
|
|
Ticket::StateType.all.each do |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2014-08-13 00:12:38 +00:00
|
|
|
collections[ Ticket::State.to_app_model ] = []
|
2017-10-01 12:25:52 +00:00
|
|
|
Ticket::State.all.each do |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2014-08-13 00:12:38 +00:00
|
|
|
collections[ Ticket::Priority.to_app_model ] = []
|
2017-10-01 12:25:52 +00:00
|
|
|
Ticket::Priority.all.each do |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2014-08-13 00:12:38 +00:00
|
|
|
collections[ Ticket::Article::Type.to_app_model ] = []
|
2017-10-01 12:25:52 +00:00
|
|
|
Ticket::Article::Type.all.each do |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2014-08-13 00:12:38 +00:00
|
|
|
collections[ Ticket::Article::Sender.to_app_model ] = []
|
2017-10-01 12:25:52 +00:00
|
|
|
Ticket::Article::Sender.all.each do |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2016-08-12 16:39:09 +00:00
|
|
|
if user.permissions?(['ticket.agent', 'admin.channel_email'])
|
2013-06-12 15:59:58 +00:00
|
|
|
|
2012-11-12 09:34:22 +00:00
|
|
|
# all signatures
|
2014-08-13 00:12:38 +00:00
|
|
|
collections[ Signature.to_app_model ] = []
|
2017-10-01 12:25:52 +00:00
|
|
|
Signature.all.each do |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2013-06-12 15:59:58 +00:00
|
|
|
|
2012-11-12 09:34:22 +00:00
|
|
|
# all email addresses
|
2014-08-13 00:12:38 +00:00
|
|
|
collections[ EmailAddress.to_app_model ] = []
|
2017-10-01 12:25:52 +00:00
|
|
|
EmailAddress.all.each do |item|
|
2014-08-02 21:54:54 +00:00
|
|
|
assets = item.assets(assets)
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2012-11-12 09:34:22 +00:00
|
|
|
end
|
2014-08-26 07:40:25 +00:00
|
|
|
[collections, assets]
|
2012-05-18 13:53:20 +00:00
|
|
|
end
|
2018-10-09 06:17:41 +00:00
|
|
|
module_function :session # rubocop:disable Style/AccessModifierDeclarations
|
2015-04-27 14:15:29 +00:00
|
|
|
end
|