Moved seeds to own files and call them in a loop to restructure them and make separate executions (for resetting purposes) possible.

This commit is contained in:
Thorsten Eckel 2017-04-26 13:28:32 +02:00
parent 5e7062295b
commit 0fd75fa482
24 changed files with 5745 additions and 5753 deletions

File diff suppressed because it is too large Load diff

27
db/seeds/channels.rb Normal file
View file

@ -0,0 +1,27 @@
Channel.create_if_not_exists(
area: 'Email::Notification',
options: {
outbound: {
adapter: 'smtp',
options: {
host: 'host.example.com',
user: '',
password: '',
ssl: true,
},
},
},
group_id: 1,
preferences: { online_service_disable: true },
active: false,
)
Channel.create_if_not_exists(
area: 'Email::Notification',
options: {
outbound: {
adapter: 'sendmail',
},
},
preferences: { online_service_disable: true },
active: true,
)

8
db/seeds/chats.rb Normal file
View file

@ -0,0 +1,8 @@
Chat.create_if_not_exists(
name: 'default',
max_queue: 5,
note: '',
active: true,
updated_by_id: 1,
created_by_id: 1,
)

View file

@ -0,0 +1,44 @@
org_community = Organization.create_if_not_exists(
id: 1,
name: 'Zammad Foundation',
)
user_community = User.create_or_update(
id: 2,
login: 'nicole.braun@zammad.org',
firstname: 'Nicole',
lastname: 'Braun',
email: 'nicole.braun@zammad.org',
password: '',
active: true,
roles: [ Role.find_by(name: 'Customer') ],
organization_id: org_community.id,
)
UserInfo.current_user_id = user_community.id
ticket = Ticket.create(
group_id: Group.find_by(name: 'Users').id,
customer_id: User.find_by(login: 'nicole.braun@zammad.org').id,
title: 'Welcome to Zammad!',
)
Ticket::Article.create(
ticket_id: ticket.id,
type_id: Ticket::Article::Type.find_by(name: 'phone').id,
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
from: 'Zammad Feedback <feedback@zammad.org>',
body: 'Welcome!
Thank you for choosing Zammad.
You will find updates and patches at https://zammad.org/. Online
documentation is available at https://zammad.org/documentation. Get
involved (discussions, contributing, ...) at https://zammad.org/participate.
Regards,
Your Zammad Team
',
internal: false,
)
UserInfo.current_user_id = 1

8
db/seeds/groups.rb Normal file
View file

@ -0,0 +1,8 @@
Group.create_if_not_exists(
id: 1,
name: 'Users',
signature_id: Signature.first.id,
note: 'Standard Group/Pool for Tickets.',
updated_by_id: 1,
created_by_id: 1
)

View file

@ -0,0 +1,66 @@
Karma::Activity.create_or_update(
name: 'ticket create',
description: 'You have created a ticket',
score: 10,
once_ttl: 60,
)
Karma::Activity.create_or_update(
name: 'ticket close',
description: 'You have closed a ticket',
score: 5,
once_ttl: 60,
)
Karma::Activity.create_or_update(
name: 'ticket answer 1h',
description: 'You have answered a ticket within 1h',
score: 25,
once_ttl: 60,
)
Karma::Activity.create_or_update(
name: 'ticket answer 2h',
description: 'You have answered a ticket within 2h',
score: 20,
once_ttl: 60,
)
Karma::Activity.create_or_update(
name: 'ticket answer 12h',
description: 'You have answered a ticket within 12h',
score: 10,
once_ttl: 60,
)
Karma::Activity.create_or_update(
name: 'ticket answer 24h',
description: 'You have answered a ticket within 24h',
score: 5,
once_ttl: 60,
)
Karma::Activity.create_or_update(
name: 'ticket pending state',
description: 'Usage of advanced features',
score: 2,
once_ttl: 60,
)
Karma::Activity.create_or_update(
name: 'ticket escalated',
description: 'You have escalated tickets',
score: -5,
once_ttl: 60 * 60 * 24,
)
Karma::Activity.create_or_update(
name: 'ticket reminder overdue (+2 days)',
description: 'You have tickets that are over 2 days overdue',
score: -5,
once_ttl: 60 * 60 * 24,
)
Karma::Activity.create_or_update(
name: 'text module',
description: 'Usage of advanced features',
score: 4,
once_ttl: 60 * 30,
)
Karma::Activity.create_or_update(
name: 'tagging',
description: 'Usage of advanced features',
score: 4,
once_ttl: 60 * 60 * 4,
)

