20231122123502_issue_4848_fix_overview_bulk_screen.rb 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Issue4848FixOverviewBulkScreen < ActiveRecord::Migration[7.0]
  3. def change
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. ObjectManager::Attribute.for_object('Ticket').where(name: %w[state_id pending_time group_id owner_id priority_id]).each do |field|
  7. field.screens[:overview_bulk] = {
  8. 'ticket.agent' => overview_bulk_configs[field.name],
  9. }
  10. field.save!
  11. end
  12. end
  13. def overview_bulk_configs
  14. @overview_bulk_configs ||= {
  15. 'state_id' => {
  16. nulloption: true,
  17. null: true,
  18. default: '',
  19. filter: Ticket::State.by_category(:viewable_agent_edit).pluck(:id),
  20. },
  21. 'pending_time' => {
  22. nulloption: true,
  23. null: true,
  24. default: '',
  25. orientation: 'top',
  26. disableScroll: true,
  27. },
  28. 'group_id' => {
  29. nulloption: true,
  30. null: true,
  31. default: '',
  32. direction: 'up',
  33. },
  34. 'owner_id' => {
  35. nulloption: true,
  36. null: true,
  37. default: '',
  38. },
  39. 'priority_id' => {
  40. nulloption: true,
  41. null: true,
  42. default: '',
  43. },
  44. }
  45. end
  46. end