r16920 - gnucash/branches/2.2/src/import-export/qif-import - [r16909] Bug#511006: Check the GnuCash file for the relevant commodity during QIF security import,
Andreas Köhler
andi5 at cvs.gnucash.org
Sat Feb 2 21:17:33 EST 2008
Author: andi5
Date: 2008-02-02 21:17:32 -0500 (Sat, 02 Feb 2008)
New Revision: 16920
Trac: http://svn.gnucash.org/trac/changeset/16920
Modified:
gnucash/branches/2.2/src/import-export/qif-import/qif-guess-map.scm
Log:
[r16909] Bug#511006: Check the GnuCash file for the relevant commodity during QIF security import,
rather than assuming it's there because it's in the map file, since the
user might be importing against a different book. Patch from <cedayiv
gmail com>.
Modified: gnucash/branches/2.2/src/import-export/qif-import/qif-guess-map.scm
===================================================================
--- gnucash/branches/2.2/src/import-export/qif-import/qif-guess-map.scm 2008-02-03 02:17:17 UTC (rev 16919)
+++ gnucash/branches/2.2/src/import-export/qif-import/qif-guess-map.scm 2008-02-03 02:17:32 UTC (rev 16920)
@@ -143,19 +143,29 @@
tablist)
table))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; qif-import:read-commodities
+;;
+;; This procedure examines a list of previously seen commodities
+;; and returns a hash table of them, if they still exist.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (qif-import:read-commodities commlist)
(let ((table (make-hash-table 20)))
(for-each
(lambda (entry)
(if (and (list? entry)
(= 3 (length entry)))
- (let ((name (car entry))
- (namespace (cadr entry))
- (mnemonic (caddr entry)))
- (hash-set! table name
- (gnc-commodity-table-lookup
- (gnc-commodity-table-get-table (gnc-get-current-book))
- namespace mnemonic)))))
+ ;; The saved information about each commodity is a
+ ;; list of three items: name, namespace, and mnemonic.
+ ;; Example: ("McDonald's" "NYSE" "MCD")
+ (let ((commodity (gnc-commodity-table-lookup
+ (gnc-commodity-table-get-table
+ (gnc-get-current-book))
+ (cadr entry)
+ (caddr entry))))
+ (if (and commodity (not (null? commodity)))
+ ;; The commodity is defined in GnuCash.
+ (hash-set! table (car entry) commodity)))))
commlist)
table))
More information about the gnucash-changes
mailing list