gnucash maint: More OFX_INVBANKTRANS fixes.

John Ralls jralls at code.gnucash.org
Thu Sep 23 15:10:48 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/09b2533c (commit)
	from  https://github.com/Gnucash/gnucash/commit/09da6aa1 (commit)



commit 09b2533c0d61b1adeb21ca86e9e8e9a2152fa6ea
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Sep 23 12:03:08 2021 -0700

    More OFX_INVBANKTRANS fixes.
    
    Includes fixing broken build if libofx is < v 0.10.

diff --git a/gnucash/import-export/ofx/gnc-ofx-import.c b/gnucash/import-export/ofx/gnc-ofx-import.c
index f75952345..6423ddbf3 100644
--- a/gnucash/import-export/ofx/gnc-ofx-import.c
+++ b/gnucash/import-export/ofx/gnc-ofx-import.c
@@ -214,6 +214,10 @@ static const gchar *gnc_ofx_invttype_to_str(InvTransactionType t)
         return "SPLIT (Stock or mutial fund split)";
     case OFX_TRANSFER:
         return "TRANSFER (Transfer holdings in and out of the investment account)";
+#ifdef HAVE_LIBOFX_VERSION_0_10
+    case OFX_INVBANKTRAN:
+         return "Transfer cash in and out of the investment account";
+#endif
     default:
         return "ERROR, this investment transaction type is unknown.  This is a bug in ofxdump";
     }
@@ -586,8 +590,12 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void *user_data)
     xaccTransSetCurrency(transaction, currency);
     if (data.amount_valid)
     {
-        if (!data.invtransactiontype_valid ||
-            data.invtransactiontype == OFX_INVBANKTRAN)
+        if (!data.invtransactiontype_valid
+#ifdef HAVE_LIBOFX_VERSION_0_10
+            || data.invtransactiontype == OFX_INVBANKTRAN)
+#else
+             )
+#endif
         {
             double amount = data.amount;
 #ifdef HAVE_LIBOFX_VERSION_0_10
@@ -1057,7 +1065,9 @@ double ofx_get_investment_amount(const struct OfxTransactionData* data)
 {
     double amount = data->amount;
 #ifdef HAVE_LIBOFX_VERSION_0_10
-   if (data->currency_ratio_valid && data->currency_ratio != 0)
+    if (data->invtransactiontype == OFX_INVBANKTRAN)
+        return 0.0;
+    if (data->currency_ratio_valid && data->currency_ratio != 0)
         amount *= data->currency_ratio;
 #endif
     g_assert(data);



Summary of changes:
 gnucash/import-export/ofx/gnc-ofx-import.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list