diff options
Diffstat (limited to 'app/helpers/issues_helper.rb')
-rw-r--r-- | app/helpers/issues_helper.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index bc7fbab85..614c2f90d 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -261,23 +261,23 @@ module IssuesHelper values_by_field = {} details.each do |detail| if detail.property == 'cf' - field_id = detail.prop_key - field = CustomField.find_by_id(field_id) + field = detail.custom_field if field && field.multiple? - values_by_field[field_id] ||= {:added => [], :deleted => []} + values_by_field[field] ||= {:added => [], :deleted => []} if detail.old_value - values_by_field[field_id][:deleted] << detail.old_value + values_by_field[field][:deleted] << detail.old_value end if detail.value - values_by_field[field_id][:added] << detail.value + values_by_field[field][:added] << detail.value end next end end strings << show_detail(detail, no_html, options) end - values_by_field.each do |field_id, changes| - detail = JournalDetail.new(:property => 'cf', :prop_key => field_id) + values_by_field.each do |field, changes| + detail = JournalDetail.new(:property => 'cf', :prop_key => field.id.to_s) + detail.instance_variable_set "@custom_field", field if changes[:added].any? detail.value = changes[:added] strings << show_detail(detail, no_html, options) @@ -320,7 +320,7 @@ module IssuesHelper old_value = l(detail.old_value == "0" ? :general_text_No : :general_text_Yes) unless detail.old_value.blank? end when 'cf' - custom_field = CustomField.find_by_id(detail.prop_key) + custom_field = detail.custom_field if custom_field multiple = custom_field.multiple? label = custom_field.name |