OFX Commodity Account patch

Bill Burke wburke1 at gmail.com
Sun Mar 28 12:05:56 EDT 2010


I went ahead and made a patch for the issue that I mentioned before. I
still haven't had any luck figuring out how to add a plugin to the
interface.  Is there some documentation somewhere?  

This patch allows the same commodity to be held in different accounts.
Currently, only one account may be associated with a specific commodity.
This patch adds the account online_id as well to differentiate between
commodities held in different accounts.

- Bill

Index: src/import-export/ofx/gnc-ofx-import.c
===================================================================
--- src/import-export/ofx/gnc-ofx-import.c	(revision 18973)
+++ src/import-export/ofx/gnc-ofx-import.c	(working copy)
@@ -109,7 +109,7 @@
     kvp_frame * acc_frame;
     kvp_value * kvp_val;
     const GncGUID * income_acc_guid;
-    gchar *investment_account_text;
+    gchar *investment_account_text, *investment_account_onlineid;
     gnc_commodity *currency = NULL;
     gnc_commodity *investment_commodity = NULL;
     gnc_numeric gnc_amount, gnc_units;
@@ -418,8 +418,10 @@
                                                                  in any
translations.  */
                                                       _("Stock account
for security \"%s\""),

data.security_data_ptr->secname);
+                       investment_account_onlineid =
g_strdup_printf( "%s%s", data.account_id, data.unique_id);
+
                         investment_account =
gnc_import_select_account(NULL,
-                                             data.unique_id,
+
investment_account_onlineid,
                                              1,
                                              investment_account_text,
                                              investment_commodity,
@@ -427,6 +429,7 @@
                                              NULL,
                                              NULL);
                         g_free (investment_account_text);
+                       g_free (investment_account_onlineid);
                         investment_account_text = NULL;
                         if (investment_account != NULL &&
                                 data.unitprice_valid == true &&




More information about the gnucash-devel mailing list