more on OFX data and bank codes
David Reiser
dbreiser at earthlink.net
Thu Jul 24 12:30:32 EDT 2008
On Jul 23, 2008, at 11:10 PM, David Reiser wrote:
> In AO_Provider__ProcessImporterContext from src/plugins/backends/
> aqofxconnect/plugin/provider.c, Martin handles the case of null
> bankcode in the OFX data stream by looking up the bankcode associated
> with the user in the aqbanking settings.conf data.
>
> So it looks to me like OFX needs special handling beyond a one-size-
> fits-all gnc_ab_accinfo_to_gnc_acc.
>
> Dave
> --
> David Reiser
> dbreiser at earthlink.net
I figure that by the time we get here, there should be zero chance
that the data stream will be missing both a bank code and an account
number. Borrowing from Martin's provider.c in the ofx backend, the
following works for me:
Index: src/import-export/aqbanking/gnc-ab-utils.c
===================================================================
--- src/import-export/aqbanking/gnc-ab-utils.c (revision 17400)
+++ src/import-export/aqbanking/gnc-ab-utils.c (working copy)
@@ -430,12 +430,17 @@
{
gchar *online_id;
Account *gnc_acc;
+ const char *sBankCode;
+ const char *sAccountNumber;
g_return_val_if_fail(acc_info, NULL);
- online_id =
g_strconcat(AB_ImExporterAccountInfo_GetBankCode(acc_info),
-
AB_ImExporterAccountInfo_GetAccountNumber(acc_info),
- (gchar*)NULL);
+ sBankCode=AB_ImExporterAccountInfo_GetBankCode(acc_info);
+ if (sBankCode==0)
+ sBankCode="";
+ sAccountNumber=AB_ImExporterAccountInfo_GetAccountNumber(acc_info);
+
+ online_id = g_strconcat(sBankCode, sAccountNumber, (gchar*)NULL);
gnc_acc = gnc_import_select_account(
NULL, online_id, 1,
AB_ImExporterAccountInfo_GetAccountName(acc_info),
NULL, ACCT_TYPE_NONE, NULL, NULL);
In case it isn't obvious, I don't know the variable declaration and
assignment rules, so additional clean-up is probably a good idea.
The above does work for ofxdirectconnect sessions with either credit
cards (no bankcode) or my bank (sends both bank code and account
number).
It might be worth considering adding a space between the bankcode and
account number in online_id to make it more readable in the account
list.
Dave
--
David Reiser
dbreiser at earthlink.net
More information about the gnucash-devel
mailing list