* src/engine/commodity-table.scm: move gnc:commodity-is-currency? here

* src/engine/engine.scm: export gnc:commodity-is-currency?
	* src/report/report-system/report-system.scm: remove ref to same.
	* src/report/report-system/report-system.scm: remove function above
	* src/import-export/qifiimport/qif-to-gnc.scm: fix the algorithm
	  to find/create new accounts.  All "parent" accounts are of
	  commodity "default-currency" (but don't really care about that).
	  When creating a leaf account, use the security if it's a
	  stock/mmf account, but the default-currency otherwise.
	  Fixes #103633.

	  NOTE:  Might need similar fixed in qif-io-core?


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7841 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2003-01-17 03:18:36 +00:00
parent 4d2d578ec9
commit a21813baa3
6 changed files with 35 additions and 15 deletions

View File

@ -1,3 +1,18 @@
2003-01-16 Derek Atkins <derek@ihtfp.com>
* src/engine/commodity-table.scm: move gnc:commodity-is-currency? here
* src/engine/engine.scm: export gnc:commodity-is-currency?
* src/report/report-system/report-system.scm: remove ref to same.
* src/report/report-system/report-system.scm: remove function above
* src/import-export/qifiimport/qif-to-gnc.scm: fix the algorithm
to find/create new accounts. All "parent" accounts are of
commodity "default-currency" (but don't really care about that).
When creating a leaf account, use the security if it's a
stock/mmf account, but the default-currency otherwise.
Fixes #103633.
NOTE: Might need similar fixed in qif-io-core?
2003-01-15 David Hampton <hampton@employees.org>
* configure.in: Remove restriction on guile versions > 1.4.

View File

@ -14,3 +14,9 @@
(define GNC_COMMODITY_NS_NASDAQ "NASDAQ")
(define GNC_COMMODITY_NS_EUREX "EUREX")
(define GNC_COMMODITY_NS_MUTUAL "FUND")
;; Returns true if the commodity comm represents a currency, false if
;; it represents a stock or mutual-fund.
(define (gnc:commodity-is-currency? comm)
(equal? GNC_COMMODITY_NS_ISO
(gnc:commodity-get-namespace comm)))

View File

@ -42,6 +42,7 @@
(export GNC_COMMODITY_NS_AMEX)
(export GNC_COMMODITY_NS_EUREX)
(export GNC_COMMODITY_NS_MUTUAL)
(export gnc:commodity-is-currency?)
(export gnc:url->loaded-session)
(export gnc:transaction-map-splits)

View File

@ -14,6 +14,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (qif-import:find-or-make-acct acct-info check-types? commodity
check-commodity? default-currency
gnc-acct-hash old-group new-group)
(let* ((separator (string-ref (gnc:account-separator-char) 0))
(gnc-name (qif-map-entry:gnc-name acct-info))
@ -33,7 +34,9 @@
(and (list? allowed-types)
(memv acc-type allowed-types))
#t)
(gnc:commodity-equiv? acc-commodity commodity))))
(if check-commodity?
(gnc:commodity-equiv? acc-commodity commodity)
#t))))
(define (make-unique-name-variant long-name short-name)
(if (gnc:get-account-from-full-name old-group long-name separator)
@ -153,7 +156,7 @@
pinfo (qif-map-entry:allowed-parent-types acct-info))
(set! parent-acct (qif-import:find-or-make-acct
pinfo #t commodity
pinfo #t default-currency #f default-currency
gnc-acct-hash old-group new-group))))
(if parent-acct
(gnc:account-insert-subaccount parent-acct new-acct)
@ -248,7 +251,9 @@
(qif-import:get-account-name
(qif-map-entry:qif-name acctinfo)))))
(ok-types (qif-map-entry:allowed-types acctinfo))
(equity? (memv GNC-EQUITY-TYPE ok-types)))
(equity? (memv GNC-EQUITY-TYPE ok-types))
(stock? (or (memv GNC-STOCK-TYPE ok-types)
(memv GNC-MUTUAL-TYPE ok-types))))
;; Debug
;; (for-each
@ -260,16 +265,17 @@
(cond ((and equity? security) ;; a "retained holdings" acct
(qif-import:find-or-make-acct acctinfo #f
security
security #t default-currency
gnc-acct-hash
old-group new-group))
(security
((and security (or stock?
(gnc:commodity-is-currency? security)))
(qif-import:find-or-make-acct
acctinfo #f security
acctinfo #f security #t default-currency
gnc-acct-hash old-group new-group))
(#t
(qif-import:find-or-make-acct
acctinfo #f default-currency
acctinfo #f default-currency #t default-currency
gnc-acct-hash old-group new-group)))))
sorted-accounts-list)

View File

@ -21,13 +21,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Returns true if the commodity comm represents a currency, false if
;; it represents a stock or mutual-fund.
(define (gnc:commodity-is-currency? comm)
(equal? GNC_COMMODITY_NS_ISO
(gnc:commodity-get-namespace comm)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Functions to get splits with interesting data from accounts.

View File

@ -24,7 +24,6 @@
(gnc:module-load "gnucash/gnome-utils" 0) ; for the html routines
;; commodity-utilities.scm
(export gnc:commodity-is-currency?)
(export gnc:get-match-commodity-splits)
(export gnc:get-match-commodity-splits-sorted)
(export gnc:get-all-commodity-splits )