20180604000001_setting_add_ticket_auto_assignment2.rb 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. class SettingAddTicketAutoAssignment2 < ActiveRecord::Migration[5.1]
  3. def up
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. Setting.create_if_not_exists(
  7. title: 'Auto Assigment',
  8. name: 'ticket_auto_assignment',
  9. area: 'Web::Base',
  10. description: 'Enable ticket auto assignment.',
  11. options: {
  12. form: [
  13. {
  14. display: '',
  15. null: true,
  16. name: 'ticket_auto_assignment',
  17. tag: 'boolean',
  18. options: {
  19. true => 'yes',
  20. false => 'no',
  21. },
  22. },
  23. ],
  24. },
  25. preferences: {
  26. authentication: true,
  27. permission: ['admin.ticket_auto_assignment'],
  28. },
  29. state: false,
  30. frontend: true
  31. )
  32. Setting.create_if_not_exists(
  33. title: 'Time Accounting Selector',
  34. name: 'ticket_auto_assignment_selector',
  35. area: 'Web::Base',
  36. description: 'Enable auto assignment for following matching tickets.',
  37. options: {
  38. form: [
  39. {},
  40. ],
  41. },
  42. preferences: {
  43. authentication: true,
  44. permission: ['admin.ticket_auto_assignment'],
  45. },
  46. state: { condition: { 'ticket.state_id' => { operator: 'is', value: Ticket::State.by_category(:work_on).pluck(:id) } } },
  47. frontend: true
  48. )
  49. Setting.create_or_update(
  50. title: 'Time Accounting Selector',
  51. name: 'ticket_auto_assignment_user_ids_ignore',
  52. area: 'Web::Base',
  53. description: 'Define an exception of "automatic assignment" for certain users (e.g. executives).',
  54. options: {
  55. form: [
  56. {},
  57. ],
  58. },
  59. preferences: {
  60. authentication: true,
  61. permission: ['admin.ticket_auto_assignment'],
  62. },
  63. state: [],
  64. frontend: true
  65. )
  66. end
  67. end