summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-11-27 12:14:20 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-11-27 12:14:20 +0000
commita79e0fa5f63c9078641d52a3cb5de50977f8a7e8 (patch)
treeeafb0fd08a10b09abe46f6aa1401305291b37719 /app/helpers
parent88231f460fb1aadfc338a38e43efe99a500f9073 (diff)
downloadredmine-a79e0fa5f63c9078641d52a3cb5de50977f8a7e8.tar.gz
redmine-a79e0fa5f63c9078641d52a3cb5de50977f8a7e8.zip
fix csv decimal separator of time entry csv (#8368)
Contributed by Francisco José Martínez. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7950 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/timelog_helper.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb
index c5559db25..0467acc21 100644
--- a/app/helpers/timelog_helper.rb
+++ b/app/helpers/timelog_helper.rb
@@ -142,6 +142,7 @@ module TimelogHelper
end
def report_to_csv(criterias, periods, hours)
+ decimal_separator = l(:general_csv_decimal_separator)
export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv|
# Column headers
headers = criterias.collect {|criteria| l(@available_criterias[criteria][:label]) }
@@ -159,15 +160,16 @@ module TimelogHelper
periods.each do |period|
sum = sum_hours(select_hours(hours, @columns, period.to_s))
total += sum
- row << (sum > 0 ? "%.2f" % sum : '')
+ row << (sum > 0 ? ("%.2f" % sum).gsub('.',decimal_separator) : '')
end
- row << "%.2f" %total
+ row << ("%.2f" % total).gsub('.',decimal_separator)
csv << row
end
export
end
def report_criteria_to_csv(csv, criterias, periods, hours, level=0)
+ decimal_separator = l(:general_csv_decimal_separator)
hours.collect {|h| h[criterias[level]].to_s}.uniq.each do |value|
hours_for_value = select_hours(hours, criterias[level], value)
next if hours_for_value.empty?
@@ -180,11 +182,10 @@ module TimelogHelper
periods.each do |period|
sum = sum_hours(select_hours(hours_for_value, @columns, period.to_s))
total += sum
- row << (sum > 0 ? "%.2f" % sum : '')
+ row << (sum > 0 ? ("%.2f" % sum).gsub('.',decimal_separator) : '')
end
- row << "%.2f" %total
+ row << ("%.2f" % total).gsub('.',decimal_separator)
csv << row
-
if criterias.length > level + 1
report_criteria_to_csv(csv, criterias, periods, hours_for_value, level + 1)
end