Project

General

Profile

Patch #18496 » migrate_mantis_1.2.17_to_redmine_2.5.3.patch

Patch file - Gergely Révész, 2014-11-28 15:00

View differences:

migrate_from_mantis.rake.working2 2014-11-28 14:14:47.161757970 +0100
require 'active_record'
require 'iconv' if RUBY_VERSION < '1.9'
require 'pp'
require 'date'
namespace :redmine do
task :migrate_from_mantis => :environment do
......
end
class MantisCategory < ActiveRecord::Base
self.table_name = :mantis_project_category_table
self.table_name = :mantis_category_table
end
class MantisProjectUser < ActiveRecord::Base
......
:subject => encode(bug.summary),
:description => encode(bug.bug_text.full_description),
:priority => PRIORITY_MAPPING[bug.priority] || DEFAULT_PRIORITY,
:created_on => bug.date_submitted,
:updated_on => bug.last_updated
:created_on => Time.at(bug.date_submitted).to_datetime,
:updated_on => Time.at(bug.last_updated).to_datetime
i.author = User.find_by_id(users_map[bug.reporter_id])
i.category = IssueCategory.find_by_project_id_and_name(i.project_id, bug.category[0,30]) unless bug.category.blank?
i.category = IssueCategory.find_by_project_id_and_name(i.project_id, bug.category_id[0]) unless bug.category_id.blank?
i.fixed_version = Version.find_by_project_id_and_name(i.project_id, bug.fixed_in_version) unless bug.fixed_in_version.blank?
i.status = STATUS_MAPPING[bug.status] || DEFAULT_STATUS
i.tracker = (bug.severity == 10 ? TRACKER_FEATURE : TRACKER_BUG)
......
bug.bug_notes.each do |note|
next unless users_map[note.reporter_id]
n = Journal.new :notes => encode(note.bug_note_text.note),
:created_on => note.date_submitted
:created_on => Time.at(note.date_submitted).to_datetime
n.user = User.find_by_id(users_map[note.reporter_id])
n.journalized = i
n.save
......
# Bug files
bug.bug_files.each do |file|
a = Attachment.new :created_on => file.date_added
a = Attachment.new
a = Attachment.new :created_on => Time.at(file.date_added).to_datetime
a.file = file
a.author = User.first
a.container = i
(1-1/2)