summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-06-18 06:01:43 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-06-18 06:01:43 +0000
commit89cfe130fc0498e66a65e133ac6efdcedc0389be (patch)
tree8c580cceef06997ffb4d2e8f127573cd78d3d360 /app
parent446b3bfaca6f93b3b87f11b597e25039c00af690 (diff)
downloadredmine-89cfe130fc0498e66a65e133ac6efdcedc0389be.tar.gz
redmine-89cfe130fc0498e66a65e133ac6efdcedc0389be.zip
Merged r15532 to r15534 (#23054).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@15537 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application_controller.rb16
-rw-r--r--app/controllers/issues_controller.rb18
-rw-r--r--app/controllers/timelog_controller.rb9
3 files changed, 18 insertions, 25 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 48ad635e8..f998be775 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -352,6 +352,22 @@ class ApplicationController < ActionController::Base
@attachments = att || []
end
+ def parse_params_for_bulk_update(params)
+ attributes = (params || {}).reject {|k,v| v.blank?}
+ attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
+ if custom = attributes[:custom_field_values]
+ custom.reject! {|k,v| v.blank?}
+ custom.keys.each do |k|
+ if custom[k].is_a?(Array)
+ custom[k] << '' if custom[k].delete('__none__')
+ else
+ custom[k] = '' if custom[k] == '__none__'
+ end
+ end
+ end
+ attributes
+ end
+
# make sure that the user is a member of the project (or admin) if project is private
# used as a before_filter for actions that do not require any particular permission on the project
def check_project_privacy
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 95c58674c..b842023a7 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -252,7 +252,7 @@ class IssuesController < ApplicationController
@issues.sort!
@copy = params[:copy].present?
- attributes = parse_params_for_bulk_issue_attributes(params)
+ attributes = parse_params_for_bulk_update(params[:issue])
copy_subtasks = (params[:copy_subtasks] == '1')
copy_attachments = (params[:copy_attachments] == '1')
@@ -495,22 +495,6 @@ class IssuesController < ApplicationController
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
end
- def parse_params_for_bulk_issue_attributes(params)
- attributes = (params[:issue] || {}).reject {|k,v| v.blank?}
- attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
- if custom = attributes[:custom_field_values]
- custom.reject! {|k,v| v.blank?}
- custom.keys.each do |k|
- if custom[k].is_a?(Array)
- custom[k] << '' if custom[k].delete('__none__')
- else
- custom[k] = '' if custom[k] == '__none__'
- end
- end
- end
- attributes
- end
-
# Saves @issue and a time_entry from the parameters
def save_issue_with_child_records
Issue.transaction do
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb
index 597160191..66ae97678 100644
--- a/app/controllers/timelog_controller.rb
+++ b/app/controllers/timelog_controller.rb
@@ -174,7 +174,7 @@ class TimelogController < ApplicationController
end
def bulk_update
- attributes = parse_params_for_bulk_time_entry_attributes(params)
+ attributes = parse_params_for_bulk_update(params[:time_entry])
unsaved_time_entry_ids = []
@time_entries.each do |time_entry|
@@ -271,11 +271,4 @@ private
end
scope
end
-
- def parse_params_for_bulk_time_entry_attributes(params)
- attributes = (params[:time_entry] || {}).reject {|k,v| v.blank?}
- attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
- attributes[:custom_field_values].reject! {|k,v| v.blank?} if attributes[:custom_field_values]
- attributes
- end
end