diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-06-15 18:18:24 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-06-15 18:18:24 +0000 |
commit | 755839dad7f6c9447285c478299e0247afded34b (patch) | |
tree | 8408b6b53edb043ef6d451e7b76b1a24431cb329 | |
parent | e7bf4448b9c5d1855e75a4cba0e4bfbe8162236f (diff) | |
download | redmine-755839dad7f6c9447285c478299e0247afded34b.tar.gz redmine-755839dad7f6c9447285c478299e0247afded34b.zip |
Clearing time entry custom fields while bulk editing results in values set to __none__ (#23054).
Patch by Felix Schäfer.
git-svn-id: http://svn.redmine.org/redmine/trunk@15532 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/controllers/timelog_controller.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index 597160191..59efb9d78 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -275,7 +275,16 @@ private 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] + 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 end |