diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-06-30 17:57:53 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-06-30 17:57:53 +0000 |
commit | 72076d391e44f7510365b13491c624ac9404f7a6 (patch) | |
tree | a854f3ecccada32b5118404e1bfb55dd7e83867e | |
parent | 87a16f395a754ff3bb703322e714af47705faeaa (diff) | |
download | redmine-72076d391e44f7510365b13491c624ac9404f7a6.tar.gz redmine-72076d391e44f7510365b13491c624ac9404f7a6.zip |
Fixed: issues always created with default tracker (#1553).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1610 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/controllers/issues_controller.rb | 3 | ||||
-rw-r--r-- | test/fixtures/projects_trackers.yml | 4 | ||||
-rw-r--r-- | test/functional/issues_controller_test.rb | 3 |
3 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index e844d242f..6014116b3 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -115,7 +115,8 @@ class IssuesController < ApplicationController @issue = Issue.new @issue.copy_from(params[:copy_from]) if params[:copy_from] @issue.project = @project - @issue.tracker ||= @project.trackers.find(params[:tracker_id] ? params[:tracker_id] : :first) + # Tracker must be set before custom field values + @issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first) if @issue.tracker.nil? flash.now[:error] = 'No tracker is associated to this project. Please check the Project settings.' render :nothing => true, :layout => true diff --git a/test/fixtures/projects_trackers.yml b/test/fixtures/projects_trackers.yml index 8eb7d85ab..31f7f943a 100644 --- a/test/fixtures/projects_trackers.yml +++ b/test/fixtures/projects_trackers.yml @@ -38,3 +38,7 @@ projects_trackers_010: projects_trackers_011: project_id: 4 tracker_id: 2 +projects_trackers_012: + project_id: 1 + tracker_id: 3 +
\ No newline at end of file diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index ac1f4f834..22f9a3baf 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -199,7 +199,7 @@ class IssuesControllerTest < Test::Unit::TestCase def test_post_new @request.session[:user_id] = 2 post :new, :project_id => 1, - :issue => {:tracker_id => 1, + :issue => {:tracker_id => 3, :subject => 'This is the test_new issue', :description => 'This is the description', :priority_id => 5, @@ -210,6 +210,7 @@ class IssuesControllerTest < Test::Unit::TestCase issue = Issue.find_by_subject('This is the test_new issue') assert_not_nil issue assert_equal 2, issue.author_id + assert_equal 3, issue.tracker_id assert_nil issue.estimated_hours v = issue.custom_values.find_by_custom_field_id(2) assert_not_nil v |