diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-08-25 15:45:12 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-08-25 15:45:12 +0000 |
commit | f44f6c7876b0f8ad152e2d9ba7308ee41e75af14 (patch) | |
tree | 017dcaebbc767b39104cf19524793c7e9f679b22 | |
parent | 4dad4fab509718bc1edafd9b77ac036b78aca61d (diff) | |
download | redmine-f44f6c7876b0f8ad152e2d9ba7308ee41e75af14.tar.gz redmine-f44f6c7876b0f8ad152e2d9ba7308ee41e75af14.zip |
Mantis importer:
* validation skip on issue assignement (assignee must be a project member in Redmine)
* Mantis bugs with severity 'feature' are imported as 'Feature request' in Redmine
git-svn-id: http://redmine.rubyforge.org/svn/trunk@660 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | lib/tasks/migrate_from_mantis.rake | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/tasks/migrate_from_mantis.rake b/lib/tasks/migrate_from_mantis.rake index 971bcf43d..14aa2f463 100644 --- a/lib/tasks/migrate_from_mantis.rake +++ b/lib/tasks/migrate_from_mantis.rake @@ -49,7 +49,8 @@ task :migrate_from_mantis => :environment do 60 => priorities[5] # immediate
}
- TARGET_TRACKER = Tracker.find :first
+ TRACKER_BUG = Tracker.find_by_position(1)
+ TRACKER_FEATURE = Tracker.find_by_position(2)
DEFAULT_ROLE = Role.find_by_position(3)
manager_role = Role.find_by_position(1)
@@ -309,14 +310,20 @@ task :migrate_from_mantis => :environment do :created_on => bug.date_submitted,
:updated_on => bug.last_updated
i.author = User.find_by_id(users_map[bug.reporter_id])
- i.assigned_to = User.find_by_id(users_map[bug.handler_id]) if bug.handler_id && users_map[bug.handler_id]
i.category = IssueCategory.find_by_project_id_and_name(i.project_id, bug.category) unless bug.category.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 = TARGET_TRACKER
+ i.tracker = (bug.severity == 10 ? TRACKER_FEATURE : TRACKER_BUG)
next unless i.save
issues_map[bug.id] = i.id
print '.'
+
+ # Assignee
+ # Redmine checks that the assignee is a project member
+ if (bug.handler_id && users_map[bug.handler_id])
+ i.assigned_to = User.find_by_id(users_map[bug.handler_id])
+ i.save_with_validation(false)
+ end
# Bug notes
bug.bug_notes.each do |note|
|