Added oder of article, sometimes on postgresql it's different.
This commit is contained in:
parent
07148ea064
commit
10e0592140
2 changed files with 22 additions and 33 deletions
|
@ -44,7 +44,7 @@ class TicketsController < ApplicationController
|
||||||
|
|
||||||
# create article if given
|
# create article if given
|
||||||
if params[:article]
|
if params[:article]
|
||||||
article_create( ticket, params[:article] )
|
article_create(ticket, params[:article])
|
||||||
end
|
end
|
||||||
|
|
||||||
render json: ticket, status: :created
|
render json: ticket, status: :created
|
||||||
|
@ -57,10 +57,10 @@ class TicketsController < ApplicationController
|
||||||
# permission check
|
# permission check
|
||||||
return if !ticket_permission(ticket)
|
return if !ticket_permission(ticket)
|
||||||
|
|
||||||
if ticket.update_attributes( Ticket.param_validation( params[:ticket] ) )
|
if ticket.update_attributes(Ticket.param_validation(params[:ticket]))
|
||||||
|
|
||||||
if params[:article]
|
if params[:article]
|
||||||
article_create( ticket, params[:article] )
|
article_create(ticket, params[:article])
|
||||||
end
|
end
|
||||||
|
|
||||||
render json: ticket, status: :ok
|
render json: ticket, status: :ok
|
||||||
|
@ -71,7 +71,7 @@ class TicketsController < ApplicationController
|
||||||
|
|
||||||
# DELETE /api/v1/tickets/1
|
# DELETE /api/v1/tickets/1
|
||||||
def destroy
|
def destroy
|
||||||
ticket = Ticket.find( params[:id] )
|
ticket = Ticket.find(params[:id])
|
||||||
|
|
||||||
# permission check
|
# permission check
|
||||||
return if !ticket_permission(ticket)
|
return if !ticket_permission(ticket)
|
||||||
|
@ -97,10 +97,10 @@ class TicketsController < ApplicationController
|
||||||
def ticket_history
|
def ticket_history
|
||||||
|
|
||||||
# get ticket data
|
# get ticket data
|
||||||
ticket = Ticket.find( params[:id] )
|
ticket = Ticket.find(params[:id])
|
||||||
|
|
||||||
# permission check
|
# permission check
|
||||||
return if !ticket_permission( ticket )
|
return if !ticket_permission(ticket)
|
||||||
|
|
||||||
# get history of ticket
|
# get history of ticket
|
||||||
history = ticket.history_get(true)
|
history = ticket.history_get(true)
|
||||||
|
@ -112,15 +112,14 @@ class TicketsController < ApplicationController
|
||||||
# GET /api/v1/ticket_related/1
|
# GET /api/v1/ticket_related/1
|
||||||
def ticket_related
|
def ticket_related
|
||||||
|
|
||||||
ticket = Ticket.find( params[:ticket_id] )
|
ticket = Ticket.find(params[:ticket_id])
|
||||||
assets = ticket.assets({})
|
assets = ticket.assets({})
|
||||||
|
|
||||||
# open tickets by customer
|
# open tickets by customer
|
||||||
group_ids = Group.select( 'groups.id' )
|
group_ids = Group.select('groups.id')
|
||||||
.joins(:users)
|
.joins(:users)
|
||||||
.where( 'groups_users.user_id = ?', current_user.id )
|
.where('groups_users.user_id = ?', current_user.id)
|
||||||
.where( 'groups.active = ?', true )
|
.map(&:id)
|
||||||
.map( &:id )
|
|
||||||
|
|
||||||
access_condition = [ 'group_id IN (?)', group_ids ]
|
access_condition = [ 'group_id IN (?)', group_ids ]
|
||||||
|
|
||||||
|
@ -142,11 +141,11 @@ class TicketsController < ApplicationController
|
||||||
}
|
}
|
||||||
|
|
||||||
ticket_ids_recent_viewed = []
|
ticket_ids_recent_viewed = []
|
||||||
recent_views = RecentView.list( current_user, 8, 'Ticket' )
|
recent_views = RecentView.list(current_user, 8, 'Ticket')
|
||||||
recent_views.each {|recent_view|
|
recent_views.each {|recent_view|
|
||||||
next if recent_view['object'] != 'Ticket'
|
next if recent_view['object'] != 'Ticket'
|
||||||
ticket_ids_recent_viewed.push recent_view['o_id']
|
ticket_ids_recent_viewed.push recent_view['o_id']
|
||||||
recent_view_ticket = Ticket.find( recent_view['o_id'] )
|
recent_view_ticket = Ticket.find(recent_view['o_id'])
|
||||||
assets = recent_view_ticket.assets(assets)
|
assets = recent_view_ticket.assets(assets)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +184,7 @@ class TicketsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
# permission check
|
# permission check
|
||||||
return if !ticket_permission( ticket_slave )
|
return if !ticket_permission(ticket_slave)
|
||||||
|
|
||||||
# check diffetent ticket ids
|
# check diffetent ticket ids
|
||||||
if ticket_slave.id == ticket_master.id
|
if ticket_slave.id == ticket_master.id
|
||||||
|
@ -214,7 +213,7 @@ class TicketsController < ApplicationController
|
||||||
def ticket_full
|
def ticket_full
|
||||||
|
|
||||||
# permission check
|
# permission check
|
||||||
ticket = Ticket.find( params[:id] )
|
ticket = Ticket.find(params[:id])
|
||||||
return if !ticket_permission(ticket)
|
return if !ticket_permission(ticket)
|
||||||
|
|
||||||
# get attributes to update
|
# get attributes to update
|
||||||
|
@ -225,7 +224,7 @@ class TicketsController < ApplicationController
|
||||||
assets = ticket.assets(assets)
|
assets = ticket.assets(assets)
|
||||||
|
|
||||||
# get related articles
|
# get related articles
|
||||||
articles = Ticket::Article.where(ticket_id: params[:id])
|
articles = Ticket::Article.where(ticket_id: params[:id]).order('created_at ASC, id ASC')
|
||||||
|
|
||||||
# get related users
|
# get related users
|
||||||
article_ids = []
|
article_ids = []
|
||||||
|
|
|
@ -53,8 +53,8 @@ class AgentTicketActionLevel6Test < TestCase
|
||||||
|
|
||||||
# check if ticket is shown and attachment exists
|
# check if ticket is shown and attachment exists
|
||||||
location_check(url: '#ticket/zoom/')
|
location_check(url: '#ticket/zoom/')
|
||||||
sleep 4
|
sleep 2
|
||||||
ticket_number = @browser.find_elements({ css: '.active .ticketZoom-header .ticket-number' } )[0].text
|
ticket_number = @browser.find_elements({ css: '.active .ticketZoom-header .ticket-number' })[0].text
|
||||||
match(
|
match(
|
||||||
css: '.active .ticket-article-item:nth-child(1) .attachments',
|
css: '.active .ticket-article-item:nth-child(1) .attachments',
|
||||||
value: 'upload2.jpg',
|
value: 'upload2.jpg',
|
||||||
|
@ -77,9 +77,7 @@ class AgentTicketActionLevel6Test < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# submit form
|
# submit form
|
||||||
click(
|
click(css: '.active .js-submit')
|
||||||
css: '.active .js-submit',
|
|
||||||
)
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# check warning
|
# check warning
|
||||||
|
@ -93,9 +91,7 @@ class AgentTicketActionLevel6Test < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# submit form
|
# submit form
|
||||||
click(
|
click(css: '.active .js-submit')
|
||||||
css: '.active .js-submit',
|
|
||||||
)
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# no warning
|
# no warning
|
||||||
|
@ -136,9 +132,7 @@ class AgentTicketActionLevel6Test < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# submit form
|
# submit form
|
||||||
click(
|
click(css: '.active .js-submit')
|
||||||
css: '.active .js-submit',
|
|
||||||
)
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# check warning
|
# check warning
|
||||||
|
@ -146,9 +140,7 @@ class AgentTicketActionLevel6Test < TestCase
|
||||||
css: '.active .modal',
|
css: '.active .modal',
|
||||||
value: 'missing',
|
value: 'missing',
|
||||||
)
|
)
|
||||||
click(
|
click(css: '.active .modal .js-cancel')
|
||||||
css: '.active .modal .js-cancel',
|
|
||||||
)
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
ticket_update(
|
ticket_update(
|
||||||
|
@ -159,9 +151,7 @@ class AgentTicketActionLevel6Test < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# submit form
|
# submit form
|
||||||
click(
|
click(css: '.active .js-submit')
|
||||||
css: '.active .js-submit',
|
|
||||||
)
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# discard changes should gone away
|
# discard changes should gone away
|
||||||
|
|
Loading…
Reference in a new issue