Fixed ticket update and bulk action.
This commit is contained in:
parent
419c65f9f8
commit
d36732dcf0
1 changed files with 26 additions and 9 deletions
|
@ -317,19 +317,29 @@ class Ticket < ApplicationModel
|
||||||
def self.create_attributes (data)
|
def self.create_attributes (data)
|
||||||
|
|
||||||
# get groups
|
# get groups
|
||||||
ticket_group_ids = []
|
group_ids = []
|
||||||
Group.where( :active => true ).each { |group|
|
Group.where( :active => true ).each { |group|
|
||||||
ticket_group_ids.push group.id
|
group_ids.push group.id
|
||||||
}
|
}
|
||||||
|
|
||||||
# get related users
|
# get related users
|
||||||
users = {}
|
# users = {}
|
||||||
ticket_owner_ids = []
|
user_ids = []
|
||||||
|
agents = {}
|
||||||
Ticket.agents.each { |user|
|
Ticket.agents.each { |user|
|
||||||
ticket_owner_ids.push user.id
|
agents[ user.id ] = 1
|
||||||
if !users[user.id]
|
user_ids.push user.id
|
||||||
users[user.id] = User.user_data_full(user.id)
|
}
|
||||||
end
|
groups_users = {}
|
||||||
|
group_ids.each {|group_id|
|
||||||
|
groups_users[ group_id ] = []
|
||||||
|
Group.find(group_id).users.each {|user|
|
||||||
|
next if !agents[ user.id ]
|
||||||
|
groups_users[ group_id ].push user.id
|
||||||
|
# if !users[user.id]
|
||||||
|
# users[user.id] = User.user_data_full(user.id)
|
||||||
|
# end
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# get states
|
# get states
|
||||||
|
@ -344,7 +354,14 @@ class Ticket < ApplicationModel
|
||||||
ticket_priority_ids.push priority.id
|
ticket_priority_ids.push priority.id
|
||||||
}
|
}
|
||||||
|
|
||||||
return users, ticket_owner_ids, ticket_group_ids, ticket_state_ids, ticket_priority_ids
|
return {
|
||||||
|
# :users => users,
|
||||||
|
:owner_id => user_ids,
|
||||||
|
:group_id__owner_id => groups_users,
|
||||||
|
:group_id => group_ids,
|
||||||
|
:ticket_state_id => ticket_state_ids,
|
||||||
|
:ticket_priority_id => ticket_priority_ids,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in a new issue