gnucash stable: Bug 799592 - "No transactions found" when importing CSV transactions

John Ralls jralls at code.gnucash.org
Fri May 2 16:05:40 EDT 2025


Updated	 via  https://github.com/Gnucash/gnucash/commit/1e6b5a10 (commit)
	from  https://github.com/Gnucash/gnucash/commit/940085a0 (commit)



commit 1e6b5a10958f5bc77709edf3ddfe3d668dbe3908
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri May 2 12:54:07 2025 -0700

    Bug 799592 - "No transactions found" when importing CSV transactions
    
    Before this when changing the base account to one with a new currency
    the new currency was added to the old base account's currency in the
    alternate currencies vector instead of replacing it.
    
    To avoid that re-parse the the splits from scratch when replacing the
    base account.

diff --git a/gnucash/import-export/csv-imp/gnc-import-tx.cpp b/gnucash/import-export/csv-imp/gnc-import-tx.cpp
index 6c2f283779..b3c1b32e53 100644
--- a/gnucash/import-export/csv-imp/gnc-import-tx.cpp
+++ b/gnucash/import-export/csv-imp/gnc-import-tx.cpp
@@ -182,6 +182,7 @@ void GncTxImport::base_account (Account* base_account)
         return;
     }
 
+    auto base_account_is_new = m_settings.m_base_account == nullptr;
     m_settings.m_base_account = base_account;
 
     if (m_settings.m_base_account)
@@ -192,10 +193,17 @@ void GncTxImport::base_account (Account* base_account)
             set_column_type(col_type_it - m_settings.m_column_types.begin(),
                             GncTransPropType::NONE);
 
-        /* Set default account for each line's split properties */
-        for (auto line : m_parsed_lines)
-            std::get<PL_PRESPLIT>(line)->set_account (m_settings.m_base_account);
-
+        if (base_account_is_new)
+        {
+            /* Set default account for each line's split properties */
+            for (auto line : m_parsed_lines)
+                std::get<PL_PRESPLIT>(line)->set_account (m_settings.m_base_account);
+        }
+        else
+        {
+            /* Reparse all of the lines with the new base account's commodity. */
+            tokenize(false);
+        }
 
     }
 }



Summary of changes:
 gnucash/import-export/csv-imp/gnc-import-tx.cpp | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)



More information about the gnucash-changes mailing list