Defect #10364

Custom field float separator in CSV export

Added by Michael Kling over 5 years ago. Updated over 4 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:I18n
Target version:2.3.0
Resolution:Fixed Affected version:1.3.1

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.

Associated revisions

Revision 11441
Added by Jean-Philippe Lang over 4 years ago

Fixed that float custom fields do not use CSV decimal separator (#10364).

History

#1 Updated by Etienne Massip over 5 years ago

  • Status changed from New to Confirmed
  • Target version set to Candidate for next minor release
  • Affected version (unused) changed from 1.2.0 to 1.3.1
  • Affected version changed from 1.2.0 to 1.3.1

#2 Updated by Michael Kling over 5 years ago

Just realize that it doesnt make sense for integer...

#3 Updated by Jean-Philippe Lang over 4 years ago

  • Subject changed from Custom Field Float Separator in CSV Export to Custom field float separator in CSV export
  • Status changed from Confirmed to Closed
  • Assignee set to Jean-Philippe Lang
  • Target version changed from Candidate for next minor release to 2.3.0
  • Resolution set to Fixed

Fixed in r11441.

Also available in: Atom PDF