Fixed generic object_lookup(). For Roy, 'refs 123'.

This commit is contained in:
Martin Edenhofer 2012-11-07 17:38:09 +01:00
parent 3525ad79a9
commit f57e15e984

View file

@ -386,7 +386,7 @@ class Channel::EmailParser
end end
end end
# execute ticket events # execute ticket events
Ticket::Observer::Notification.transaction Ticket::Observer::Notification.transaction
# run postmaster post filter # run postmaster post filter
@ -407,12 +407,13 @@ class Channel::EmailParser
# return new objects # return new objects
return ticket, article, user return ticket, article, user
end end
def object_lookup( attributes, map, mail ) def object_lookup( attributes, map, mail )
map.each { |item| map.each { |item|
if mail[ item[0].to_sym ] if mail[ item[0].to_sym ]
if item[1].where( item[3].to_sym => mail[ item[0].to_sym ] ).first new_object = item[1].where( "lower(#{item[3]}) = ?", mail[ item[0].to_sym ].downcase ).first
attributes[ item[2].to_sym ] = item[1].where( "lower(#{item[3]}) = ?", mail[ item[0].to_sym ].downcase ).first.id if new_object
attributes[ item[2].to_sym ] = new_object.id
end end
end end
} }