6
db/seeds/links.rb Normal file
View file

@ -0,0 +1,6 @@
Link::Type.create_if_not_exists(id: 1, name: 'normal')
Link::Object.create_if_not_exists(id: 1, name: 'Ticket')
Link::Object.create_if_not_exists(id: 2, name: 'Announcement')
Link::Object.create_if_not_exists(id: 3, name: 'Question/Answer')
Link::Object.create_if_not_exists(id: 4, name: 'Idea')
Link::Object.create_if_not_exists(id: 5, name: 'Bug')

18
db/seeds/macros.rb Normal file
View file

@ -0,0 +1,18 @@
Macro.create_if_not_exists(
name: 'Close & Tag as Spam',
perform: {
'ticket.state_id' => {
value: Ticket::State.by_category(:closed).first.id,
},
'ticket.tags' => {
operator: 'add',
value: 'spam',
},
'ticket.owner_id' => {
pre_condition: 'current_user.id',
value: '',
},
},
note: 'example macro',
active: true,
)

100
db/seeds/networks.rb Normal file
View file

@ -0,0 +1,100 @@
network = Network.create_if_not_exists(
id: 1,
name: 'base',
)
Network::Category::Type.create_if_not_exists(
id: 1,
name: 'Announcement',
)
Network::Category::Type.create_if_not_exists(
id: 2,
name: 'Idea',
)
Network::Category::Type.create_if_not_exists(
id: 3,
name: 'Question',
)
Network::Category::Type.create_if_not_exists(
id: 4,
name: 'Bug Report',
)
Network::Privacy.create_if_not_exists(
id: 1,
name: 'logged in',
key: 'loggedIn',
)
Network::Privacy.create_if_not_exists(
id: 2,
name: 'logged in and moderator',
key: 'loggedInModerator',
)
Network::Category.create_if_not_exists(
id: 1,
name: 'Announcements',
network_id: network.id,
network_category_type_id: Network::Category::Type.find_by(name: 'Announcement').id,
network_privacy_id: Network::Privacy.find_by(name: 'logged in and moderator').id,
allow_comments: true,
)
Network::Category.create_if_not_exists(
id: 2,
name: 'Questions',
network_id: network.id,
allow_comments: true,
network_category_type_id: Network::Category::Type.find_by(name: 'Question').id,
network_privacy_id: Network::Privacy.find_by(name: 'logged in').id,
)
Network::Category.create_if_not_exists(
id: 3,
name: 'Ideas',
network_id: network.id,
network_category_type_id: Network::Category::Type.find_by(name: 'Idea').id,
network_privacy_id: Network::Privacy.find_by(name: 'logged in').id,
allow_comments: true,
)
Network::Category.create_if_not_exists(
id: 4,
name: 'Bug Reports',
network_id: network.id,
network_category_type_id: Network::Category::Type.find_by(name: 'Bug Report').id,
network_privacy_id: Network::Privacy.find_by(name: 'logged in').id,
allow_comments: true,
)
item = Network::Item.create(
title: 'Example Announcement',
body: 'Some announcement....',
network_category_id: Network::Category.find_by(name: 'Announcements').id,
)
Network::Item::Comment.create(
network_item_id: item.id,
body: 'Some comment....',
)
item = Network::Item.create(
title: 'Example Question?',
body: 'Some questions....',
network_category_id: Network::Category.find_by(name: 'Questions').id,
)
Network::Item::Comment.create(
network_item_id: item.id,
body: 'Some comment....',
)
item = Network::Item.create(
title: 'Example Idea',
body: 'Some idea....',
network_category_id: Network::Category.find_by(name: 'Ideas').id,
)
Network::Item::Comment.create(
network_item_id: item.id,
body: 'Some comment....',
)
item = Network::Item.create(
title: 'Example Bug Report',
body: 'Some bug....',
network_category_id: Network::Category.find_by(name: 'Bug Reports').id,
)
Network::Item::Comment.create(
network_item_id: item.id,
body: 'Some comment....',
)

