Project

General

Profile

Actions

Defect #10364

closed

Custom field float separator in CSV export

Added by Michael Kling over 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Normal
Category:
I18n
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

We are using custom fields in the time entries of type float.

Using german language we noticed that the decimal separator in csv exports are not changed! (Also not for the time itself but i could solve that with #8368.

For the custom fields i could fix it in this way:

In /lib/redmine/custom_field_format.rb find this (Around line 47)

    ['string','text','int','float','list'].each do |name|
      define_method("format_as_#{name}") {|value|
        return value
      }
    end

and replace it with:
    def format_as_float(value)
     decimal_separator = l(:general_csv_decimal_separator)
     return ("%.2f" % value).gsub('.',decimal_separator)
    end

    def format_as_int(value) 
     decimal_separator = l(:general_csv_decimal_separator)
     return ("%.2f" % value).gsub('.',decimal_separator)
    end

    ['string','text','list'].each do |name|
      define_method("format_as_#{name}") {|value|
        return value
      }
    end

It's working but i don't know if this was the right place.

Actions

Also available in: Atom PDF