diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb index f3fcc1fc5..f75c89382 100644 --- a/app/helpers/custom_fields_helper.rb +++ b/app/helpers/custom_fields_helper.rb @@ -95,15 +95,7 @@ module CustomFieldsHelper # Return a string used to display a custom value def format_value(value, field_format) - return "" unless value && !value.empty? - case field_format - when "date" - begin; format_date(value.to_date); rescue; value end - when "bool" - l(value == "1" ? :general_text_Yes : :general_text_No) - else - value - end + Redmine::CustomFieldFormat.format_value(value, field_format) # Proxy end # Return an array of custom field formats which can be used in select_tag diff --git a/lib/redmine/custom_field_format.rb b/lib/redmine/custom_field_format.rb index 6d42dfba6..29d82b446 100644 --- a/lib/redmine/custom_field_format.rb +++ b/lib/redmine/custom_field_format.rb @@ -61,6 +61,18 @@ module Redmine [ l(custom_field_format.label), custom_field_format.name ] } end + + def format_value(value, field_format) + return "" unless value && !value.empty? + case field_format + when "date" + begin; format_date(value.to_date); rescue; value end + when "bool" + l(value == "1" ? :general_text_Yes : :general_text_No) + else + value + end + end end end end