20180529000001_issue_2035_recursive_ticket_trigger.rb 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. class Issue2035RecursiveTicketTrigger < ActiveRecord::Migration[5.1]
  2. def change
  3. # return if it's a new setup
  4. return if !Setting.exists?(name: 'system_init_done')
  5. Setting.create_if_not_exists(
  6. title: 'Recursive Ticket Triggers',
  7. name: 'ticket_trigger_recursive',
  8. area: 'Ticket::Core',
  9. description: 'Activate the recursive processing of ticket triggers.',
  10. options: {
  11. form: [
  12. {
  13. display: 'Recursive Ticket Triggers',
  14. null: true,
  15. name: 'ticket_trigger_recursive',
  16. tag: 'boolean',
  17. options: {
  18. true => 'yes',
  19. false => 'no',
  20. },
  21. },
  22. ],
  23. },
  24. state: false,
  25. preferences: {
  26. permission: ['admin.ticket'],
  27. hidden: true,
  28. },
  29. frontend: false
  30. )
  31. Setting.create_if_not_exists(
  32. title: 'Recursive Ticket Triggers Loop Max.',
  33. name: 'ticket_trigger_recursive_max_loop',
  34. area: 'Ticket::Core',
  35. description: 'Maximum number of recursively executed triggers.',
  36. options: {
  37. form: [
  38. {
  39. display: 'Recursive Ticket Triggers',
  40. null: true,
  41. name: 'ticket_trigger_recursive_max_loop',
  42. tag: 'select',
  43. options: {
  44. 1 => ' 1',
  45. 2 => ' 2',
  46. 3 => ' 3',
  47. 4 => ' 4',
  48. 5 => ' 5',
  49. 6 => ' 6',
  50. 7 => ' 7',
  51. 8 => ' 8',
  52. 9 => ' 9',
  53. 10 => '10',
  54. 11 => '11',
  55. 12 => '12',
  56. 13 => '13',
  57. 14 => '14',
  58. 15 => '15',
  59. 16 => '16',
  60. 17 => '17',
  61. 18 => '18',
  62. 19 => '19',
  63. 20 => '20',
  64. },
  65. },
  66. ],
  67. },
  68. state: 10,
  69. preferences: {
  70. permission: ['admin.ticket'],
  71. hidden: true,
  72. },
  73. frontend: false
  74. )
  75. end
  76. end