time_accounting.rb 602 B

12345678910111213141516171819202122232425262728
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class FormUpdater::Updater::Ticket::TimeAccounting < FormUpdater::Updater
  3. def resolve
  4. if meta[:initial]
  5. result['accounted_time_type_id'] = accounted_time_type_options
  6. end
  7. super
  8. end
  9. def object_type
  10. ::Ticket
  11. end
  12. def accounted_time_type_options
  13. {
  14. value: Setting.get('time_accounting_type_default'),
  15. options: ::Ticket::TimeAccounting::Type.where(active: true).map do |type|
  16. {
  17. value: type.id,
  18. label: type.name,
  19. }
  20. end,
  21. }
  22. end
  23. end