File diff suppressed because it is too large Load diff

216
db/seeds/overviews.rb Normal file
View file

@ -0,0 +1,216 @@
overview_role = Role.find_by(name: 'Agent')
Overview.create_if_not_exists(
name: 'My assigned Tickets',
link: 'my_assigned',
prio: 1000,
role_ids: [overview_role.id],
condition: {
'ticket.state_id' => {
operator: 'is',
value: Ticket::State.by_category(:open).pluck(:id),
},
'ticket.owner_id' => {
operator: 'is',
pre_condition: 'current_user.id',
},
},
order: {
by: 'created_at',
direction: 'ASC',
},
view: {
d: %w(title customer group created_at),
s: %w(title customer group created_at),
m: %w(number title customer group created_at),
view_mode_default: 's',
},
)
Overview.create_if_not_exists(
name: 'Unassigned & Open',
link: 'all_unassigned',
prio: 1010,
role_ids: [overview_role.id],
condition: {
'ticket.state_id' => {
operator: 'is',
value: Ticket::State.by_category(:work_on_all).pluck(:id),
},
'ticket.owner_id' => {
operator: 'is',
pre_condition: 'not_set',
},
},
order: {
by: 'created_at',
direction: 'ASC',
},
view: {
d: %w(title customer group created_at),
s: %w(title customer group created_at),
m: %w(number title customer group created_at),
view_mode_default: 's',
},
)
Overview.create_if_not_exists(
name: 'My pending reached Tickets',
link: 'my_pending_reached',
prio: 1020,
role_ids: [overview_role.id],
condition: {
'ticket.state_id' => {
operator: 'is',
value: Ticket::State.by_category(:pending_reminder).pluck(:id),
},
'ticket.owner_id' => {
operator: 'is',
pre_condition: 'current_user.id',
},
'ticket.pending_time' => {
operator: 'within next (relative)',
value: 0,
range: 'minute',
},
},
order: {
by: 'created_at',
direction: 'ASC',
},
view: {
d: %w(title customer group created_at),
s: %w(title customer group created_at),
m: %w(number title customer group created_at),
view_mode_default: 's',
},
)
Overview.create_if_not_exists(
name: 'Open',
link: 'all_open',
prio: 1030,
role_ids: [overview_role.id],
condition: {
'ticket.state_id' => {
operator: 'is',
value: Ticket::State.by_category(:work_on_all).pluck(:id),
},
},
order: {
by: 'created_at',
direction: 'ASC',
},
view: {
d: %w(title customer group state owner created_at),
s: %w(title customer group state owner created_at),
m: %w(number title customer group state owner created_at),
view_mode_default: 's',
},
)
Overview.create_if_not_exists(
name: 'Pending reached',
link: 'all_pending_reached',
prio: 1040,
role_ids: [overview_role.id],
condition: {
'ticket.state_id' => {
operator: 'is',
value: Ticket::State.by_category(:pending_reminder).pluck(:id),
},
'ticket.pending_time' => {
operator: 'within next (relative)',
value: 0,
range: 'minute',
},
},
order: {
by: 'created_at',
direction: 'ASC',
},
view: {
d: %w(title customer group owner created_at),
s: %w(title customer group owner created_at),
m: %w(number title customer group owner created_at),
view_mode_default: 's',
},
)
Overview.create_if_not_exists(
name: 'Escalated',
link: 'all_escalated',
prio: 1050,
role_ids: [overview_role.id],
condition: {
'ticket.escalation_at' => {
operator: 'within next (relative)',
value: '10',
range: 'minute',
},
},
order: {
by: 'escalation_at',
direction: 'ASC',
},
view: {
d: %w(title customer group owner escalation_at),
s: %w(title customer group owner escalation_at),
m: %w(number title customer group owner escalation_at),
view_mode_default: 's',
},
)
overview_role = Role.find_by(name: 'Customer')
Overview.create_if_not_exists(
name: 'My Tickets',
link: 'my_tickets',
prio: 1100,
role_ids: [overview_role.id],
condition: {
'ticket.state_id' => {
operator: 'is',
value: Ticket::State.by_category(:viewable).pluck(:id),
},
'ticket.customer_id' => {
operator: 'is',
pre_condition: 'current_user.id',
},
},
order: {
by: 'created_at',
direction: 'DESC',
},
view: {
d: %w(title customer state created_at),
s: %w(number title state created_at),
m: %w(number title state created_at),
view_mode_default: 's',
},
)
Overview.create_if_not_exists(
name: 'My Organization Tickets',
link: 'my_organization_tickets',
prio: 1200,
role_ids: [overview_role.id],
organization_shared: true,
condition: {
'ticket.state_id' => {
operator: 'is',
value: Ticket::State.by_category(:viewable).pluck(:id),
},
'ticket.organization_id' => {
operator: 'is',
pre_condition: 'current_user.organization_id',
},
},
order: {
by: 'created_at',
direction: 'DESC',
},
view: {
d: %w(title customer state created_at),
s: %w(number title customer state created_at),
m: %w(number title customer state created_at),
view_mode_default: 's',
},
)

