From e4506dd1a3774453a17f5c3e8e5bf3a7930f7065 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 18 Oct 2012 21:39:59 +0200 Subject: [PATCH] Do not show current ticket to offer to merge to. --- .../_application_controller_table.js.coffee | 3 +-- .../app/controllers/agent_ticket_merge.js.coffee | 10 ++++++---- app/controllers/tickets_controller.rb | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee index 3ae244317..8b173acdc 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee @@ -49,8 +49,7 @@ class App.ControllerTable extends App.Controller # check if table is empty if _.isEmpty(data.objects) - table = '' - table = '-none-' + table = '-' + App.i18n.translateContent( 'none' ) + '-' return $(table) # define normal header diff --git a/app/assets/javascripts/app/controllers/agent_ticket_merge.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_merge.js.coffee index f925c8f68..09a91c138 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_merge.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_merge.js.coffee @@ -33,8 +33,9 @@ class App.TicketMerge extends App.ControllerModal list = [] for t in data.customer.tickets - ticketItem = App.Collection.find( 'Ticket', t.id ) - list.push ticketItem + if t.id isnt @ticket_id + ticketItem = App.Collection.find( 'Ticket', t.id ) + list.push ticketItem new App.ControllerTable( el: @el.find('#ticket-merge-customer-tickets'), overview_extended: [ @@ -59,8 +60,9 @@ class App.TicketMerge extends App.ControllerModal list = [] for t in data.recent.tickets - ticketItem = App.Collection.find( 'Ticket', t.id ) - list.push ticketItem + if t.id isnt @ticket_id + ticketItem = App.Collection.find( 'Ticket', t.id ) + list.push ticketItem new App.ControllerTable( el: @el.find('#ticket-merge-recent-tickets'), overview_extended: [ diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index 86d7bff9d..b49b853e4 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -193,7 +193,7 @@ class TicketsController < ApplicationController :ticket_state_type_id => Ticket::StateType.where( :name => ['new','open', 'pending reminder', 'pending action', 'closed'] ) ) ticket = Ticket.find( params[:ticket_id] ) - ticket_list = Ticket.where( :customer_id => ticket.customer_id, :ticket_state_id => ticket_states ).limit(6) + ticket_list = Ticket.where( :customer_id => ticket.customer_id, :ticket_state_id => ticket_states ).where( 'id != ?', [ ticket.id ] ) .limit(6) # get related users users = {} @@ -212,7 +212,7 @@ class TicketsController < ApplicationController end } - recent_viewed = History.recent_viewed_fulldata( current_user, 6 ) + recent_viewed = History.recent_viewed_fulldata( current_user, 8 ) # return result render :json => {