2017-09-08 08:28:34 +00:00
|
|
|
class FormGroupSelection < ActiveRecord::Migration[4.2]
|
2017-06-28 17:19:19 +00:00
|
|
|
def up
|
|
|
|
|
|
|
|
# return if it's a new setup
|
|
|
|
return if !Setting.find_by(name: 'system_init_done')
|
|
|
|
|
|
|
|
group = Group.where(active: true).first
|
|
|
|
if !group
|
|
|
|
group = Group.first
|
|
|
|
end
|
|
|
|
group_id = 1
|
|
|
|
if group
|
|
|
|
group_id = group.id
|
|
|
|
end
|
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
title: 'Group selection for Ticket creation',
|
|
|
|
name: 'form_ticket_create_group_id',
|
|
|
|
area: 'Form::Base',
|
2017-06-28 17:19:19 +00:00
|
|
|
description: 'Defines if group of created tickets via web form.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-06-28 17:19:19 +00:00
|
|
|
form: [
|
|
|
|
{
|
2018-12-19 17:31:51 +00:00
|
|
|
display: '',
|
|
|
|
null: true,
|
|
|
|
name: 'form_ticket_create_group_id',
|
|
|
|
tag: 'select',
|
2017-06-28 17:19:19 +00:00
|
|
|
relation: 'Group',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: group_id,
|
2017-06-28 17:19:19 +00:00
|
|
|
preferences: {
|
|
|
|
permission: ['admin.channel_formular'],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false,
|
2017-06-28 17:19:19 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
title: 'Limit tickets by ip per hour',
|
|
|
|
name: 'form_ticket_create_by_ip_per_hour',
|
|
|
|
area: 'Form::Base',
|
2017-06-28 17:19:19 +00:00
|
|
|
description: 'Defines limit of tickets by ip per hour via web form.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-06-28 17:19:19 +00:00
|
|
|
form: [
|
|
|
|
{
|
|
|
|
display: '',
|
2018-12-19 17:31:51 +00:00
|
|
|
null: true,
|
|
|
|
name: 'form_ticket_create_by_ip_per_hour',
|
|
|
|
tag: 'input',
|
2017-06-28 17:19:19 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: 20,
|
2017-06-28 17:19:19 +00:00
|
|
|
preferences: {
|
|
|
|
permission: ['admin.channel_formular'],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false,
|
2017-06-28 17:19:19 +00:00
|
|
|
)
|
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
title: 'Limit tickets by ip per day',
|
|
|
|
name: 'form_ticket_create_by_ip_per_day',
|
|
|
|
area: 'Form::Base',
|
2017-06-28 17:19:19 +00:00
|
|
|
description: 'Defines limit of tickets by ip per day via web form.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-06-28 17:19:19 +00:00
|
|
|
form: [
|
|
|
|
{
|
|
|
|
display: '',
|
2018-12-19 17:31:51 +00:00
|
|
|
null: true,
|
|
|
|
name: 'form_ticket_create_by_ip_per_day',
|
|
|
|
tag: 'input',
|
2017-06-28 17:19:19 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: 240,
|
2017-06-28 17:19:19 +00:00
|
|
|
preferences: {
|
|
|
|
permission: ['admin.channel_formular'],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false,
|
2017-06-28 17:19:19 +00:00
|
|
|
)
|
|
|
|
Setting.create_if_not_exists(
|
2018-12-19 17:31:51 +00:00
|
|
|
title: 'Limit tickets per day',
|
|
|
|
name: 'form_ticket_create_per_day',
|
|
|
|
area: 'Form::Base',
|
2017-06-28 17:19:19 +00:00
|
|
|
description: 'Defines limit of tickets per day via web form.',
|
2018-12-19 17:31:51 +00:00
|
|
|
options: {
|
2017-06-28 17:19:19 +00:00
|
|
|
form: [
|
|
|
|
{
|
|
|
|
display: '',
|
2018-12-19 17:31:51 +00:00
|
|
|
null: true,
|
|
|
|
name: 'form_ticket_create_per_day',
|
|
|
|
tag: 'input',
|
2017-06-28 17:19:19 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
state: 5000,
|
2017-06-28 17:19:19 +00:00
|
|
|
preferences: {
|
|
|
|
permission: ['admin.channel_formular'],
|
|
|
|
},
|
2018-12-19 17:31:51 +00:00
|
|
|
frontend: false,
|
2017-06-28 17:19:19 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|