2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
2021-03-01 08:18:40 +00:00
|
|
|
|
|
|
|
# Ensures pending time is always zero-seconds.
|
|
|
|
module Ticket::ResetsPendingTimeSeconds
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
2021-09-06 15:43:29 +00:00
|
|
|
before_save :ticket_reset_pending_time_seconds
|
2021-03-01 08:18:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def ticket_reset_pending_time_seconds
|
|
|
|
return true if pending_time.blank?
|
|
|
|
return true if !pending_time_changed?
|
|
|
|
return true if pending_time.sec.zero?
|
|
|
|
|
|
|
|
self.pending_time = pending_time.change sec: 0
|
|
|
|
end
|
|
|
|
end
|