[Gnucash-changes] r13503 - gnucash/trunk - Fix OFX import problem with some dividends transactions. Patch by

Christian Stimming cstim at cvs.gnucash.org
Mon Mar 6 16:35:48 EST 2006


Author: cstim
Date: 2006-03-06 16:35:48 -0500 (Mon, 06 Mar 2006)
New Revision: 13503
Trac: http://svn.gnucash.org/trac/changeset/13503

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
Log:
Fix OFX import problem with some dividends transactions. Patch by
David Reiser. #164645.



Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-03-06 21:31:08 UTC (rev 13502)
+++ gnucash/trunk/ChangeLog	2006-03-06 21:35:48 UTC (rev 13503)
@@ -1,5 +1,8 @@
 2006-03-06  Christian Stimming  <stimming at tuhh.de>
 
+	* src/import-export/ofx/gnc-ofx-import.c: Fix OFX import problem
+	with some dividends transactions. Patch by David Reiser. #164645.
+
 	* src/import-export/import-backend.c: Fix crash when "clear" is
 	chosen but no matching transaction is selected. Now those imported
 	transactions will silently be ignored. #317917.

Modified: gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
===================================================================
--- gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c	2006-03-06 21:31:08 UTC (rev 13502)
+++ gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c	2006-03-06 21:35:48 UTC (rev 13503)
@@ -440,9 +440,7 @@
 			  }
 		      }
 		    if(income_account!=NULL&&
-		       (data.invtransactiontype==OFX_REINVEST||
-			data.invtransactiontype==OFX_INCOME)
-		       )
+		       data.invtransactiontype==OFX_REINVEST)
 		      {
 			DEBUG("Adding investment split; Money flows from the income account"); 
 			split=xaccMallocSplit(book);
@@ -462,6 +460,27 @@
 			  xaccSplitSetMemo(split, data.memo);
 			}    
 		      }
+		    if(income_account!=NULL&&
+			data.invtransactiontype==OFX_INCOME)
+		      {
+			DEBUG("Adding investment split; Money flows from the income account"); 
+			split=xaccMallocSplit(book);
+			xaccTransAppendSplit(transaction,split);
+			xaccAccountInsertSplit(income_account,split);
+
+			gnc_amount = double_to_gnc_numeric (-data.amount,/*OFX_INCOME amounts come in as positive numbers*/
+							    gnc_commodity_get_fraction(xaccTransGetCurrency(transaction)),
+							    GNC_RND_ROUND);
+			xaccSplitSetBaseValue(split, gnc_amount, xaccTransGetCurrency(transaction));
+		    
+			/* Also put the ofx transaction name in the splits memo field, or ofx memo if name is unavailable */ 
+			if(data.name_valid==true){
+			  xaccSplitSetMemo(split, data.name);
+			}
+			else if(data.memo_valid==true){
+			  xaccSplitSetMemo(split, data.memo);
+			}    
+		      }
 		
 
 		    if(data.invtransactiontype!=OFX_REINVEST)



More information about the gnucash-changes mailing list