]> source.dussan.org Git - redmine.git/commitdiff
Clearing time entry custom fields while bulk editing results in values set to __none_...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 15 Jun 2016 18:18:24 +0000 (18:18 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 15 Jun 2016 18:18:24 +0000 (18:18 +0000)
Patch by Felix Schäfer.

git-svn-id: http://svn.redmine.org/redmine/trunk@15532 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/timelog_controller.rb

index 597160191ee4eebf3c9cc4365268ee84b6c918fe..59efb9d7808cd291be1b70d1b7a0612cc24d81c6 100644 (file)
@@ -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