2016-10-19 03:11:36 +00:00
|
|
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
2014-01-29 23:54:34 +00:00
|
|
|
|
2015-04-27 21:44:41 +00:00
|
|
|
class Organization
|
|
|
|
module SearchIndex
|
2014-01-29 23:54:34 +00:00
|
|
|
|
|
|
|
=begin
|
|
|
|
|
|
|
|
lookup name of ref. objects
|
|
|
|
|
2016-03-08 06:32:58 +00:00
|
|
|
organization = Organization.find(123)
|
2016-07-06 06:13:44 +00:00
|
|
|
attributes = organization.search_index_attribute_lookup
|
2014-01-29 23:54:34 +00:00
|
|
|
|
|
|
|
returns
|
|
|
|
|
|
|
|
attributes # object with lookup data
|
|
|
|
|
|
|
|
=end
|
|
|
|
|
2016-07-06 06:13:44 +00:00
|
|
|
def search_index_attribute_lookup
|
|
|
|
attributes = super
|
2015-04-27 21:44:41 +00:00
|
|
|
|
2016-07-06 06:13:44 +00:00
|
|
|
# add org members for search index data
|
|
|
|
attributes['members'] = []
|
2016-03-08 06:32:58 +00:00
|
|
|
users = User.where(organization_id: id)
|
2017-10-01 12:25:52 +00:00
|
|
|
users.each do |user|
|
2016-07-06 06:13:44 +00:00
|
|
|
attributes['members'].push user.search_index_data
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2015-04-27 21:44:41 +00:00
|
|
|
|
2016-07-06 06:13:44 +00:00
|
|
|
attributes
|
2015-04-27 21:44:41 +00:00
|
|
|
end
|
2014-01-29 23:54:34 +00:00
|
|
|
end
|
2014-02-03 19:23:00 +00:00
|
|
|
end
|