Improved ticket_full to support customer output.
This commit is contained in:
parent
9ec70b1a0e
commit
f75c9f6a76
1 changed files with 19 additions and 10 deletions
|
@ -179,32 +179,41 @@ class TicketOverviewsController < ApplicationController
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# log object as viewed
|
||||||
|
log_view(ticket)
|
||||||
|
|
||||||
# get related articles
|
# get related articles
|
||||||
|
ticket = ticket.attributes
|
||||||
ticket[:article_ids] = []
|
ticket[:article_ids] = []
|
||||||
articles = ticket.articles || []
|
articles = Ticket::Article.where( :ticket_id => params[:id] )
|
||||||
|
|
||||||
# get related users
|
# get related users
|
||||||
|
articles_used = []
|
||||||
articles.each {|article|
|
articles.each {|article|
|
||||||
|
|
||||||
|
# ignore internal article if customer is requesting
|
||||||
|
next if article.internal == true && is_role('Customer')
|
||||||
|
article_tmp = article.attributes
|
||||||
|
|
||||||
# load article ids
|
# load article ids
|
||||||
ticket[:article_ids].push article.id
|
ticket[:article_ids].push article_tmp['id']
|
||||||
|
|
||||||
# add attachment list to article
|
# add attachment list to article
|
||||||
article['attachments'] = Store.list( :object => 'Ticket::Article', :o_id => article.id )
|
article_tmp['attachments'] = Store.list( :object => 'Ticket::Article', :o_id => article.id )
|
||||||
|
|
||||||
|
# remember article
|
||||||
|
articles_used.push article_tmp
|
||||||
|
|
||||||
# load users
|
# load users
|
||||||
if !users[article.created_by_id]
|
if !users[article.created_by_id]
|
||||||
users[article.created_by_id] = User.user_data_full(article.created_by_id)
|
users[article.created_by_id] = User.user_data_full(article.created_by_id)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
# log object as viewed
|
|
||||||
log_view(ticket)
|
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
render :json => {
|
render :json => {
|
||||||
:ticket => ticket,
|
:ticket => ticket,
|
||||||
:articles => articles,
|
:articles => articles_used,
|
||||||
:users => users,
|
:users => users,
|
||||||
:edit_form => {
|
:edit_form => {
|
||||||
:owner_id => {
|
:owner_id => {
|
||||||
|
|
Loading…
Reference in a new issue