has_timeplan.rb 403 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module HasTimeplan
  3. extend ActiveSupport::Concern
  4. included do
  5. store :timeplan
  6. end
  7. def in_timeplan?(time = Time.zone.now)
  8. timeplan_calculation.contains?(time)
  9. end
  10. private
  11. def timeplan_calculation
  12. timezone = Setting.get('timezone_default')
  13. TimeplanCalculation.new(timeplan, timezone)
  14. end
  15. end