From 8d00aaac36b13e872b27848d6ccc0c970497def8 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Sat, 2 Nov 2024 20:55:26 +0800 Subject: [PATCH] Bug 799454 - Numeric value in exported CSV transactions --- .../csv-exp/csv-transactions-export.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/gnucash/import-export/csv-exp/csv-transactions-export.cpp b/gnucash/import-export/csv-exp/csv-transactions-export.cpp index f8517684f06..15e1f2531f1 100644 --- a/gnucash/import-export/csv-exp/csv-transactions-export.cpp +++ b/gnucash/import-export/csv-exp/csv-transactions-export.cpp @@ -158,12 +158,26 @@ get_commodity (Transaction *trans) return gnc_commodity_get_unique_name (xaccTransGetCurrency (trans)); } +static GNCPrintAmountInfo number_pinfo = +{ + .commodity = nullptr, + .max_decimal_places = 8, + .min_decimal_places = 0, + .use_separators = 0, + .use_symbol = 0, + .use_locale = 0, + .monetary = 0, + .force_fit = 0, + .round = 0 +}; + // Amount with Symbol or not static std::string get_amount (Split *split, bool t_void, bool symbol) { auto amt_num{t_void ? xaccSplitVoidFormerAmount (split) : xaccSplitGetAmount (split)}; - return xaccPrintAmount (amt_num, gnc_split_amount_print_info (split, symbol)); + auto pinfo{symbol ? gnc_split_amount_print_info (split, symbol) : number_pinfo}; + return xaccPrintAmount (amt_num, pinfo); } // Value with Symbol or not @@ -172,7 +186,7 @@ get_value (Split *split, bool t_void, bool symbol) { auto trans{xaccSplitGetParent(split)}; auto tcurr{xaccTransGetCurrency (trans)}; - auto pai{gnc_commodity_print_info (tcurr, symbol)}; + auto pai{symbol ? gnc_commodity_print_info (tcurr, symbol) : number_pinfo}; auto amt_num{t_void ? xaccSplitVoidFormerValue (split): xaccSplitGetValue (split)}; return xaccPrintAmount (amt_num, pai); }