Dawid, thanks for taking the time to improve KMyMoney by providing a patch. The 'messy' code is probably due to historic growth ;)
In fact, the OFX part is not my area of expertise because none of the banks here uses/supports it. But the code looks like we could use it to improve the functionality. @Jack: can you check if the patch works with your OFX downloads? Regards Thomas On Freitag, 24. Januar 2020 05:57:25 CET Dawid Wrobel wrote: > 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. > -- Regards Thomas Baumgart https://www.signal.org/ Signal, the better WhatsApp ------------------------------------------------------------- Embedded Linux: because you can't do control-alt-delete on a pacemaker. -------------------------------------------------------------
signature.asc
Description: This is a digitally signed message part.