trabajo-afectivo/db/migrate/20161117000002_ticket_number_generator_issue_427.rb

56 lines
1.6 KiB
Ruby
Raw Normal View History

2017-09-08 08:28:34 +00:00
class TicketNumberGeneratorIssue427 < ActiveRecord::Migration[4.2]
def up
# return if it's a new setup
return if !Setting.find_by(name: 'system_init_done')
setting = Setting.find_by(name: 'ticket_number')
setting.preferences = {
2017-11-23 08:09:44 +00:00
settings_included: %w[ticket_number_increment ticket_number_date],
controller: 'SettingsAreaTicketNumber',
permission: ['admin.ticket'],
}
setting.save!
setting = Setting.find_by(name: 'ticket_number_increment')
setting.preferences = {
permission: ['admin.ticket'],
hidden: true,
}
setting.save!
setting = Setting.find_by(name: 'ticket_number_date')
setting.preferences = {
permission: ['admin.ticket'],
hidden: true,
}
# just to make sure that value is saved correctly - https://github.com/zammad/zammad/issues/413
if setting.state_current['value'] == true || setting.state_current['value'] == false
setting.state_current['value'] = { 'checksum' => setting.state_current['value'] }
end
setting.save!
setting = Setting.find_by(name: 'ticket_hook_position')
setting.preferences = {
controller: 'SettingsAreaTicketHookPosition',
permission: ['admin.ticket'],
}
setting.options = {
form: [
{
display: '',
null: true,
name: 'ticket_hook_position',
tag: 'select',
translate: true,
options: {
'left' => 'left',
'right' => 'right',
'none' => 'none',
},
},
],
}
setting.save!
end
end