Defect #23054 » 23054-clear_time_entry_custom_fields.patch
| app/controllers/timelog_controller.rb | ||
|---|---|---|
|
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
|
||