Fixed for initial setup.

This commit is contained in:
Martin Edenhofer 2014-06-10 09:16:18 +02:00
parent 2d715c713b
commit 943d015ae9

View file

@ -1,175 +1,176 @@
class UpdateTicketReplace2 < ActiveRecord::Migration class UpdateTicketReplace2 < ActiveRecord::Migration
def up def up
Overview.destroy_all overview_role = Role.where( :name => 'Agent' ).first
UserInfo.current_user_id = 1 if overview_role
overview_role = Role.where( :name => 'Agent' ).first Overview.destroy_all
Overview.create_if_not_exists( UserInfo.current_user_id = 1
:name => 'My assigned Tickets', Overview.create_if_not_exists(
:link => 'my_assigned', :name => 'My assigned Tickets',
:prio => 1000, :link => 'my_assigned',
:role_id => overview_role.id, :prio => 1000,
:condition => { :role_id => overview_role.id,
'tickets.state_id' => [ 1,2,3 ], :condition => {
'tickets.owner_id' => 'current_user.id', 'tickets.state_id' => [ 1,2,3 ],
}, 'tickets.owner_id' => 'current_user.id',
:order => { },
:by => 'created_at', :order => {
:direction => 'ASC', :by => 'created_at',
}, :direction => 'ASC',
:view => { },
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ], :view => {
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ], :d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ], :s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:view_mode_default => 's', :m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
}, :view_mode_default => 's',
) },
)
Overview.create_if_not_exists( Overview.create_if_not_exists(
:name => 'Unassigned & Open Tickets', :name => 'Unassigned & Open Tickets',
:link => 'all_unassigned', :link => 'all_unassigned',
:prio => 1001, :prio => 1001,
:role_id => overview_role.id, :role_id => overview_role.id,
:condition => { :condition => {
'tickets.state_id' => [1,2,3], 'tickets.state_id' => [1,2,3],
'tickets.owner_id' => 1, 'tickets.owner_id' => 1,
}, },
:order => { :order => {
:by => 'created_at', :by => 'created_at',
:direction => 'ASC', :direction => 'ASC',
}, },
:view => { :view => {
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ], :d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ], :s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ], :m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:view_mode_default => 's', :view_mode_default => 's',
}, },
) )
Overview.create_if_not_exists( Overview.create_if_not_exists(
:name => 'All Open Tickets', :name => 'All Open Tickets',
:link => 'all_open', :link => 'all_open',
:prio => 1002, :prio => 1002,
:role_id => overview_role.id, :role_id => overview_role.id,
:condition => { :condition => {
'tickets.state_id' => [1,2,3], 'tickets.state_id' => [1,2,3],
}, },
:order => { :order => {
:by => 'created_at', :by => 'created_at',
:direction => 'ASC', :direction => 'ASC',
}, },
:view => { :view => {
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ], :d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ], :s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ], :m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:view_mode_default => 's', :view_mode_default => 's',
}, },
) )
Overview.create_if_not_exists( Overview.create_if_not_exists(
:name => 'Escalated Tickets', :name => 'Escalated Tickets',
:link => 'all_escalated', :link => 'all_escalated',
:prio => 1010, :prio => 1010,
:role_id => overview_role.id, :role_id => overview_role.id,
:condition => { :condition => {
'tickets.escalation_time' =>{ 'direction' => 'before', 'count'=> 5, 'area' => 'minute' }, 'tickets.escalation_time' =>{ 'direction' => 'before', 'count'=> 5, 'area' => 'minute' },
}, },
:order => { :order => {
:by => 'escalation_time', :by => 'escalation_time',
:direction => 'ASC', :direction => 'ASC',
}, },
:view => { :view => {
:d => [ 'title', 'customer', 'state', 'group', 'owner', 'escalation_time' ], :d => [ 'title', 'customer', 'state', 'group', 'owner', 'escalation_time' ],
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'owner', 'escalation_time' ], :s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'owner', 'escalation_time' ],
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'owner', 'escalation_time' ], :m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'owner', 'escalation_time' ],
:view_mode_default => 's', :view_mode_default => 's',
}, },
) )
Overview.create_if_not_exists( Overview.create_if_not_exists(
:name => 'My pending reached Tickets', :name => 'My pending reached Tickets',
:link => 'my_pending_reached', :link => 'my_pending_reached',
:prio => 1020, :prio => 1020,
:role_id => overview_role.id, :role_id => overview_role.id,
:condition => { :condition => {
'tickets.state_id' => [3], 'tickets.state_id' => [3],
'tickets.owner_id' => 'current_user.id', 'tickets.owner_id' => 'current_user.id',
}, },
:order => { :order => {
:by => 'created_at', :by => 'created_at',
:direction => 'ASC', :direction => 'ASC',
}, },
:view => { :view => {
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ], :d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ], :s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ], :m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:view_mode_default => 's', :view_mode_default => 's',
}, },
) )
Overview.create_if_not_exists( Overview.create_if_not_exists(
:name => 'All Tickets', :name => 'All Tickets',
:link => 'all', :link => 'all',
:prio => 9003, :prio => 9003,
:role_id => overview_role.id, :role_id => overview_role.id,
:condition => { :condition => {
# 'tickets.state_id' => [3], # 'tickets.state_id' => [3],
# 'tickets.owner_id' => current_user.id, # 'tickets.owner_id' => current_user.id,
}, },
:order => { :order => {
:by => 'created_at', :by => 'created_at',
:direction => 'ASC', :direction => 'ASC',
}, },
:view => { :view => {
:s => [ 'title', 'customer', 'state', 'group', 'created_at' ], :s => [ 'title', 'customer', 'state', 'group', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ], :s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ], :m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:view_mode_default => 's', :view_mode_default => 's',
}, },
) )
overview_role = Role.where( :name => 'Customer' ).first
Overview.create_if_not_exists(
:name => 'My Tickets',
:link => 'my_tickets',
:prio => 1000,
:role_id => overview_role.id,
:condition => {
'tickets.state_id' => [ 1,2,3,4,6 ],
'tickets.customer_id' => 'current_user.id',
},
:order => {
:by => 'created_at',
:direction => 'DESC',
},
:view => {
:d => [ 'title', 'customer', 'state', 'created_at' ],
:s => [ 'number', 'title', 'state', 'priority', 'created_at' ],
:m => [ 'number', 'title', 'state', 'priority', 'created_at' ],
:view_mode_default => 's',
},
)
Overview.create_if_not_exists(
:name => 'My Organization Tickets',
:link => 'my_organization_tickets',
:prio => 1100,
:role_id => overview_role.id,
:organization_shared => true,
:condition => {
'tickets.state_id' => [ 1,2,3,4,6 ],
'tickets.organization_id' => 'current_user.organization_id',
},
:order => {
:by => 'created_at',
:direction => 'DESC',
},
:view => {
:d => [ 'title', 'customer', 'state', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'created_at' ],
:m => [ 'number', 'title', 'state', 'priority', 'created_at' ],
:view_mode_default => 's',
},
)
overview_role = Role.where( :name => 'Customer' ).first
Overview.create_if_not_exists(
:name => 'My Tickets',
:link => 'my_tickets',
:prio => 1000,
:role_id => overview_role.id,
:condition => {
'tickets.state_id' => [ 1,2,3,4,6 ],
'tickets.customer_id' => 'current_user.id',
},
:order => {
:by => 'created_at',
:direction => 'DESC',
},
:view => {
:d => [ 'title', 'customer', 'state', 'created_at' ],
:s => [ 'number', 'title', 'state', 'priority', 'created_at' ],
:m => [ 'number', 'title', 'state', 'priority', 'created_at' ],
:view_mode_default => 's',
},
)
Overview.create_if_not_exists(
:name => 'My Organization Tickets',
:link => 'my_organization_tickets',
:prio => 1100,
:role_id => overview_role.id,
:organization_shared => true,
:condition => {
'tickets.state_id' => [ 1,2,3,4,6 ],
'tickets.organization_id' => 'current_user.organization_id',
},
:order => {
:by => 'created_at',
:direction => 'DESC',
},
:view => {
:d => [ 'title', 'customer', 'state', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'created_at' ],
:m => [ 'number', 'title', 'state', 'priority', 'created_at' ],
:view_mode_default => 's',
},
)
end
end end
def down def down