[Kmymoney-devel] A bug in Git master

Allan agander93 at gmail.com
Sat Nov 30 23:55:47 UTC 2013


On 25/11/13 04:23, Chris Tucker wrote:
> I tried to subscribe to the list but am awaiting authorization.  According to the page at http://kmymoney2.sourceforge.net, this is the best way to submit a bug for the git development code.  If not the please point me in the right direction.
>
> Another bug found  when importing from OFX direct connect.  The reader trying to create splits cannot find the brokerage account for a split using statementTransactionUnderImport so all the imported transactions are broken.  This is likely because the transaction doesn't know the account name, but m_account does.  A patch:
>
> *** mymoneystatementreader.cpp.orig     2013-11-24 17:27:39.959812598 -0800
> --- mymoneystatementreader.cpp  2013-11-24 20:01:40.339204121 -0800
> ***************
> *** 565,570 ****
> --- 565,573 ----
>        if (brokerageactid.isEmpty()) {
>          brokerageactid = file->nameToAccount(statementTransactionUnderImport.m_strBrokerageAccount);
>        }
> +     if (brokerageactid.isEmpty()) {
> +       brokerageactid = file->nameToAccount(thisaccount.brokerageName());
> +     }
>
>        // find the security transacted, UNLESS this transaction didn't
>        // involve any security.

> --
>
> Chris

Hi Chris

Thanks for this patch, too.  I've found here, though, that 
brokerageactid gets over-written a bit later, circa line 1086 in 
mymoneystatementreader.cpp -

   // Add the 'account' split if it's needed
   if (! transfervalue.isZero()) {
     // in case the transaction has a reference to the brokerage 
account, we use it
>>>    if (!statementTransactionUnderImport.m_strBrokerageAccount.isEmpty() && brokerageactid.isEmpty()) {<<<
       brokerageactid = 
file->nameToAccount(statementTransactionUnderImport.m_strBrokerageAccount);
     }
     if (brokerageactid.isEmpty()) {
       brokerageactid = 
file->accountByName(statementTransactionUnderImport.m_strBrokerageAccount).id();
     }
//  There is no BrokerageAccount so have to nowhere to put this split.
     if (!brokerageactid.isEmpty()) {

and I needed to make the change on the line indicated by >>>....<<<, to 
avoid that happening.

I'm importing via CSV and there is no mapping of OFX source to an 
account for the brokerage/checking account so the user gets asked to 
enter this.  If he specifies an existing account, all is well.  If, 
however, because he makes a mistake or abbreviates a long name, the 
transfer will go to the investment account's associated brokerage 
account.  Generally, personally, I don't use these brokerage accounts 
because for me, they are not real and I would then have to make a manual 
transfer.

It might be interesting to know what happens with your OFX transfers 
if/when they reach this code.

Allan



More information about the KMyMoney-devel mailing list