OFX importer should not ignore non-empty Name field if Payee or Memo are empty (patch provided)

Dawid Wrobel me at dawidwrobel.com
Fri Jan 24 04:57:25 GMT 2020


Hello,


The US Citibank's OFX account statement uses NAME and MEMO fields only.
Even worse, Payee is saved in MEMO. When importing using OFX plugin, one
has an option to choose preferred field for Payee. However, choosing MEMO
there solves the problem only partially, since the NAME field gets
discarded despite carrying useful transaction description information that
could be otherwise used as Memo.


I looked into the code and noticed that it is quite messy and indeed does
not consider non-empty NAME field at all, so I rewrote that section of the
code.


I am building a "matrix" of preference for each of the Payee, Memo and
Name, based on the user's choice for Payee. The importing logic then
evaluates each transaction by:

- finding the first valid (non-empty) OFX field from the preferred list for
Payee;

- looking up the corresponding OFX field for Memo preference. If the OFX
field is not valid, the corresponding field of the Name preference list is
used instead.


This opportunistic approach guarantees that no information gets ignored
whenever it can be assigned to either Payee or Memo fields. It also handles
the investment transactions more cleanly.


STEPS TO REPRODUCE

1. Prepare an OFX file with the following transaction:


<STMTTRN>

<TRNTYPE>CREDIT

<DTPOSTED>20200115120000

<TRNAMT>1366.31

<FITID>202001110001

<NAME>ACH Electronic Credit

<MEMO>EMPLOYER

</STMTTRN>


2. Attempt to import, set the preferred Payee field to MEMO


OBSERVED RESULT

NAME gets ignored and the MEMO gets used twice instead


EXPECTED RESULT

Since MEMO is already used for Payee and PAYEEID is not provided by the
OFX, NAME field should be used to populate Memo information.


ADDITIONAL INFORMATION

I haven't coded in C++/QT for over 6 years, so my apologies if the code is
not up to modern standards.


Patch attached and also checked-in to my forked repo here:
https://github.com/wrobelda/kmymoney/commit/8064ced6da1c4acea582618dbc7777b915124f16


If required, I can try and push it through Phabricator instead.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20200123/e919549d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ofx-field-preference-improvements.patch
Type: application/octet-stream
Size: 6361 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20200123/e919549d/attachment.obj>


More information about the KMyMoney-devel mailing list