Commit 7d7682ba authored by jplang's avatar jplang
Browse files

Fixed: issues always created with default tracker (#1553).

git-svn-id: https://svn.redmine.org/redmine/trunk@1610 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent ce02df9c
......@@ -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
......
......@@ -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
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment