20221108124934_issue4266_fix_field.rb 810 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class Issue4266FixField < ActiveRecord::Migration[6.1]
  3. def change
  4. # return if it's a new setup
  5. return if !Setting.exists?(name: 'system_init_done')
  6. setting = Setting.find_by(name: 'customer_ticket_create_group_ids')
  7. setting.description = 'Defines groups for which a customer can create tickets via web interface. No selection means all groups are available.'
  8. setting.options['form'][0]['tag'] = 'multiselect'
  9. setting.options['form'][0].delete('nulloption')
  10. setting.save!
  11. value = Setting.get('customer_ticket_create_group_ids')
  12. if ['', ['']].include?(value)
  13. value = nil
  14. end
  15. Setting.set('customer_ticket_create_group_ids', value)
  16. end
  17. end