Skip to content

Commit

Permalink
Bug 799454 - Numeric value in exported CSV transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherlam committed Nov 2, 2024
1 parent 274c033 commit 8d00aaa
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions gnucash/import-export/csv-exp/csv-transactions-export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
Expand Down

0 comments on commit 8d00aaa

Please sign in to comment.