gnucash stable: Bug 799068 - csv export active register not working

Christopher Lam clam at code.gnucash.org
Thu Aug 24 12:16:54 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/8fe9dc98 (commit)
	from  https://github.com/Gnucash/gnucash/commit/3d1e1154 (commit)



commit 8fe9dc9845b0f79ce2a0e5125ded2a9c956f06eb
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Aug 25 00:01:58 2023 +0800

    Bug 799068 - csv export active register not working
    
    XML_EXPORT_TRANS uses info->csva.account_list. XML_EXPORT_REGISTER
    doesn't use an account list, and uses the register QofQuery
    instead. Call account_splits once with a nullptr account.

diff --git a/gnucash/import-export/csv-exp/csv-transactions-export.cpp b/gnucash/import-export/csv-exp/csv-transactions-export.cpp
index a73b605cec..c0517897b4 100644
--- a/gnucash/import-export/csv-exp/csv-transactions-export.cpp
+++ b/gnucash/import-export/csv-exp/csv-transactions-export.cpp
@@ -401,15 +401,21 @@ void csv_transactions_export (CsvExportInfo *info)
 
     /* Go through list of accounts */
     TransSet trans_set;
-    for (auto ptr = info->csva.account_list; !info->failed && ptr;
-         ptr = g_list_next(ptr))
+
+    switch (info->export_type)
     {
-        auto acc{static_cast<Account*>(ptr->data)};
-        DEBUG("Account being processed is : %s", xaccAccountGetName (acc));
-        account_splits (info, acc, ss, trans_set);
-        info->failed = ss.fail();
+    case XML_EXPORT_TRANS:
+        for (auto ptr = info->csva.account_list; !ss.fail() && ptr; ptr = g_list_next(ptr))
+            account_splits (info, GNC_ACCOUNT(ptr->data), ss, trans_set);
+        break;
+    case XML_EXPORT_REGISTER:
+        account_splits (info, nullptr, ss, trans_set);
+        break;
+    default:
+        PERR ("unknown export_type %d", info->export_type);
     }
 
+    info->failed = ss.fail();
     LEAVE("");
 }
 



Summary of changes:
 .../import-export/csv-exp/csv-transactions-export.cpp  | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list