Improved error handling.

This commit is contained in:
Martin Edenhofer 2015-02-12 00:04:46 +01:00
parent 4cc37fe336
commit edea39d431

View file

@ -971,6 +971,12 @@ module Import::OTRS2
# check if agent already exists
user_old = User.where( :id => user_new[:id] ).first
# check if login is already used
login_in_use = User.where( "login = ? AND id != #{user_new[:id]}", user_new[:login].downcase ).count
if login_in_use > 0
user_new[:login] = "#{user_new[:login]}_#{user_new[:id]}"
end
# create / update agent
if user_old
puts "update User.find(#{user_old[:id]})"