Added system settings to import.
This commit is contained in:
parent
e10552c361
commit
6d49496446
2 changed files with 91 additions and 9 deletions
|
@ -231,13 +231,29 @@ module Import::OTRS2
|
|||
"API key not valid!"
|
||||
end
|
||||
|
||||
# set settings
|
||||
settings = load('SysConfig')
|
||||
setting(settings)
|
||||
|
||||
# dynamic fields
|
||||
dynamic_fields = load('DynamicField')
|
||||
#settings(dynamic_fields, settings)
|
||||
|
||||
# email accounts
|
||||
#accounts = load('PostMasterAccount')
|
||||
#account(accounts)
|
||||
|
||||
# email filter
|
||||
#filters = load('PostMasterFilter')
|
||||
#filter(filters)
|
||||
|
||||
# create states
|
||||
records = load('State')
|
||||
state(records)
|
||||
states = load('State')
|
||||
state(states)
|
||||
|
||||
# create priorities
|
||||
records = load('Priority')
|
||||
priority(records)
|
||||
priorities = load('Priority')
|
||||
priority(priorities)
|
||||
|
||||
# create groups
|
||||
queues = load('Queue')
|
||||
|
@ -689,7 +705,6 @@ module Import::OTRS2
|
|||
end
|
||||
|
||||
# sync ticket states
|
||||
|
||||
def self.state(records)
|
||||
map = {
|
||||
:ChangeTime => :updated_at,
|
||||
|
@ -744,7 +759,6 @@ module Import::OTRS2
|
|||
end
|
||||
|
||||
# sync ticket priorities
|
||||
|
||||
def self.priority(records)
|
||||
|
||||
map = {
|
||||
|
@ -787,7 +801,6 @@ module Import::OTRS2
|
|||
end
|
||||
|
||||
# sync ticket groups / queues
|
||||
|
||||
def self.ticket_group(records)
|
||||
map = {
|
||||
:ChangeTime => :updated_at,
|
||||
|
@ -1069,6 +1082,58 @@ module Import::OTRS2
|
|||
end
|
||||
|
||||
|
||||
# sync settings
|
||||
|
||||
def self.setting(records)
|
||||
|
||||
|
||||
records.each { |setting|
|
||||
|
||||
# fqdn
|
||||
if setting['Key'] == 'FQDN'
|
||||
Setting.set( 'fqdn', setting['Value'] )
|
||||
end
|
||||
|
||||
# http type
|
||||
if setting['Key'] == 'HttpType'
|
||||
Setting.set( 'http_type', setting['Value'] )
|
||||
end
|
||||
|
||||
# system id
|
||||
if setting['Key'] == 'SystemID'
|
||||
Setting.set( 'system_id', setting['Value'] )
|
||||
end
|
||||
|
||||
# organization
|
||||
if setting['Key'] == 'Organization'
|
||||
Setting.set( 'organization', setting['Value'] )
|
||||
end
|
||||
|
||||
# sending emails
|
||||
if setting['Key'] == 'SendmailModule'
|
||||
# TODO
|
||||
end
|
||||
|
||||
# number generater
|
||||
if setting['Key'] == 'Ticket::NumberGenerator'
|
||||
if setting['Value'] == 'Kernel::System::Ticket::Number::DateChecksum'
|
||||
Setting.set( 'ticket_number', 'Ticket::Number::Date' )
|
||||
Setting.set( 'ticket_number_date', { :checksum => true } )
|
||||
elsif setting['Value'] == 'Kernel::System::Ticket::Number::Date'
|
||||
Setting.set( 'ticket_number', 'Ticket::Number::Date' )
|
||||
Setting.set( 'ticket_number_date', { :checksum => false } )
|
||||
end
|
||||
end
|
||||
|
||||
# ticket hook
|
||||
if setting['Key'] == 'Ticket::Hook'
|
||||
Setting.set( 'ticket_hook', setting['Value'] )
|
||||
end
|
||||
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
# set translate valid ids to active = true|false
|
||||
|
||||
def self._set_valid(record)
|
||||
|
|
|
@ -3,13 +3,20 @@ require 'integration_test_helper'
|
|||
|
||||
class OtrsImportTest < ActiveSupport::TestCase
|
||||
|
||||
# check settings items
|
||||
test 'check settings' do
|
||||
assert_equal( '305', Setting.get('system_id'), 'system_id' )
|
||||
assert_equal( 'vz305.demo.znuny.com', Setting.get('fqdn'), 'fqdn' )
|
||||
assert_equal( 'http', Setting.get('http_type'), 'http_type' )
|
||||
assert_equal( 'Example Company VZ305', Setting.get('organization'), 'organization' )
|
||||
|
||||
end
|
||||
|
||||
# check count of imported items
|
||||
test 'check counts' do
|
||||
#agent_count = User.where()
|
||||
assert_equal( 603, Ticket.count, 'tickets' )
|
||||
assert_equal( 10, Ticket::State.count, 'ticket states' )
|
||||
assert_equal( 24, Group.count, 'groups' )
|
||||
|
||||
end
|
||||
|
||||
# check imported users and permission
|
||||
|
@ -147,6 +154,9 @@ class OtrsImportTest < ActiveSupport::TestCase
|
|||
assert_equal( Time.parse('2014-11-20 22:33:41 +0000').gmtime.to_s, ticket.created_at.to_s )
|
||||
assert_equal( nil, ticket.close_time )
|
||||
|
||||
# check history
|
||||
# create entry
|
||||
|
||||
# ticket is created with state closed
|
||||
ticket = Ticket.find(729)
|
||||
assert_equal( 'test #2', ticket.title )
|
||||
|
@ -159,6 +169,9 @@ class OtrsImportTest < ActiveSupport::TestCase
|
|||
assert_equal( Time.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.created_at.to_s )
|
||||
assert_equal( Time.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.close_time.to_s )
|
||||
|
||||
# check history
|
||||
# create entry
|
||||
|
||||
# ticket is created open and now closed
|
||||
ticket = Ticket.find(730)
|
||||
assert_equal( 'test #3', ticket.title )
|
||||
|
@ -170,5 +183,9 @@ class OtrsImportTest < ActiveSupport::TestCase
|
|||
assert_equal( 'Noch ein betreuter Kunde', ticket.organization.name )
|
||||
assert_equal( Time.parse('2014-11-21 00:17:40 +0000').gmtime.to_s, ticket.created_at.to_s )
|
||||
assert_equal( Time.parse('2014-11-21 00:21:08 +0000').gmtime.to_s, ticket.close_time.to_s )
|
||||
|
||||
# check history
|
||||
# create entry
|
||||
# state change entry
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue