<div dir="ltr"><div dir="ltr"><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">Hello,</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue";min-height:14px"><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">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.</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue";min-height:14px"><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">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.</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue";min-height:14px"><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">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:</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">- finding the first valid (non-empty) OFX field from the preferred list for Payee;</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">- 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.</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue";min-height:14px"><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">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. </p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue";min-height:14px"><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">STEPS TO REPRODUCE</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">1. Prepare an OFX file with the following transaction:</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue";min-height:14px"><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue""><STMTTRN></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue""><TRNTYPE>CREDIT</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue""><DTPOSTED>20200115120000</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue""><TRNAMT>1366.31</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue""><FITID>202001110001</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue""><NAME>ACH Electronic Credit</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue""><MEMO>EMPLOYER</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue""></STMTTRN></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue";min-height:14px"><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">2. Attempt to import, set the preferred Payee field to MEMO</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue";min-height:14px"><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">OBSERVED RESULT</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">NAME gets ignored and the MEMO gets used twice instead</p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue""><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">EXPECTED RESULT</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">Since MEMO is already used for Payee and PAYEEID is not provided by the OFX, NAME field should be used to populate Memo information. </p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue";min-height:14px"><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">ADDITIONAL INFORMATION</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">I haven't coded in C++/QT for over 6 years, so my apologies if the code is not up to modern standards.</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue""><br></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">Patch attached and also checked-in to my forked repo here: <a href="https://github.com/wrobelda/kmymoney/commit/8064ced6da1c4acea582618dbc7777b915124f16">https://github.com/wrobelda/kmymoney/commit/8064ced6da1c4acea582618dbc7777b915124f16</a></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue""><br></p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue"">If required, I can try and push it through Phabricator instead.</p><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:"Helvetica Neue""><br></p></div></div>