Project

General

Profile

Defect #23054 » 23054-clear_time_entry_custom_fields.patch

Felix Schäfer, 2016-06-13 11:48

View differences:

app/controllers/timelog_controller.rb
275 275
  def parse_params_for_bulk_time_entry_attributes(params)
276 276
    attributes = (params[:time_entry] || {}).reject {|k,v| v.blank?}
277 277
    attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
278
    attributes[:custom_field_values].reject! {|k,v| v.blank?} if attributes[:custom_field_values]
278
    if custom = attributes[:custom_field_values]
279
      custom.reject! {|k,v| v.blank?}
280
      custom.keys.each do |k|
281
        if custom[k].is_a?(Array)
282
          custom[k] << '' if custom[k].delete('__none__')
283
        else
284
          custom[k] = '' if custom[k] == '__none__'
285
        end
286
      end
287
    end
279 288
    attributes
280 289
  end
281 290
end
    (1-1/1)