OTRS 3.1 approved.

This commit is contained in:
Martin Edenhofer 2015-04-10 21:22:04 +02:00
parent e383dcb97a
commit b4eb49ab57

View file

@ -510,6 +510,9 @@ module Import::OTRS2
result.each {|record|
# cleanup values
_cleanup(record)
ticket_new = {
:title => '',
:created_by_id => 1,
@ -680,7 +683,7 @@ module Import::OTRS2
#puts "HS: #{record['History'].inspect}"
record['History'].each { |history|
if history['HistoryType'] == 'NewTicket'
puts "HS.add( #{history.inspect} )"
#puts "HS.add( #{history.inspect} )"
res = History.add(
:id => history['HistoryID'],
:o_id => history['TicketID'],
@ -689,7 +692,7 @@ module Import::OTRS2
:created_at => history['CreateTime'],
:created_by_id => history['CreateBy']
)
puts "res #{res.inspect}"
#puts "res #{res.inspect}"
end
if history['HistoryType'] == 'StateUpdate'
data = history['Name']
@ -1243,4 +1246,19 @@ module Import::OTRS2
record['ValidID'] = true
end
end
# cleanup invalid values
def self._cleanup(record)
record.each {|key, value|
if value == '0000-00-00 00:00:00'
record[key] = nil
end
}
# fix OTRS 3.1 bug, no close time if ticket is created
if record['StateType'] == 'closed' && ( !record['Closed'] || record['Closed'].empty? )
record['Closed'] = record['Created']
end
end
end