priority_factory.rb 804 B

123456789101112131415161718192021222324252627282930313233343536
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. module Import
  3. module OTRS
  4. module PriorityFactory
  5. extend Import::Factory
  6. # rubocop:disable Style/ModuleFunction
  7. extend self
  8. def import_loop(records, *_args, &)
  9. super
  10. update_attribute_settings
  11. end
  12. def update_attribute_settings
  13. return if Import::OTRS.diff?
  14. update_attribute
  15. end
  16. def update_attribute
  17. priority = ::Ticket::Priority.find_by(
  18. name: Import::OTRS::SysConfigFactory.postmaster_default_lookup(:priority_default_create),
  19. active: true
  20. )
  21. return if !priority
  22. priority.default_create = true
  23. priority.callback_loop = true
  24. priority.save
  25. end
  26. end
  27. end
  28. end