From 5dc0b8271a790406f1bcf62e74e8ab42f9c7dee0 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Fri, 7 Apr 2023 20:41:11 +0800 Subject: [PATCH] [csv-transactions-export] fix category in export with simple layout If Trading accounts is enabled, and the transaction is a transfer between two accounts of differing commodities, the CSV simple-layout export would incorrectly show "--Split Transaction--" as the category. This commit changes the algorithm to ignore the trading splits when determining the other split account, thereby returning a more useful other account name. --- .../import-export/csv-exp/csv-transactions-export.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/gnucash/import-export/csv-exp/csv-transactions-export.cpp b/gnucash/import-export/csv-exp/csv-transactions-export.cpp index 55ba6ceec9..bec67baf95 100644 --- a/gnucash/import-export/csv-exp/csv-transactions-export.cpp +++ b/gnucash/import-export/csv-exp/csv-transactions-export.cpp @@ -130,15 +130,8 @@ get_memo (Split *split) static std::string get_category (Split *split, bool full) { - if (full) - { - auto cat{xaccSplitGetCorrAccountFullName (split)}; - auto rv{std::string (cat)}; - g_free (cat); - return rv; - } - else - return xaccSplitGetCorrAccountName (split); + auto other{xaccSplitGetOtherSplit(split)}; + return other ? get_account_name (other, full) : _("-- Split Transaction --"); } // Action