Fix that updating an issue from context menu to a none value do not set the field to blank (#33521).

Patch by Mizuki ISHIKAWA.

git-svn-id: http://svn.redmine.org/redmine/trunk@21139 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2021-08-05 23:41:01 +00:00
parent 764228370c
commit 7e2f3352db
3 changed files with 38 additions and 2 deletions

View File

@@ -413,10 +413,18 @@ class ApplicationController < ActionController::Base
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|
end
replace_none_values_with_blank(attributes)
end
def replace_none_values_with_blank(params)
attributes = (params || {}))
attributes.each_key {|k| attributes[k] = '' if attributes[k] == 'none'}
if (custom = attributes[:custom_field_values])
custom.each_key do |k|
if custom[k].is_a?(Array)
custom[k] << '' if custom[k].delete('__none__')
else