summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-10-23 17:15:00 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-10-23 17:15:00 +0000
commit295e8c86ab8c7ad19dff2038dc7cda106551e143 (patch)
treeadc102e73c4d3fac58cc5410564b91f05132a81d
parent5d1d778ed5aec1506f9ba08f8fca54f2e98ee1dc (diff)
downloadredmine-295e8c86ab8c7ad19dff2038dc7cda106551e143.tar.gz
redmine-295e8c86ab8c7ad19dff2038dc7cda106551e143.zip
Fixed: error when bulk editing with Postgresql
git-svn-id: http://redmine.rubyforge.org/svn/trunk@866 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/controllers/projects_controller.rb10
-rw-r--r--app/views/issues/_bulk_edit_form.rhtml2
-rw-r--r--test/functional/projects_controller_test.rb6
3 files changed, 9 insertions, 9 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 960255263..377073fc9 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -339,11 +339,11 @@ class ProjectsController < ApplicationController
# Bulk edit issues
def bulk_edit_issues
if request.post?
- status = IssueStatus.find_by_id(params[:status_id])
- priority = Enumeration.find_by_id(params[:priority_id])
- assigned_to = User.find_by_id(params[:assigned_to_id])
- category = @project.issue_categories.find_by_id(params[:category_id])
- fixed_version = @project.versions.find_by_id(params[:fixed_version_id])
+ status = params[:status_id].blank? ? nil : IssueStatus.find_by_id(params[:status_id])
+ priority = params[:priority_id].blank? ? nil : Enumeration.find_by_id(params[:priority_id])
+ assigned_to = params[:assigned_to_id].blank? ? nil : User.find_by_id(params[:assigned_to_id])
+ category = params[:category_id].blank? ? nil : @project.issue_categories.find_by_id(params[:category_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])
unsaved_issue_ids = []
issues.each do |issue|
diff --git a/app/views/issues/_bulk_edit_form.rhtml b/app/views/issues/_bulk_edit_form.rhtml
index 6ed947428..bc3f62e6d 100644
--- a/app/views/issues/_bulk_edit_form.rhtml
+++ b/app/views/issues/_bulk_edit_form.rhtml
@@ -13,7 +13,7 @@
</p>
<p>
<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') +
options_from_collection_for_select(@project.assignable_users, :id, :name)) %></label>
<label><%= l(:field_fixed_version) %>:
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index e9ffa3023..b7d7962b6 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -22,7 +22,7 @@ require 'projects_controller'
class ProjectsController; def rescue_action(e) raise e end; end
class ProjectsControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :roles, :enabled_modules
+ fixtures :projects, :users, :roles, :enabled_modules, :enumerations
def setup
@controller = ProjectsController.new
@@ -87,11 +87,11 @@ class ProjectsControllerTest < Test::Unit::TestCase
def test_bulk_edit_issues
@request.session[:user_id] = 2
# 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
# check that the issues were updated
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
def test_list_news