AUDIT: r22825 - gnucash/trunk/src/import-export/ofx - Bug #695423: Fix OFX Commodity Account handling.

Derek Atkins warlord at MIT.EDU
Wed Mar 13 12:43:21 EDT 2013


Christian,

I'm not sure how I feel about about all these "***CPC 20130207 ref: OFX
Commodity Account Patch, Burke***" entries in the code..  It feels
overly complicated, and in a couple years I think we'll lose context as
to "what patch" it was.  If it referred back to a Bz Bug# I think it
would be okay.  Moreover, I don't think it's needed at the start and end
of the changed code blocks.

Also, the first block of patch that comments out the gchar
*investment_account_text should probably have a '*' in the front to make
it more clear that the line is being commented out.  I had to read that
code multiple times to notice that it was commented out.

-derek

Christian Stimming <cstim at code.gnucash.org> writes:

> Author: cstim
> Date: 2013-03-09 05:22:18 -0500 (Sat, 09 Mar 2013)
> New Revision: 22825
> Trac: http://svn.gnucash.org/trac/changeset/22825
>
> Modified:
>    gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
> Log:
> Bug #695423: Fix OFX Commodity Account handling.
>
> Patch by Burke.
> BP
>
> Modified: gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
> ===================================================================
> --- gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c	2013-03-06 20:28:58 UTC (rev 22824)
> +++ gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c	2013-03-09 10:22:18 UTC (rev 22825)
> @@ -318,7 +318,10 @@
>      Account *account;
>      Account *investment_account = NULL;
>      Account *income_account = NULL;
> -    gchar *investment_account_text;
> +/***CPC 20130207 ref: OFX Commodity Account Patch, Burke***
> +    gchar *investment_account_text;************************/
> +/***CPC 20130207 ref: OFX Commodity Account Patch, Burke***/
> +    gchar *investment_account_text, *investment_account_onlineid;
>      gnc_commodity *currency = NULL;
>      gnc_commodity *investment_commodity = NULL;
>      gnc_numeric gnc_amount, gnc_units;
> @@ -531,13 +534,28 @@
>  								  in any translations.  */
>                                                _("Stock account for security \"%s\""),
>                                                data.security_data_ptr->secname);
> +/***CPC 20130207 ref: OFX Commodity Account Patch, Burke***/
> +		investment_account_onlineid = g_strdup_printf( "%s%s", data.account_id, data.unique_id);
>  
> -                // @FIXME: Add the automated selection or creation of account here!
> +/***CPC 20130207 ref: OFX Commodity Account Patch, Burke***
> +*               // @FIXME: Add the automated selection or creation of account here!
> +*
> +*               // First check whether we can find the right investment_account without asking the user
> +*               investment_account = gnc_import_select_account(NULL,
> +*                                    data.unique_id, FALSE, investment_account_text,
> +*                                    investment_commodity, ACCT_TYPE_STOCK, NULL, NULL);
> +***********************************************************/
>  
> -                // First check whether we can find the right investment_account without asking the user
> -                investment_account = gnc_import_select_account(NULL,
> -                                     data.unique_id, FALSE, investment_account_text,
> -                                     investment_commodity, ACCT_TYPE_STOCK, NULL, NULL);
> +/***CPC 20130207 ref: OFX Commodity Account Patch, Burke***/
> +		investment_account = gnc_import_select_account(NULL, 
> +								   investment_account_onlineid,
> +								   1,
> +								   investment_account_text,
> +								   investment_commodity,
> +								   ACCT_TYPE_STOCK,
> +								   NULL,
> +								   NULL);
> +
>                  // but use it only if that's really the right commodity
>                  if (investment_account
>                          && xaccAccountGetCommodity(investment_account) != investment_commodity)
> @@ -622,6 +640,8 @@
>                      PERR("No investment account found for text: %s\n", investment_account_text);
>                  }
>                  g_free (investment_account_text);
> +/***CPC 20130207 ref: OFX Commodity Account Patch, Burke***/
> +		g_free (investment_account_onlineid);
>                  investment_account_text = NULL;
>  
>                  if (investment_account != NULL &&
>
> _______________________________________________
> gnucash-changes mailing list
> gnucash-changes at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-changes
>
>

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list