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,9 +1,10 @@
class UpdateTicketReplace2 < ActiveRecord::Migration class UpdateTicketReplace2 < ActiveRecord::Migration
def up def up
overview_role = Role.where( :name => 'Agent' ).first
if overview_role
Overview.destroy_all Overview.destroy_all
UserInfo.current_user_id = 1 UserInfo.current_user_id = 1
overview_role = Role.where( :name => 'Agent' ).first Overview.create_if_not_exists(
Overview.create_if_not_exists(
:name => 'My assigned Tickets', :name => 'My assigned Tickets',
:link => 'my_assigned', :link => 'my_assigned',
:prio => 1000, :prio => 1000,
@ -22,9 +23,9 @@ Overview.create_if_not_exists(
: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 => 'Unassigned & Open Tickets', :name => 'Unassigned & Open Tickets',
:link => 'all_unassigned', :link => 'all_unassigned',
:prio => 1001, :prio => 1001,
@ -43,9 +44,9 @@ Overview.create_if_not_exists(
: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,
@ -63,9 +64,9 @@ Overview.create_if_not_exists(
: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,
@ -83,9 +84,9 @@ Overview.create_if_not_exists(
: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,
@ -104,16 +105,16 @@ Overview.create_if_not_exists(
: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',
@ -125,10 +126,10 @@ Overview.create_if_not_exists(
: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_role = Role.where( :name => 'Customer' ).first
Overview.create_if_not_exists( Overview.create_if_not_exists(
:name => 'My Tickets', :name => 'My Tickets',
:link => 'my_tickets', :link => 'my_tickets',
:prio => 1000, :prio => 1000,
@ -147,8 +148,8 @@ Overview.create_if_not_exists(
:m => [ 'number', 'title', 'state', 'priority', 'created_at' ], :m => [ 'number', 'title', 'state', 'priority', 'created_at' ],
:view_mode_default => 's', :view_mode_default => 's',
}, },
) )
Overview.create_if_not_exists( Overview.create_if_not_exists(
:name => 'My Organization Tickets', :name => 'My Organization Tickets',
:link => 'my_organization_tickets', :link => 'my_organization_tickets',
:prio => 1100, :prio => 1100,
@ -168,8 +169,8 @@ Overview.create_if_not_exists(
:m => [ 'number', 'title', 'state', 'priority', 'created_at' ], :m => [ 'number', 'title', 'state', 'priority', 'created_at' ],
:view_mode_default => 's', :view_mode_default => 's',
}, },
) )
end
end end
def down def down