Bug 704183 - ofx file import tries to match online_id against ACCTID[space]ACCTKEY even when ACCTKEY is empty

Alters the gnucash account matching code to search a second time if
the original search fails and the account ID has a trailing space. The second
search tries with the trailing space removed.

BP

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23114 57a11ea4-9604-0410-9ed3-97b8803252fd
pull/2/head
John Ralls 13 years ago
parent ab3d8086be
commit abe3440291

@ -249,7 +249,7 @@ Account * gnc_import_select_account(GtkWidget *parent,
picker->new_account_default_commodity = new_account_default_commodity;
picker->new_account_default_type = new_account_default_type;
/*DEBUG("Looking for account with online_id: %s", account_online_id_value);*/
/*DEBUG("Looking for account with online_id: \"%s\"", account_online_id_value);*/
if (account_online_id_value != NULL)
{
retval =
@ -257,6 +257,34 @@ Account * gnc_import_select_account(GtkWidget *parent,
test_acct_online_id_match,
/* This argument will only be used as a "const char*" */
(void*)account_online_id_value);
/* BEGIN: try again without extra space at the end */
/*
* libofx, used for file import, generates online_id as
* ACCTID + space + ACCTKEY which differs from the online_id
* generated by aqbanking for online ofx transfer as ACCTID.
*
* If a gnucash account has been associated with an online_id
* via aqbanking data, it is not possible to construct an OFX
* file for gnucash import that matches the same online_id
* because even with no ACCTKEY in the file, there will be a
* trailing space.
*
* This is a hack to overcome that problem.
*/
if ((retval == NULL) && g_str_has_suffix(account_online_id_value, " "))
{
gchar *trimmed = g_strndup(account_online_id_value, strlen(account_online_id_value) - 1);
if (trimmed)
{
retval = gnc_account_foreach_descendant_until(
gnc_get_current_root_account (),
test_acct_online_id_match,
(void *)trimmed);
}
g_free(trimmed);
}
/* END: try again without extra space at the end */
}
if (retval == NULL && auto_create != 0)
{

Loading…
Cancel
Save