##// END OF EJS Templates
Fixed: error when bulk editing with Postgresql...
Jean-Philippe Lang -
r853:295e8c86ab8c
parent child
Show More
@@ -339,11 +339,11 class ProjectsController < ApplicationController
339 # Bulk edit issues
339 # Bulk edit issues
340 def bulk_edit_issues
340 def bulk_edit_issues
341 if request.post?
341 if request.post?
342 status = IssueStatus.find_by_id(params[:status_id])
342 status = params[:status_id].blank? ? nil : IssueStatus.find_by_id(params[:status_id])
343 priority = Enumeration.find_by_id(params[:priority_id])
343 priority = params[:priority_id].blank? ? nil : Enumeration.find_by_id(params[:priority_id])
344 assigned_to = User.find_by_id(params[:assigned_to_id])
344 assigned_to = params[:assigned_to_id].blank? ? nil : User.find_by_id(params[:assigned_to_id])
345 category = @project.issue_categories.find_by_id(params[:category_id])
345 category = params[:category_id].blank? ? nil : @project.issue_categories.find_by_id(params[:category_id])
346 fixed_version = @project.versions.find_by_id(params[:fixed_version_id])
346 fixed_version = params[:fixed_version_id].blank? ? nil : @project.versions.find_by_id(params[:fixed_version_id])
347 issues = @project.issues.find_all_by_id(params[:issue_ids])
347 issues = @project.issues.find_all_by_id(params[:issue_ids])
348 unsaved_issue_ids = []
348 unsaved_issue_ids = []
349 issues.each do |issue|
349 issues.each do |issue|
@@ -13,7 +13,7
13 </p>
13 </p>
14 <p>
14 <p>
15 <label><%= l(:field_assigned_to) %>:
15 <label><%= l(:field_assigned_to) %>:
16 <%= select_tag('assigned_to_id', content_tag('option', l(:label_no_change_option)) +
16 <%= select_tag('assigned_to_id', content_tag('option', l(:label_no_change_option), :value => '') +
17 content_tag('option', l(:label_nobody), :value => 'none') +
17 content_tag('option', l(:label_nobody), :value => 'none') +
18 options_from_collection_for_select(@project.assignable_users, :id, :name)) %></label>
18 options_from_collection_for_select(@project.assignable_users, :id, :name)) %></label>
19 <label><%= l(:field_fixed_version) %>:
19 <label><%= l(:field_fixed_version) %>:
@@ -22,7 +22,7 require 'projects_controller'
22 class ProjectsController; def rescue_action(e) raise e end; end
22 class ProjectsController; def rescue_action(e) raise e end; end
23
23
24 class ProjectsControllerTest < Test::Unit::TestCase
24 class ProjectsControllerTest < Test::Unit::TestCase
25 fixtures :projects, :users, :roles, :enabled_modules
25 fixtures :projects, :users, :roles, :enabled_modules, :enumerations
26
26
27 def setup
27 def setup
28 @controller = ProjectsController.new
28 @controller = ProjectsController.new
@@ -87,11 +87,11 class ProjectsControllerTest < Test::Unit::TestCase
87 def test_bulk_edit_issues
87 def test_bulk_edit_issues
88 @request.session[:user_id] = 2
88 @request.session[:user_id] = 2
89 # update issues priority
89 # update issues priority
90 post :bulk_edit_issues, :id => 1, :issue_ids => [1, 2], :priority_id => 7, :notes => "Bulk editing"
90 post :bulk_edit_issues, :id => 1, :issue_ids => [1, 2], :priority_id => 7, :notes => 'Bulk editing', :assigned_to_id => ''
91 assert_response 302
91 assert_response 302
92 # check that the issues were updated
92 # check that the issues were updated
93 assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id}
93 assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id}
94 assert_equal "Bulk editing", Issue.find(1).journals.last.notes
94 assert_equal 'Bulk editing', Issue.find(1).journals.find(:first, :order => 'created_on DESC').notes
95 end
95 end
96
96
97 def test_list_news
97 def test_list_news
General Comments 0
You need to be logged in to leave comments. Login now