361
db/seeds/permissions.rb Normal file
View file

@ -0,0 +1,361 @@
Permission.create_if_not_exists(
name: 'admin',
note: 'Admin Interface',
preferences: {},
)
Permission.create_if_not_exists(
name: 'admin.user',
note: 'Manage %s',
preferences: {
translations: ['Users']
},
)
Permission.create_if_not_exists(
name: 'admin.group',
note: 'Manage %s',
preferences: {
translations: ['Groups']
},
)
Permission.create_if_not_exists(
name: 'admin.role',
note: 'Manage %s',
preferences: {
translations: ['Roles']
},
)
Permission.create_if_not_exists(
name: 'admin.organization',
note: 'Manage %s',
preferences: {
translations: ['Organizations']
},
)
Permission.create_if_not_exists(
name: 'admin.overview',
note: 'Manage %s',
preferences: {
translations: ['Overviews']
},
)
Permission.create_if_not_exists(
name: 'admin.text_module',
note: 'Manage %s',
preferences: {
translations: ['Text Modules']
},
)
Permission.create_if_not_exists(
name: 'admin.macro',
note: 'Manage %s',
preferences: {
translations: ['Macros']
},
)
Permission.create_if_not_exists(
name: 'admin.tag',
note: 'Manage %s',
preferences: {
translations: ['Tags']
},
)
Permission.create_if_not_exists(
name: 'admin.calendar',
note: 'Manage %s',
preferences: {
translations: ['Calendar']
},
)
Permission.create_if_not_exists(
name: 'admin.sla',
note: 'Manage %s',
preferences: {
translations: ['SLA']
},
)
Permission.create_if_not_exists(
name: 'admin.scheduler',
note: 'Manage %s',
preferences: {
translations: ['Scheduler']
},
)
Permission.create_if_not_exists(
name: 'admin.report_profile',
note: 'Manage %s',
preferences: {
translations: ['Report Profiles']
},
)
Permission.create_if_not_exists(
name: 'admin.channel_web',
note: 'Manage %s',
preferences: {
translations: ['Channel - Web']
},
)
Permission.create_if_not_exists(
name: 'admin.channel_formular',
note: 'Manage %s',
preferences: {
translations: ['Channel - Formular']
},
)
Permission.create_if_not_exists(
name: 'admin.channel_email',
note: 'Manage %s',
preferences: {
translations: ['Channel - Email']
},
)
Permission.create_if_not_exists(
name: 'admin.channel_twitter',
note: 'Manage %s',
preferences: {
translations: ['Channel - Twitter']
},
)
Permission.create_if_not_exists(
name: 'admin.channel_facebook',
note: 'Manage %s',
preferences: {
translations: ['Channel - Facebook']
},
)
Permission.create_if_not_exists(
name: 'admin.channel_telegram',
note: 'Manage %s',
preferences: {
translations: ['Channel - Telegram']
},
)
Permission.create_if_not_exists(
name: 'admin.channel_chat',
note: 'Manage %s',
preferences: {
translations: ['Channel - Chat']
},
)
Permission.create_if_not_exists(
name: 'admin.branding',
note: 'Manage %s',
preferences: {
translations: ['Branding']
},
)
Permission.create_if_not_exists(
name: 'admin.setting_system',
note: 'Manage %s Settings',
preferences: {
translations: ['System']
},
)
Permission.create_if_not_exists(
name: 'admin.security',
note: 'Manage %s Settings',
preferences: {
translations: ['Security']
},
)
Permission.create_if_not_exists(
name: 'admin.ticket',
note: 'Manage %s Settings',
preferences: {
translations: ['Ticket']
},
)
Permission.create_if_not_exists(
name: 'admin.package',
note: 'Manage %s',
preferences: {
translations: ['Packages']
},
)
Permission.create_if_not_exists(
name: 'admin.integration',
note: 'Manage %s',
preferences: {
translations: ['Integrations']
},
)
Permission.create_if_not_exists(
name: 'admin.api',
note: 'Manage %s',
preferences: {
translations: ['API']
},
)
Permission.create_if_not_exists(
name: 'admin.object',
note: 'Manage %s',
preferences: {
translations: ['Objects']
},
)
Permission.create_if_not_exists(
name: 'admin.translation',
note: 'Manage %s',
preferences: {
translations: ['Translations']
},
)
Permission.create_if_not_exists(
name: 'admin.monitoring',
note: 'Manage %s',
preferences: {
translations: ['Monitoring']
},
)
Permission.create_if_not_exists(
name: 'admin.maintenance',
note: 'Manage %s',
preferences: {
translations: ['Maintenance']
},
)
Permission.create_if_not_exists(
name: 'admin.session',
note: 'Manage %s',
preferences: {
translations: ['Sessions']
},
)
Permission.create_if_not_exists(
name: 'user_preferences',
note: 'User Preferences',
preferences: {},
)
Permission.create_if_not_exists(
name: 'user_preferences.password',
note: 'Change %s',
preferences: {
translations: ['Password']
},
)
Permission.create_if_not_exists(
name: 'user_preferences.notifications',
note: 'Manage %s',
preferences: {
translations: ['Notifications'],
required: ['ticket.agent'],
},
)
Permission.create_if_not_exists(
name: 'user_preferences.access_token',
note: 'Manage %s',
preferences: {
translations: ['Token Access']
},
)
Permission.create_if_not_exists(
name: 'user_preferences.language',
note: 'Change %s',
preferences: {
translations: ['Language']
},
)
Permission.create_if_not_exists(
name: 'user_preferences.linked_accounts',
note: 'Manage %s',
preferences: {
translations: ['Linked Accounts']
},
)
Permission.create_if_not_exists(
name: 'user_preferences.device',
note: 'Manage %s',
preferences: {
translations: ['Devices']
},
)
Permission.create_if_not_exists(
name: 'user_preferences.avatar',
note: 'Manage %s',
preferences: {
translations: ['Avatar']
},
)
Permission.create_if_not_exists(
name: 'user_preferences.calendar',
note: 'Access to %s',
preferences: {
translations: ['Calendars'],
required: ['ticket.agent'],
},
)
Permission.create_if_not_exists(
name: 'report',
note: 'Report Interface',
preferences: {},
)
Permission.create_if_not_exists(
name: 'ticket',
note: 'Ticket Interface',
preferences: {
disabled: true
},
)
Permission.create_if_not_exists(
name: 'ticket.agent',
note: 'Access to Agent Tickets based on Group Access',
preferences: {
not: ['ticket.customer'],
plugin: ['groups']
},
)
Permission.create_if_not_exists(
name: 'ticket.customer',
note: 'Access to Customer Tickets based on current_user.id and current_user.organization_id',
preferences: {
not: ['ticket.agent'],
},
)
Permission.create_if_not_exists(
name: 'chat',
note: 'Access to %s',
preferences: {
translations: ['Chat']
},
)
Permission.create_if_not_exists(
name: 'chat.agent',
note: 'Access to %s',
preferences: {
translations: ['Chat'],
not: ['chat.customer'],
},
)
Permission.create_if_not_exists(
name: 'cti',
note: 'CTI',
preferences: {
disabled: true
},
)
Permission.create_if_not_exists(
name: 'cti.agent',
note: 'Access to %s',
preferences: {
translations: ['CTI'],
not: ['cti.customer'],
},
)
admin = Role.find_by(name: 'Admin')
admin.permission_grant('user_preferences')
admin.permission_grant('admin')
admin.permission_grant('report')
agent = Role.find_by(name: 'Agent')
agent.permission_grant('user_preferences')
agent.permission_grant('ticket.agent')
agent.permission_grant('chat.agent')
agent.permission_grant('cti.agent')
customer = Role.find_by(name: 'Customer')
customer.permission_grant('user_preferences.password')
customer.permission_grant('user_preferences.language')
customer.permission_grant('user_preferences.linked_accounts')
customer.permission_grant('user_preferences.avatar')
customer.permission_grant('ticket.customer')

