Merge branch 'develop' of git.znuny.com:zammad/zammad into develop
This commit is contained in:
commit
d797a952e6
1 changed files with 20 additions and 11 deletions
|
@ -632,13 +632,20 @@ module Import::OTRS
|
||||||
ticket_new.delete(:owner)
|
ticket_new.delete(:owner)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
record['Articles'].each { |article|
|
||||||
|
# utf8 encode
|
||||||
|
_utf8_encode(article)
|
||||||
|
# lookup customers to create first
|
||||||
|
_article_based_customers(article)
|
||||||
|
}
|
||||||
|
|
||||||
# find customer
|
# find customer
|
||||||
if ticket_new[:customer]
|
if ticket_new[:customer]
|
||||||
user = User.lookup(login: ticket_new[:customer].downcase)
|
user = User.lookup(login: ticket_new[:customer].downcase)
|
||||||
ticket_new[:customer_id] = if user
|
ticket_new[:customer_id] = if user
|
||||||
user.id
|
user.id
|
||||||
else
|
else
|
||||||
1
|
_first_customer_id(record['Articles'])
|
||||||
end
|
end
|
||||||
ticket_new.delete(:customer)
|
ticket_new.delete(:customer)
|
||||||
else
|
else
|
||||||
|
@ -664,16 +671,6 @@ module Import::OTRS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# utf8 encode
|
|
||||||
record['Articles'].each { |article|
|
|
||||||
_utf8_encode(article)
|
|
||||||
}
|
|
||||||
|
|
||||||
# lookup customers to create first
|
|
||||||
record['Articles'].each { |article|
|
|
||||||
_article_based_customers(article)
|
|
||||||
}
|
|
||||||
|
|
||||||
record['Articles'].each do |article|
|
record['Articles'].each do |article|
|
||||||
|
|
||||||
retries = 3
|
retries = 3
|
||||||
|
@ -1598,4 +1595,16 @@ module Import::OTRS
|
||||||
%w(ProcessManagementProcessID ProcessManagementActivityID ZammadMigratorChanged ZammadMigratorChangedOld)
|
%w(ProcessManagementProcessID ProcessManagementActivityID ZammadMigratorChanged ZammadMigratorChangedOld)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self._first_customer_id(articles)
|
||||||
|
user_id = 1
|
||||||
|
articles.each { |article|
|
||||||
|
next if article['sender'] != 'customer'
|
||||||
|
next if article['from'].empty?
|
||||||
|
|
||||||
|
user_id = article['created_by_id'].to_i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
user_id
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue