Fixed: error when bulk editing with Postgresql
git-svn-id: http://redmine.rubyforge.org/svn/trunk@866 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
5d1d778ed5
commit
295e8c86ab
|
@ -339,11 +339,11 @@ class ProjectsController < ApplicationController
|
||||||
# Bulk edit issues
|
# Bulk edit issues
|
||||||
def bulk_edit_issues
|
def bulk_edit_issues
|
||||||
if request.post?
|
if request.post?
|
||||||
status = IssueStatus.find_by_id(params[:status_id])
|
status = params[:status_id].blank? ? nil : IssueStatus.find_by_id(params[:status_id])
|
||||||
priority = Enumeration.find_by_id(params[:priority_id])
|
priority = params[:priority_id].blank? ? nil : Enumeration.find_by_id(params[:priority_id])
|
||||||
assigned_to = User.find_by_id(params[:assigned_to_id])
|
assigned_to = params[:assigned_to_id].blank? ? nil : User.find_by_id(params[:assigned_to_id])
|
||||||
category = @project.issue_categories.find_by_id(params[:category_id])
|
category = params[:category_id].blank? ? nil : @project.issue_categories.find_by_id(params[:category_id])
|
||||||
fixed_version = @project.versions.find_by_id(params[:fixed_version_id])
|
fixed_version = params[:fixed_version_id].blank? ? nil : @project.versions.find_by_id(params[:fixed_version_id])
|
||||||
issues = @project.issues.find_all_by_id(params[:issue_ids])
|
issues = @project.issues.find_all_by_id(params[:issue_ids])
|
||||||
unsaved_issue_ids = []
|
unsaved_issue_ids = []
|
||||||
issues.each do |issue|
|
issues.each do |issue|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label><%= l(:field_assigned_to) %>:
|
<label><%= l(:field_assigned_to) %>:
|
||||||
<%= select_tag('assigned_to_id', content_tag('option', l(:label_no_change_option)) +
|
<%= select_tag('assigned_to_id', content_tag('option', l(:label_no_change_option), :value => '') +
|
||||||
content_tag('option', l(:label_nobody), :value => 'none') +
|
content_tag('option', l(:label_nobody), :value => 'none') +
|
||||||
options_from_collection_for_select(@project.assignable_users, :id, :name)) %></label>
|
options_from_collection_for_select(@project.assignable_users, :id, :name)) %></label>
|
||||||
<label><%= l(:field_fixed_version) %>:
|
<label><%= l(:field_fixed_version) %>:
|
||||||
|
|
|
@ -22,7 +22,7 @@ require 'projects_controller'
|
||||||
class ProjectsController; def rescue_action(e) raise e end; end
|
class ProjectsController; def rescue_action(e) raise e end; end
|
||||||
|
|
||||||
class ProjectsControllerTest < Test::Unit::TestCase
|
class ProjectsControllerTest < Test::Unit::TestCase
|
||||||
fixtures :projects, :users, :roles, :enabled_modules
|
fixtures :projects, :users, :roles, :enabled_modules, :enumerations
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@controller = ProjectsController.new
|
@controller = ProjectsController.new
|
||||||
|
@ -87,11 +87,11 @@ class ProjectsControllerTest < Test::Unit::TestCase
|
||||||
def test_bulk_edit_issues
|
def test_bulk_edit_issues
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
# update issues priority
|
# update issues priority
|
||||||
post :bulk_edit_issues, :id => 1, :issue_ids => [1, 2], :priority_id => 7, :notes => "Bulk editing"
|
post :bulk_edit_issues, :id => 1, :issue_ids => [1, 2], :priority_id => 7, :notes => 'Bulk editing', :assigned_to_id => ''
|
||||||
assert_response 302
|
assert_response 302
|
||||||
# check that the issues were updated
|
# check that the issues were updated
|
||||||
assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id}
|
assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id}
|
||||||
assert_equal "Bulk editing", Issue.find(1).journals.last.notes
|
assert_equal 'Bulk editing', Issue.find(1).journals.find(:first, :order => 'created_on DESC').notes
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_list_news
|
def test_list_news
|
||||||
|
|
Loading…
Reference in New Issue