state_id.rb 586 B

123456789101112131415161718192021222324252627
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Kayako::Case::StateId < Sequencer::Unit::Common::Provider::Named
  3. uses :resource
  4. private
  5. def state_id
  6. ::Ticket::State.select(:id).find_by(name: local).id
  7. end
  8. def local
  9. mapping.fetch(resource['status']['type'], 'open')
  10. end
  11. def mapping
  12. {
  13. 'NEW' => 'new',
  14. 'OPEN' => 'open',
  15. 'PENDING' => 'pending reminder',
  16. 'COMPLETED' => 'closed',
  17. 'CLOSED' => 'closed',
  18. 'CUSTOM' => 'open',
  19. }.freeze
  20. end
  21. end