20161117000002_ticket_number_generator_issue_427.rb 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. class TicketNumberGeneratorIssue427 < 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. setting = Setting.find_by(name: 'ticket_number')
  7. setting.preferences = {
  8. settings_included: %w[ticket_number_increment ticket_number_date],
  9. controller: 'SettingsAreaTicketNumber',
  10. permission: ['admin.ticket'],
  11. }
  12. setting.save!
  13. setting = Setting.find_by(name: 'ticket_number_increment')
  14. setting.preferences = {
  15. permission: ['admin.ticket'],
  16. hidden: true,
  17. }
  18. setting.save!
  19. setting = Setting.find_by(name: 'ticket_number_date')
  20. setting.preferences = {
  21. permission: ['admin.ticket'],
  22. hidden: true,
  23. }
  24. # just to make sure that value is saved correctly - https://github.com/zammad/zammad/issues/413
  25. if setting.state_current['value'] == true || setting.state_current['value'] == false
  26. setting.state_current['value'] = { 'checksum' => setting.state_current['value'] }
  27. end
  28. setting.save!
  29. setting = Setting.find_by(name: 'ticket_hook_position')
  30. setting.preferences = {
  31. controller: 'SettingsAreaTicketHookPosition',
  32. permission: ['admin.ticket'],
  33. }
  34. setting.options = {
  35. form: [
  36. {
  37. display: '',
  38. null: true,
  39. name: 'ticket_hook_position',
  40. tag: 'select',
  41. translate: true,
  42. options: {
  43. 'left' => 'left',
  44. 'right' => 'right',
  45. 'none' => 'none',
  46. },
  47. },
  48. ],
  49. }
  50. setting.save!
  51. end
  52. end