Moved check if escalation is ignored to Ticket::State.ignore_escalation?, thanks to Roy!
This commit is contained in:
parent
c139ea0e1f
commit
39a0fde251
2 changed files with 27 additions and 5 deletions
|
@ -578,9 +578,7 @@ class Ticket < ApplicationModel
|
||||||
|
|
||||||
# set escalation off if ticket is already closed
|
# set escalation off if ticket is already closed
|
||||||
ticket_state = Ticket::State.lookup( :id => self.ticket_state_id )
|
ticket_state = Ticket::State.lookup( :id => self.ticket_state_id )
|
||||||
ticket_state_type = Ticket::StateType.lookup( :id => ticket_state.state_type_id )
|
if ticket_state.ignore_escalation?
|
||||||
ignore_escalation = ['removed', 'closed', 'merged', 'pending action']
|
|
||||||
if ignore_escalation.include?( ticket_state_type.name )
|
|
||||||
self.escalation_time = nil
|
self.escalation_time = nil
|
||||||
# self.first_response_escal_date = nil
|
# self.first_response_escal_date = nil
|
||||||
# self.close_time_escal_date = nil
|
# self.close_time_escal_date = nil
|
||||||
|
|
|
@ -10,6 +10,10 @@ list tickets by customer
|
||||||
|
|
||||||
states = Ticket::State.by_category('open') # open|closed
|
states = Ticket::State.by_category('open') # open|closed
|
||||||
|
|
||||||
|
returns:
|
||||||
|
|
||||||
|
state objects
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def self.by_category(category)
|
def self.by_category(category)
|
||||||
|
@ -24,4 +28,24 @@ list tickets by customer
|
||||||
end
|
end
|
||||||
raise "Unknown category '#{category}'"
|
raise "Unknown category '#{category}'"
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue