Bug#512497: use payee/memo mappings as well in the QIF import of investment transactions. Patch from Charles Day <cedayiv gmail com>.

BP


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16906 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Joshua Sled 2008-02-01 00:44:14 +00:00
parent 1b393b59c0
commit f93b4976eb

View File

@ -584,18 +584,30 @@
(set! qif-far-acct (cadr qif-accts))
(set! qif-commission-acct (caddr qif-accts))
;; translate the QIF account names into Gnucash accounts
;; Translate the QIF account names into GnuCash accounts.
(if (and qif-near-acct qif-far-acct)
(begin
;; Determine the near account.
(set! near-acct-info
(or (hash-ref qif-acct-map qif-near-acct)
(hash-ref qif-cat-map qif-near-acct)))
(set! near-acct-name (qif-map-entry:gnc-name near-acct-info))
(set! near-acct (hash-ref gnc-acct-hash near-acct-name))
(set! far-acct-info
(or (hash-ref qif-acct-map qif-far-acct)
(hash-ref qif-cat-map qif-far-acct)))
;; Determine the far account.
(if (or (not (string? qif-far-acct))
(string=? qif-far-acct ""))
;; No far account name is specified, so try a
;; payee or memo mapping to get a default.
(set! far-acct-info
(or (hash-ref qif-memo-map (qif-xtn:payee qif-xtn))
(hash-ref qif-memo-map
(qif-split:memo
(car (qif-xtn:splits qif-xtn)))))))
(if (not far-acct-info)
(set! far-acct-info
(or (hash-ref qif-acct-map qif-far-acct)
(hash-ref qif-cat-map qif-far-acct))))
(set! far-acct-name (qif-map-entry:gnc-name far-acct-info))
(set! far-acct (hash-ref gnc-acct-hash far-acct-name))))