Merge branch 'develop' of github.com:martini/zammad into develop
This commit is contained in:
commit
edf565bd4d
1 changed files with 20 additions and 11 deletions
|
@ -22,9 +22,7 @@ class ImportOtrsController < ApplicationController
|
||||||
'Connection refused' => 'Connection refused!',
|
'Connection refused' => 'Connection refused!',
|
||||||
}
|
}
|
||||||
|
|
||||||
url_parts = params[:url].split(';')
|
response = UserAgent.request( params[:url] )
|
||||||
|
|
||||||
response = UserAgent.request( url_parts[0] )
|
|
||||||
|
|
||||||
if !response.success? && response.code.to_s !~ /^40.$/
|
if !response.success? && response.code.to_s !~ /^40.$/
|
||||||
message_human = ''
|
message_human = ''
|
||||||
|
@ -44,6 +42,11 @@ class ImportOtrsController < ApplicationController
|
||||||
result = {}
|
result = {}
|
||||||
if response.body =~ /zammad migrator/
|
if response.body =~ /zammad migrator/
|
||||||
|
|
||||||
|
migrator_response = JSON.parse(response.body)
|
||||||
|
|
||||||
|
if migrator_response['Success'] == 1
|
||||||
|
|
||||||
|
url_parts = params[:url].split(';')
|
||||||
key_parts = url_parts[1].split('=')
|
key_parts = url_parts[1].split('=')
|
||||||
|
|
||||||
Setting.set('import_backend', 'otrs')
|
Setting.set('import_backend', 'otrs')
|
||||||
|
@ -54,6 +57,12 @@ class ImportOtrsController < ApplicationController
|
||||||
result: 'ok',
|
result: 'ok',
|
||||||
url: params[:url],
|
url: params[:url],
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
result = {
|
||||||
|
result: 'invalid',
|
||||||
|
message_human: migrator_response['Error']
|
||||||
|
}
|
||||||
|
end
|
||||||
elsif response.body =~ /(otrs\sag|otrs\.com|otrs\.org)/i
|
elsif response.body =~ /(otrs\sag|otrs\.com|otrs\.org)/i
|
||||||
result = {
|
result = {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
|
|
Loading…
Reference in a new issue