20170628000001_form_group_selection.rb 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class FormGroupSelection < ActiveRecord::Migration[4.2]
  3. def up
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. group = Group.where(active: true).first
  7. if !group
  8. group = Group.first
  9. end
  10. group_id = 1
  11. if group
  12. group_id = group.id
  13. end
  14. Setting.create_if_not_exists(
  15. title: 'Group selection for Ticket creation',
  16. name: 'form_ticket_create_group_id',
  17. area: 'Form::Base',
  18. description: 'Defines if group of created tickets via web form.',
  19. options: {
  20. form: [
  21. {
  22. display: '',
  23. null: true,
  24. name: 'form_ticket_create_group_id',
  25. tag: 'select',
  26. relation: 'Group',
  27. },
  28. ],
  29. },
  30. state: group_id,
  31. preferences: {
  32. permission: ['admin.channel_formular'],
  33. },
  34. frontend: false,
  35. )
  36. Setting.create_if_not_exists(
  37. title: 'Limit tickets by ip per hour',
  38. name: 'form_ticket_create_by_ip_per_hour',
  39. area: 'Form::Base',
  40. description: 'Defines limit of tickets by ip per hour via web form.',
  41. options: {
  42. form: [
  43. {
  44. display: '',
  45. null: true,
  46. name: 'form_ticket_create_by_ip_per_hour',
  47. tag: 'input',
  48. },
  49. ],
  50. },
  51. state: 20,
  52. preferences: {
  53. permission: ['admin.channel_formular'],
  54. },
  55. frontend: false,
  56. )
  57. Setting.create_if_not_exists(
  58. title: 'Limit tickets by ip per day',
  59. name: 'form_ticket_create_by_ip_per_day',
  60. area: 'Form::Base',
  61. description: 'Defines limit of tickets by ip per day via web form.',
  62. options: {
  63. form: [
  64. {
  65. display: '',
  66. null: true,
  67. name: 'form_ticket_create_by_ip_per_day',
  68. tag: 'input',
  69. },
  70. ],
  71. },
  72. state: 240,
  73. preferences: {
  74. permission: ['admin.channel_formular'],
  75. },
  76. frontend: false,
  77. )
  78. Setting.create_if_not_exists(
  79. title: 'Limit tickets per day',
  80. name: 'form_ticket_create_per_day',
  81. area: 'Form::Base',
  82. description: 'Defines limit of tickets per day via web form.',
  83. options: {
  84. form: [
  85. {
  86. display: '',
  87. null: true,
  88. name: 'form_ticket_create_per_day',
  89. tag: 'input',
  90. },
  91. ],
  92. },
  93. state: 5000,
  94. preferences: {
  95. permission: ['admin.channel_formular'],
  96. },
  97. frontend: false,
  98. )
  99. end
  100. end