Moved check if escalation is ignored to Ticket::State.ignore_escalation?, thanks to Roy!

This commit is contained in:
Martin Edenhofer 2013-08-06 11:49:56 +02:00
parent c139ea0e1f
commit 39a0fde251
2 changed files with 27 additions and 5 deletions

View file

@ -578,9 +578,7 @@ class Ticket < ApplicationModel
# set escalation off if ticket is already closed
ticket_state = Ticket::State.lookup( :id => self.ticket_state_id )
ticket_state_type = Ticket::StateType.lookup( :id => ticket_state.state_type_id )
ignore_escalation = ['removed', 'closed', 'merged', 'pending action']
if ignore_escalation.include?( ticket_state_type.name )
if ticket_state.ignore_escalation?
self.escalation_time = nil
# self.first_response_escal_date = nil
# self.close_time_escal_date = nil

View file

@ -10,6 +10,10 @@ list tickets by customer
states = Ticket::State.by_category('open') # open|closed
returns:
state objects
=end
def self.by_category(category)
@ -24,4 +28,24 @@ list tickets by customer
end
raise "Unknown category '#{category}'"
end
=begin
check if state is ignored for escalation
ticket_state = Ticket::State.lookup( :name => 'state name' )
result = ticket_state.ignore_escalation?
returns:
true/false
=end
def ignore_escalation?
ignore_escalation = ['removed', 'closed', 'merged']
return true if ignore_escalation.include?( self.name )
return false
end
end