View file

@ -0,0 +1,7 @@
Report::Profile.create_if_not_exists(
name: '-all-',
condition: {},
active: true,
updated_by_id: 1,
created_by_id: 1,
)

33
db/seeds/roles.rb Normal file
View file

@ -0,0 +1,33 @@
Role.create_if_not_exists(
id: 1,
name: 'Admin',
note: 'To configure your system.',
preferences: {
not: ['Customer'],
},
default_at_signup: false,
updated_by_id: 1,
created_by_id: 1
)
Role.create_if_not_exists(
id: 2,
name: 'Agent',
note: 'To work on Tickets.',
default_at_signup: false,
preferences: {
not: ['Customer'],
},
updated_by_id: 1,
created_by_id: 1
)
Role.create_if_not_exists(
id: 3,
name: 'Customer',
note: 'People who create Tickets ask for help.',
preferences: {
not: %w(Agent Admin),
},
default_at_signup: true,
updated_by_id: 1,
created_by_id: 1
)

167
db/seeds/schedulers.rb Normal file
View file

@ -0,0 +1,167 @@
Scheduler.create_if_not_exists(
name: 'Process pending tickets',
method: 'Ticket.process_pending',
period: 15.minutes,
prio: 1,
active: true,
)
Scheduler.create_if_not_exists(
name: 'Process escalation tickets',
method: 'Ticket.process_escalation',
period: 5.minutes,
prio: 1,
active: true,
)
Scheduler.create_if_not_exists(
name: 'Import OTRS diff load',
method: 'Import::OTRS.diff_worker',
period: 3.minutes,
prio: 1,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_if_not_exists(
name: 'Check Channels',
method: 'Channel.fetch',
period: 30.seconds,
prio: 1,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_if_not_exists(
name: 'Check streams for Channel',
method: 'Channel.stream',
period: 60.seconds,
prio: 1,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_if_not_exists(
name: 'Generate Session data',
method: 'Sessions.jobs',
period: 60.seconds,
prio: 1,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_if_not_exists(
name: 'Execute jobs',
method: 'Job.run',
period: 5.minutes,
prio: 2,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_if_not_exists(
name: 'Cleanup expired sessions',
method: 'SessionHelper.cleanup_expired',
period: 60 * 60 * 12,
prio: 2,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_if_not_exists(
name: 'Delete old activity stream entries.',
method: 'ActivityStream.cleanup',
period: 1.day,
prio: 2,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_if_not_exists(
name: 'Delete old entries.',
method: 'RecentView.cleanup',
period: 1.day,
prio: 2,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_or_update(
name: 'Delete old online notification entries.',
method: 'OnlineNotification.cleanup',
period: 2.hours,
prio: 2,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_or_update(
name: 'Delete old token entries.',
method: 'Token.cleanup',
period: 30.days,
prio: 2,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_or_update(
name: 'Closed chat sessions where participients are offline.',
method: 'Chat.cleanup_close',
period: 15.minutes,
prio: 2,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_or_update(
name: 'Cleanup closed sessions.',
method: 'Chat.cleanup',
period: 5.days,
prio: 2,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_or_update(
name: 'Sync calendars with ical feeds.',
method: 'Calendar.sync',
period: 1.day,
prio: 2,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_or_update(
name: 'Generate user based stats.',
method: 'Stats.generate',
period: 11.minutes,
prio: 2,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_or_update(
name: 'Delete old stats store entries.',
method: 'StatsStore.cleanup',
period: 31.days,
prio: 2,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_if_not_exists(
name: 'Cleanup HttpLog',
method: 'HttpLog.cleanup',
period: 1.day,
prio: 2,
active: true,
updated_by_id: 1,
created_by_id: 1,
)
Scheduler.create_if_not_exists(
name: 'Import Jobs',
method: 'ImportJob.start_registered',
period: 1.hour,
prio: 1,
active: true,
updated_by_id: 1,
created_by_id: 1
)

2798
db/seeds/settings.rb Normal file

File diff suppressed because it is too large Load diff

14
db/seeds/signatures.rb Normal file
View file

@ -0,0 +1,14 @@
Signature.create_if_not_exists(
id: 1,
name: 'default',
body: '
#{user.firstname} #{user.lastname}
--
Super Support - Waterford Business Park
5201 Blue Lagoon Drive - 8th Floor & 9th Floor - Miami, 33126 USA
Email: hot@example.com - Web: http://www.example.com/
--'.text2html,
updated_by_id: 1,
created_by_id: 1
)

View file

@ -0,0 +1,3 @@
Ticket::Article::Sender.create_if_not_exists(id: 1, name: 'Agent')
Ticket::Article::Sender.create_if_not_exists(id: 2, name: 'Customer')
Ticket::Article::Sender.create_if_not_exists(id: 3, name: 'System')

View file

@ -0,0 +1,12 @@
Ticket::Article::Type.create_if_not_exists(id: 1, name: 'email', communication: true)
Ticket::Article::Type.create_if_not_exists(id: 2, name: 'sms', communication: true)
Ticket::Article::Type.create_if_not_exists(id: 3, name: 'chat', communication: true)
Ticket::Article::Type.create_if_not_exists(id: 4, name: 'fax', communication: true)
Ticket::Article::Type.create_if_not_exists(id: 5, name: 'phone', communication: true)
Ticket::Article::Type.create_if_not_exists(id: 6, name: 'twitter status', communication: true)
Ticket::Article::Type.create_if_not_exists(id: 7, name: 'twitter direct-message', communication: true)
Ticket::Article::Type.create_if_not_exists(id: 8, name: 'facebook feed post', communication: true)
Ticket::Article::Type.create_if_not_exists(id: 9, name: 'facebook feed comment', communication: true)
Ticket::Article::Type.create_if_not_exists(id: 10, name: 'note', communication: false)
Ticket::Article::Type.create_if_not_exists(id: 11, name: 'web', communication: true)
Ticket::Article::Type.create_if_not_exists(id: 12, name: 'telegram personal-message', communication: true)

View file

@ -0,0 +1,3 @@
Ticket::Priority.create_if_not_exists(id: 1, name: '1 low')
Ticket::Priority.create_if_not_exists(id: 2, name: '2 normal', default_create: true)
Ticket::Priority.create_if_not_exists(id: 3, name: '3 high')

View file

@ -0,0 +1,7 @@
Ticket::StateType.create_if_not_exists(id: 1, name: 'new')
Ticket::StateType.create_if_not_exists(id: 2, name: 'open')
Ticket::StateType.create_if_not_exists(id: 3, name: 'pending reminder')
Ticket::StateType.create_if_not_exists(id: 4, name: 'pending action')
Ticket::StateType.create_if_not_exists(id: 5, name: 'closed')
Ticket::StateType.create_if_not_exists(id: 6, name: 'merged')
Ticket::StateType.create_if_not_exists(id: 7, name: 'removed')

44
db/seeds/ticket_states.rb Normal file
View file

@ -0,0 +1,44 @@
Ticket::State.create_if_not_exists(
id: 1,
name: 'new',
state_type_id: Ticket::StateType.find_by(name: 'new').id,
default_create: true,
)
Ticket::State.create_if_not_exists(
id: 2,
name: 'open',
state_type_id: Ticket::StateType.find_by(name: 'open').id,
default_follow_up: true,
)
Ticket::State.create_if_not_exists(
id: 3,
name: 'pending reminder',
state_type_id: Ticket::StateType.find_by(name: 'pending reminder').id,
ignore_escalation: true,
)
Ticket::State.create_if_not_exists(
id: 4,
name: 'closed',
state_type_id: Ticket::StateType.find_by(name: 'closed').id,
ignore_escalation: true,
)
Ticket::State.create_if_not_exists(
id: 5,
name: 'merged',
state_type_id: Ticket::StateType.find_by(name: 'merged').id,
ignore_escalation: true,
)
Ticket::State.create_if_not_exists(
id: 6,
name: 'removed',
state_type_id: Ticket::StateType.find_by(name: 'removed').id,
active: false,
ignore_escalation: true,
)
Ticket::State.create_if_not_exists(
id: 7,
name: 'pending close',
state_type_id: Ticket::StateType.find_by(name: 'pending action').id,
next_state_id: Ticket::State.by_category(:closed).first.id,
ignore_escalation: true,
)

110
db/seeds/triggers.rb Normal file
View file

@ -0,0 +1,110 @@
Trigger.create_or_update(
name: 'auto reply (on new tickets)',
condition: {
'ticket.action' => {
'operator' => 'is',
'value' => 'create',
},
'ticket.state_id' => {
'operator' => 'is not',
'value' => Ticket::State.by_category(:closed).first.id,
},
'article.type_id' => {
'operator' => 'is',
'value' => [
Ticket::Article::Type.lookup(name: 'email').id,
Ticket::Article::Type.lookup(name: 'phone').id,
Ticket::Article::Type.lookup(name: 'web').id,
],
},
'article.sender_id' => {
'operator' => 'is',
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
},
},
perform: {
'notification.email' => {
'body' => '<div>Your request <b>(#{config.ticket_hook}#{ticket.number})</b> has been received and will be reviewed by our support staff.</div>
<br/>
<div>To provide additional information, please reply to this email or click on the following link (for initial login, please request a new password):
<a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}</a>
</div>
<br/>
<div>Your #{config.product_name} Team</div>
<br/>
<div><i><a href="https://zammad.com">Zammad</a>, your customer support system</i></div>',
'recipient' => 'ticket_customer',
'subject' => 'Thanks for your inquiry (#{ticket.title})',
},
},
active: true,
created_by_id: 1,
updated_by_id: 1,
)
Trigger.create_or_update(
name: 'auto reply (on follow up of tickets)',
condition: {
'ticket.action' => {
'operator' => 'is',
'value' => 'update',
},
'article.sender_id' => {
'operator' => 'is',
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
},
'article.type_id' => {
'operator' => 'is',
'value' => [
Ticket::Article::Type.lookup(name: 'email').id,
Ticket::Article::Type.lookup(name: 'phone').id,
Ticket::Article::Type.lookup(name: 'web').id,
],
},
},
perform: {
'notification.email' => {
'body' => '<div>Your follow up for <b>(#{config.ticket_hook}#{ticket.number})</b> has been received and will be reviewed by our support staff.</div>
<br/>
<div>To provide additional information, please reply to this email or click on the following link:
<a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}</a>
</div>
<br/>
<div>Your #{config.product_name} Team</div>
<br/>
<div><i><a href="https://zammad.com">Zammad</a>, your customer support system</i></div>',
'recipient' => 'ticket_customer',
'subject' => 'Thanks for your follow up (#{ticket.title})',
},
},
active: false,
created_by_id: 1,
updated_by_id: 1,
)
Trigger.create_or_update(
name: 'customer notification (on owner change)',
condition: {
'ticket.owner_id' => {
'operator' => 'has changed',
'pre_condition' => 'current_user.id',
'value' => '',
'value_completion' => '',
}
},
perform: {
'notification.email' => {
'body' => '<p>The owner of ticket (Ticket##{ticket.number}) has changed and is now "#{ticket.owner.firstname} #{ticket.owner.lastname}".<p>
<br/>
<p>To provide additional information, please reply to this email or click on the following link:
<a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}</a>
</p>
<br/>
<p><i><a href="https://zammad.com">Zammad</a>, your customer support system</i></p>',
'recipient' => 'ticket_customer',
'subject' => 'Owner has changed (#{ticket.title})',
},
},
active: false,
created_by_id: 1,
updated_by_id: 1,
)

12
db/seeds/user_nr_1.rb Normal file
View file

@ -0,0 +1,12 @@
User.create_if_not_exists(
id: 1,
login: '-',
firstname: '-',
lastname: '',
email: '',
active: false,
updated_by_id: 1,
created_by_id: 1
)
UserInfo.current_user_id = 1