From 1e6b5a10958f5bc77709edf3ddfe3d668dbe3908 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 2 May 2025 12:54:07 -0700 Subject: [PATCH] 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. --- gnucash/import-export/csv-imp/gnc-import-tx.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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(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(line)->set_account (m_settings.m_base_account); + } + else + { + /* Reparse all of the lines with the new base account's commodity. */ + tokenize(false); + } } }