Skip to content

Commit 1e6b5a1

Browse files
committed
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.
1 parent 940085a commit 1e6b5a1

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

gnucash/import-export/csv-imp/gnc-import-tx.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ void GncTxImport::base_account (Account* base_account)
182182
return;
183183
}
184184

185+
auto base_account_is_new = m_settings.m_base_account == nullptr;
185186
m_settings.m_base_account = base_account;
186187

187188
if (m_settings.m_base_account)
@@ -192,10 +193,17 @@ void GncTxImport::base_account (Account* base_account)
192193
set_column_type(col_type_it - m_settings.m_column_types.begin(),
193194
GncTransPropType::NONE);
194195

195-
/* Set default account for each line's split properties */
196-
for (auto line : m_parsed_lines)
197-
std::get<PL_PRESPLIT>(line)->set_account (m_settings.m_base_account);
198-
196+
if (base_account_is_new)
197+
{
198+
/* Set default account for each line's split properties */
199+
for (auto line : m_parsed_lines)
200+
std::get<PL_PRESPLIT>(line)->set_account (m_settings.m_base_account);
201+
}
202+
else
203+
{
204+
/* Reparse all of the lines with the new base account's commodity. */
205+
tokenize(false);
206+
}
199207

200208
}
201209
}

0 commit comments

Comments
 (0)