Fixed that Trac importer was creating duplicate custom values (#2506).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2280 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
08304afe54
commit
a4882467cb
|
@ -464,7 +464,6 @@ namespace :redmine do
|
||||||
i.fixed_version = version_map[ticket.milestone] unless ticket.milestone.blank?
|
i.fixed_version = version_map[ticket.milestone] unless ticket.milestone.blank?
|
||||||
i.status = STATUS_MAPPING[ticket.status] || DEFAULT_STATUS
|
i.status = STATUS_MAPPING[ticket.status] || DEFAULT_STATUS
|
||||||
i.tracker = TRACKER_MAPPING[ticket.ticket_type] || DEFAULT_TRACKER
|
i.tracker = TRACKER_MAPPING[ticket.ticket_type] || DEFAULT_TRACKER
|
||||||
i.custom_values << CustomValue.new(:custom_field => custom_field_map['resolution'], :value => ticket.resolution) unless ticket.resolution.blank?
|
|
||||||
i.id = ticket.id unless Issue.exists?(ticket.id)
|
i.id = ticket.id unless Issue.exists?(ticket.id)
|
||||||
next unless Time.fake(ticket.changetime) { i.save }
|
next unless Time.fake(ticket.changetime) { i.save }
|
||||||
TICKET_MAP[ticket.id] = i.id
|
TICKET_MAP[ticket.id] = i.id
|
||||||
|
@ -516,14 +515,18 @@ namespace :redmine do
|
||||||
end
|
end
|
||||||
|
|
||||||
# Custom fields
|
# Custom fields
|
||||||
ticket.customs.each do |custom|
|
custom_values = ticket.customs.inject({}) do |h, custom|
|
||||||
next if custom_field_map[custom.name].nil?
|
if custom_field = custom_field_map[custom.name]
|
||||||
v = CustomValue.new :custom_field => custom_field_map[custom.name],
|
h[custom_field.id] = custom.value
|
||||||
:value => custom.value
|
|
||||||
v.customized = i
|
|
||||||
next unless v.save
|
|
||||||
migrated_custom_values += 1
|
migrated_custom_values += 1
|
||||||
end
|
end
|
||||||
|
h
|
||||||
|
end
|
||||||
|
if custom_field_map['resolution'] && !ticket.resolution.blank?
|
||||||
|
custom_values[custom_field_map['resolution'].id] = ticket.resolution
|
||||||
|
end
|
||||||
|
i.custom_field_values = custom_values
|
||||||
|
i.save_custom_field_values
|
||||||
end
|
end
|
||||||
|
|
||||||
# update issue id sequence if needed (postgresql)
|
# update issue id sequence if needed (postgresql)
|
||||||
|
|
Loading…
Reference in New Issue