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

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1610 e93f8b46-1217-0410-a6f0-8f06a7374b81
pull/351/head
Jean-Philippe Lang 17 years ago
parent 87a16f395a
commit 72076d391e
  1. 3
      app/controllers/issues_controller.rb
  2. 4
      test/fixtures/projects_trackers.yml
  3. 3
      test/functional/issues_controller_test.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

@ -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

@ -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

Loading…
Cancel
Save