AUDIT: r17180 - gnucash/trunk/src - QIF Import: Add support for importing to A/R and A/P account types, which were previously unknown to the importer. I also had to adjust a function in the engine's Account API that caused imported accounts trees to not merge properly in rare cases where one an existing GnuCash account has a NULL string pointer but an importer-created account has an empty string instead. This situation arises as a side effect of using SWIG, which doesn't let Scheme distinguish between NULL and an empty string (a string containing only NUL).
Charles Day
cedayiv at cvs.gnucash.org
Thu May 29 11:23:57 EDT 2008
Author: cedayiv
Date: 2008-05-29 11:23:56 -0400 (Thu, 29 May 2008)
New Revision: 17180
Trac: http://svn.gnucash.org/trac/changeset/17180
Modified:
gnucash/trunk/src/engine/Account.c
gnucash/trunk/src/import-export/qif-import/qif-dialog-utils.scm
gnucash/trunk/src/import-export/qif-import/qif-guess-map.scm
gnucash/trunk/src/import-export/qif-import/qif-objects.scm
Log:
QIF Import: Add support for importing to A/R and A/P account types, which were previously unknown to the importer. I also had to adjust a function in the engine's Account API that caused imported accounts trees to not merge properly in rare cases where one an existing GnuCash account has a NULL string pointer but an importer-created account has an empty string instead. This situation arises as a side effect of using SWIG, which doesn't let Scheme distinguish between NULL and an empty string (a string containing only NUL).
BP
Modified: gnucash/trunk/src/engine/Account.c
===================================================================
--- gnucash/trunk/src/engine/Account.c 2008-05-28 16:56:08 UTC (rev 17179)
+++ gnucash/trunk/src/engine/Account.c 2008-05-29 15:23:56 UTC (rev 17180)
@@ -4250,15 +4250,15 @@
Account *acc_b = node_b->data;
priv_b = GET_PRIVATE(acc_b);
- if (0 != safe_strcmp(priv_a->accountName, priv_b->accountName))
+ if (0 != null_strcmp(priv_a->accountName, priv_b->accountName))
continue;
- if (0 != safe_strcmp(priv_a->accountCode, priv_b->accountCode))
+ if (0 != null_strcmp(priv_a->accountCode, priv_b->accountCode))
continue;
- if (0 != safe_strcmp(priv_a->description, priv_b->description))
+ if (0 != null_strcmp(priv_a->description, priv_b->description))
continue;
if (!gnc_commodity_equiv(priv_a->commodity, priv_b->commodity))
continue;
- if (0 != safe_strcmp(xaccAccountGetNotes(acc_a),
+ if (0 != null_strcmp(xaccAccountGetNotes(acc_a),
xaccAccountGetNotes(acc_b)))
continue;
if (priv_a->type != priv_b->type)
Modified: gnucash/trunk/src/import-export/qif-import/qif-dialog-utils.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-dialog-utils.scm 2008-05-28 16:56:08 UTC (rev 17179)
+++ gnucash/trunk/src/import-export/qif-import/qif-dialog-utils.scm 2008-05-29 15:23:56 UTC (rev 17180)
@@ -149,7 +149,9 @@
GNC-CCARD-TYPE
GNC-CASH-TYPE
GNC-ASSET-TYPE
- GNC-LIABILITY-TYPE)))
+ GNC-LIABILITY-TYPE
+ GNC-RECEIVABLE-TYPE
+ GNC-PAYABLE-TYPE)))
((divx cgshortx cgmidx cglongx intincx margintx rtrncapx)
(set! qif-account
@@ -159,7 +161,9 @@
GNC-CCARD-TYPE
GNC-CASH-TYPE
GNC-ASSET-TYPE
- GNC-LIABILITY-TYPE)))
+ GNC-LIABILITY-TYPE
+ GNC-RECEIVABLE-TYPE
+ GNC-PAYABLE-TYPE)))
((miscincx miscexpx)
(set! qif-account
(qif-split:miscx-category
@@ -168,7 +172,9 @@
GNC-CCARD-TYPE
GNC-CASH-TYPE
GNC-ASSET-TYPE
- GNC-LIABILITY-TYPE))))
+ GNC-LIABILITY-TYPE
+ GNC-RECEIVABLE-TYPE
+ GNC-PAYABLE-TYPE))))
;; now reference the near-end account
(if qif-account
@@ -203,7 +209,9 @@
GNC-CCARD-TYPE
GNC-CASH-TYPE
GNC-ASSET-TYPE
- GNC-LIABILITY-TYPE)))
+ GNC-LIABILITY-TYPE
+ GNC-RECEIVABLE-TYPE
+ GNC-PAYABLE-TYPE)))
((buyx sellx xin xout)
(set! qif-account
(qif-split:category
@@ -212,7 +220,9 @@
GNC-CCARD-TYPE
GNC-CASH-TYPE
GNC-ASSET-TYPE
- GNC-LIABILITY-TYPE)))
+ GNC-LIABILITY-TYPE
+ GNC-RECEIVABLE-TYPE
+ GNC-PAYABLE-TYPE)))
((stksplit)
(set! qif-account
@@ -220,7 +230,9 @@
(set! qif-account-types (list GNC-STOCK-TYPE
GNC-MUTUAL-TYPE
GNC-ASSET-TYPE
- GNC-LIABILITY-TYPE)))
+ GNC-LIABILITY-TYPE
+ GNC-RECEIVABLE-TYPE
+ GNC-PAYABLE-TYPE)))
((cgshort cgshortx reinvsg reinvsh)
(set! qif-account
(default-cgshort-acct from-acct stock-acct))
@@ -301,12 +313,13 @@
(if (not entry)
(set! entry (qif-import:guess-acct
from-acct
- (list
- GNC-BANK-TYPE
- GNC-CCARD-TYPE
- GNC-CASH-TYPE
- GNC-ASSET-TYPE
- GNC-LIABILITY-TYPE)
+ (list GNC-BANK-TYPE
+ GNC-CCARD-TYPE
+ GNC-CASH-TYPE
+ GNC-ASSET-TYPE
+ GNC-LIABILITY-TYPE
+ GNC-RECEIVABLE-TYPE
+ GNC-PAYABLE-TYPE)
gnc-acct-info)))
(qif-map-entry:set-display?! entry #t)
(hash-set! acct-hash from-acct entry)
@@ -325,12 +338,13 @@
(set! entry
(qif-import:guess-acct
xtn-acct
- (list
- GNC-BANK-TYPE
- GNC-CCARD-TYPE
- GNC-CASH-TYPE
- GNC-ASSET-TYPE
- GNC-LIABILITY-TYPE)
+ (list GNC-BANK-TYPE
+ GNC-CCARD-TYPE
+ GNC-CASH-TYPE
+ GNC-ASSET-TYPE
+ GNC-LIABILITY-TYPE
+ GNC-RECEIVABLE-TYPE
+ GNC-PAYABLE-TYPE)
gnc-acct-info)))
(qif-map-entry:set-display?! entry #t)
(hash-set! acct-hash xtn-acct entry)))))
@@ -497,10 +511,12 @@
(list GNC-INCOME-TYPE GNC-EXPENSE-TYPE
GNC-BANK-TYPE GNC-CCARD-TYPE
GNC-LIABILITY-TYPE GNC-ASSET-TYPE
+ GNC-RECEIVABLE-TYPE GNC-PAYABLE-TYPE
GNC-STOCK-TYPE GNC-MUTUAL-TYPE)
(list GNC-EXPENSE-TYPE GNC-INCOME-TYPE
GNC-BANK-TYPE GNC-CCARD-TYPE
GNC-LIABILITY-TYPE GNC-ASSET-TYPE
+ GNC-RECEIVABLE-TYPE GNC-PAYABLE-TYPE
GNC-STOCK-TYPE GNC-MUTUAL-TYPE)))))
(qif-map-entry:set-display?! entry #t)
(hash-set! memo-hash key-string entry)))))
Modified: gnucash/trunk/src/import-export/qif-import/qif-guess-map.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-guess-map.scm 2008-05-28 16:56:08 UTC (rev 17179)
+++ gnucash/trunk/src/import-export/qif-import/qif-guess-map.scm 2008-05-29 15:23:56 UTC (rev 17180)
@@ -17,6 +17,8 @@
(define GNC-INCOME-TYPE 8)
(define GNC-EXPENSE-TYPE 9)
(define GNC-EQUITY-TYPE 10)
+(define GNC-RECEIVABLE-TYPE 11)
+(define GNC-PAYABLE-TYPE 12)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Modified: gnucash/trunk/src/import-export/qif-import/qif-objects.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-objects.scm 2008-05-28 16:56:08 UTC (rev 17179)
+++ gnucash/trunk/src/import-export/qif-import/qif-objects.scm 2008-05-29 15:23:56 UTC (rev 17180)
@@ -552,10 +552,12 @@
(cond
((memv t (list GNC-BANK-TYPE GNC-CASH-TYPE GNC-CCARD-TYPE
GNC-STOCK-TYPE GNC-MUTUAL-TYPE
- GNC-ASSET-TYPE GNC-LIABILITY-TYPE))
+ GNC-ASSET-TYPE GNC-LIABILITY-TYPE
+ GNC-RECEIVABLE-TYPE GNC-PAYABLE-TYPE))
(add-types GNC-BANK-TYPE GNC-CASH-TYPE GNC-CCARD-TYPE
GNC-STOCK-TYPE GNC-MUTUAL-TYPE
- GNC-ASSET-TYPE GNC-LIABILITY-TYPE))
+ GNC-ASSET-TYPE GNC-LIABILITY-TYPE
+ GNC-RECEIVABLE-TYPE GNC-PAYABLE-TYPE))
((memv t (list GNC-INCOME-TYPE GNC-EXPENSE-TYPE))
(add-types GNC-INCOME-TYPE GNC-EXPENSE-TYPE))
(#t
More information about the gnucash-changes
mailing list