Working on issue #368 - OTRS tickets with empty title fail import.
This commit is contained in:
parent
a4f2737286
commit
083d7b6410
2 changed files with 42 additions and 1 deletions
|
@ -66,8 +66,17 @@ module Import
|
||||||
end
|
end
|
||||||
|
|
||||||
def map(ticket)
|
def map(ticket)
|
||||||
|
ensure_map(default_map(ticket))
|
||||||
|
end
|
||||||
|
|
||||||
|
def ensure_map(mapped)
|
||||||
|
return mapped if mapped[:title]
|
||||||
|
mapped[:title] = '**EMPTY**'
|
||||||
|
mapped
|
||||||
|
end
|
||||||
|
|
||||||
|
def default_map(ticket)
|
||||||
{
|
{
|
||||||
title: '',
|
|
||||||
owner_id: owner_id(ticket),
|
owner_id: owner_id(ticket),
|
||||||
customer_id: customer_id(ticket),
|
customer_id: customer_id(ticket),
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
|
|
|
@ -65,4 +65,36 @@ RSpec.describe Import::OTRS::Ticket do
|
||||||
updates_with(zammad_structure)
|
updates_with(zammad_structure)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'no title' do
|
||||||
|
|
||||||
|
let(:object_structure) { load_ticket_json('no_title') }
|
||||||
|
let(:zammad_structure) {
|
||||||
|
{
|
||||||
|
title: '**EMPTY**',
|
||||||
|
owner_id: 1,
|
||||||
|
customer_id: 1,
|
||||||
|
created_by_id: '3',
|
||||||
|
updated_by_id: 1,
|
||||||
|
updated_at: '2014-11-21 00:21:08',
|
||||||
|
created_at: '2014-11-21 00:17:40',
|
||||||
|
number: '20141121305000012',
|
||||||
|
group_id: '1',
|
||||||
|
state_id: '2',
|
||||||
|
priority_id: '3',
|
||||||
|
id: '730',
|
||||||
|
close_at: '2014-11-21 00:21:08'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
it 'creates' do
|
||||||
|
import_backend_expectations
|
||||||
|
creates_with(zammad_structure)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'updates' do
|
||||||
|
import_backend_expectations
|
||||||
|
updates_with(zammad_structure)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue