diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index 801649dd..bbb6deb2 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -500,11 +500,7 @@ class DmsfFile < ActiveRecord::Base def custom_value(custom_field) last_revision.custom_field_values.each do |cv| if cv.custom_field == custom_field - if cv.value.is_a? Array - return cv.value.reject{ |x| x.empty? }.join(',') - else - return cv.value - end + return cv end end nil @@ -584,7 +580,7 @@ class DmsfFile < ActiveRecord::Base end # Custom fields CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| - csv << custom_value(c) if columns.include?(c.name) + csv << custom_value(c).value if columns.include?(c.name) end csv end diff --git a/app/models/dmsf_folder.rb b/app/models/dmsf_folder.rb index 016f49de..42592636 100644 --- a/app/models/dmsf_folder.rb +++ b/app/models/dmsf_folder.rb @@ -348,7 +348,9 @@ class DmsfFolder < ActiveRecord::Base def custom_value(custom_field) custom_field_values.each do |cv| - return cv.value if cv.custom_field == custom_field + if cv.custom_field == custom_field + return cv + end end nil end @@ -475,7 +477,7 @@ class DmsfFolder < ActiveRecord::Base csv << '' if columns.include?(l(:label_last_revision_id)) # Custom fields CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| - csv << custom_value(c) if columns.include?(c.name) + csv << custom_value(c).value if columns.include?(c.name) end csv end diff --git a/app/views/dmsf/_dir.html.erb b/app/views/dmsf/_dir.html.erb index 5085a21f..c943fd7b 100644 --- a/app/views/dmsf/_dir.html.erb +++ b/app/views/dmsf/_dir.html.erb @@ -75,7 +75,7 @@ <% CustomField.where(type: 'DmsfFileRevisionCustomField').order(:position).each do |c| %> <% if DmsfFolder.is_column_on?(c.name) %>