Fixed: issues always created with default tracker (#1553).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1610 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
87a16f395a
commit
72076d391e
|
@ -115,7 +115,8 @@ class IssuesController < ApplicationController
|
||||||
@issue = Issue.new
|
@issue = Issue.new
|
||||||
@issue.copy_from(params[:copy_from]) if params[:copy_from]
|
@issue.copy_from(params[:copy_from]) if params[:copy_from]
|
||||||
@issue.project = @project
|
@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?
|
if @issue.tracker.nil?
|
||||||
flash.now[:error] = 'No tracker is associated to this project. Please check the Project settings.'
|
flash.now[:error] = 'No tracker is associated to this project. Please check the Project settings.'
|
||||||
render :nothing => true, :layout => true
|
render :nothing => true, :layout => true
|
||||||
|
|
|
@ -38,3 +38,7 @@ projects_trackers_010:
|
||||||
projects_trackers_011:
|
projects_trackers_011:
|
||||||
project_id: 4
|
project_id: 4
|
||||||
tracker_id: 2
|
tracker_id: 2
|
||||||
|
projects_trackers_012:
|
||||||
|
project_id: 1
|
||||||
|
tracker_id: 3
|
||||||
|
|
|
@ -199,7 +199,7 @@ class IssuesControllerTest < Test::Unit::TestCase
|
||||||
def test_post_new
|
def test_post_new
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
post :new, :project_id => 1,
|
post :new, :project_id => 1,
|
||||||
:issue => {:tracker_id => 1,
|
:issue => {:tracker_id => 3,
|
||||||
:subject => 'This is the test_new issue',
|
:subject => 'This is the test_new issue',
|
||||||
:description => 'This is the description',
|
:description => 'This is the description',
|
||||||
:priority_id => 5,
|
:priority_id => 5,
|
||||||
|
@ -210,6 +210,7 @@ class IssuesControllerTest < Test::Unit::TestCase
|
||||||
issue = Issue.find_by_subject('This is the test_new issue')
|
issue = Issue.find_by_subject('This is the test_new issue')
|
||||||
assert_not_nil issue
|
assert_not_nil issue
|
||||||
assert_equal 2, issue.author_id
|
assert_equal 2, issue.author_id
|
||||||
|
assert_equal 3, issue.tracker_id
|
||||||
assert_nil issue.estimated_hours
|
assert_nil issue.estimated_hours
|
||||||
v = issue.custom_values.find_by_custom_field_id(2)
|
v = issue.custom_values.find_by_custom_field_id(2)
|
||||||
assert_not_nil v
|
assert_not_nil v
|
||||||
|
|
Loading…
Reference in New Issue