After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 515163 - QIF Import: Eliminate pointless mappings
QIF Import: Eliminate pointless mappings
Status: VERIFIED FIXED
Product: GnuCash
Classification: Other
Component: Import - QIF
git-master
Other All
: Normal enhancement
: ---
Assigned To: Charles Day
Derek Atkins
Depends on:
Blocks: backport
 
 
Reported: 2008-02-08 09:49 UTC by Charles Day
Modified: 2018-06-29 22:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sample QIF file (260 bytes, text/plain)
2008-02-08 10:10 UTC, Charles Day
  Details
Proposed patch (12.10 KB, patch)
2008-02-08 11:25 UTC, Charles Day
none Details | Review
Easier-to-read patch (svn diff -x -w) (6.71 KB, patch)
2008-02-08 11:29 UTC, Charles Day
none Details | Review
Revised patch (ignoring whitespace) (6.48 KB, patch)
2008-02-13 05:33 UTC, Charles Day
none Details | Review
Revised patch (11.93 KB, patch)
2008-02-13 05:34 UTC, Charles Day
committed Details | Review

Description Charles Day 2008-02-08 09:49:03 UTC
Sometimes the QIF importer asks for unnecessary account, category and memo/payee mappings. These extra mappings don't harm the import, but asking for them is both pointless and confusing. The importer should stop requesting irrelevant mappings. I have identified several different situations in which this occurs.

==========
= Case 1 =
==========
Consider the following QIF file:

!Option:AutoSwitch
!Account
NMy Investments
TInvst
^
!Type:Invst
D1/17' 8
NBuy
YCitibank
I0.50
Q4
Cc
U2.00
T2.00
MBuy Memo
^

This transaction represents a purchase of stock, and is one of a variety of investment transactions that does not require an account or category to be specified. The brokerage and stock accounts are always used implicitly, so only the two account mappings are needed. However, the druid also asks for a blank category mapping (default: "Unspecified") and a memo/payee mapping (for "Buy Memo"), even though they will not be used.

Investment transactions known to be affected by this behavior are those using the following actions on the "N" line: buy, cglong, cgmid, cgshort, div, intinc, margint, reinvdiv, reinvint, reinvlg, reinvmd, reinvsg, reinvsh, reminder, rtrncap, sell, shrsin, shrsout, and stksplit.


==========
= Case 2 =
==========
Consider the following QIF file:

!Option:AutoSwitch
!Account
NMy Savings
TBank
^
!Type:Bank
D01/30/2008
T-10.00
PMy Payee
^

This transaction is missing an account or a category. The druid asks for a blank category mapping (default: "Unspecified") and for a memo/payee mapping for "My Payee". Although a mapping is needed to provide the missing information, it is not necessary to ask for more than one. Only the memo/payee mapping will be used. The category mapping has no effect or purpose, so there is no reason to ask for it.


==========
= Case 3 =
==========
Those investment transactions not covered in case 1 require an account or category to be explicitly specified and so mapping is needed. But the druid requests three for the missing piece of information: a blank account mapping (default: "Unspecified"), a blank category mapping (default: "Unspecified"), and a another for the memo/payee (for "Sell Memo"). An example QIF file for this would be:

!Option:AutoSwitch
!Account
NMy Investments
TInvst
^
!Type:Invst
D1/19' 8
NSellX
YCitibank
I0.50
Q4
Cc
U2.00
T2.00
MSell Memo
Comment 1 Charles Day 2008-02-08 10:10:10 UTC
Created attachment 104699 [details]
Sample QIF file

This QIF file contains the three transactions shown in the bug description.
Comment 2 Charles Day 2008-02-08 11:25:46 UTC
Created attachment 104702 [details] [review]
Proposed patch

This patch fixes all three cases discussed above. Tested on the sample QIF file and a very large file of personal transactions. NOTE: the patch includes a lot of whitespace changes, so I will also attach an easier-to-read diff that ignores them.
Comment 3 Charles Day 2008-02-08 11:29:09 UTC
Created attachment 104703 [details] [review]
Easier-to-read patch (svn diff -x -w)

This is the same as the attached patch, but is easier to read because whitespace changes are ignored.
Comment 4 Charles Day 2008-02-08 11:32:19 UTC
Is there some other way I should attach the easier-to-read patch so that it can be viewed as a diff instead of plain text?
Comment 5 Josh Sled 2008-02-08 13:23:26 UTC
(In reply to comment #4)
> Is there some other way I should attach the easier-to-read patch so that it can
> be viewed as a diff instead of plain text?

I think just clicking the 'patch' checkbox is all one can do; then the "diff"-view becomes available.  I've updated the "Easier-to-read patch" attachment as such.

FWIW, though, I like the improved whitespace of your original patch.  I guess it'd be ideal to have the functionality patch (ignoring whitespace) and a separate whitespace-correcting patch.  But whatever. :)
Comment 6 Charles Day 2008-02-08 19:45:00 UTC
I'm not suggesting that the easier-to-read patch to be applied - it's only for human eyes, just to make reviewing the patch a bit less time consuming. If you try to compare before and after with all the whitespace changes included, then the diff shows big blocks of changed code and it is hard to tell what really changed.

In future, I guess I'll attach the easier-to-read patch first, as a patch, then attach the real patch second, and have the first patch marked as obsolete.

I thought that plain text would work, because when you follow the "Edit" link there is a button that says "View as diff" (or similar). But it seems to have no effect.
Comment 7 Charles Day 2008-02-13 05:33:07 UTC
Created attachment 105118 [details] [review]
Revised patch (ignoring whitespace)

This is the easy-to-read version of the revised patch. Do not apply to SVN.
Comment 8 Charles Day 2008-02-13 05:34:49 UTC
Created attachment 105119 [details] [review]
Revised patch

This revised patch adds checks for non-existent payees and memos.
Comment 9 Charles Day 2008-06-01 19:33:32 UTC
Brought the patch up to date and committed as r17186. Requesting backport for 2.2.
Comment 10 Andreas Köhler 2008-07-21 00:00:58 UTC
Applied to branches/2.2 as r17361 for inclusion in GnuCash 2.2.6.
Thanks!
Comment 11 John Ralls 2018-06-29 22:01:01 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=515163. Please update any external references or bookmarks.