Bug 372786

Summary: Can't import some investments on KF5
Product: [Applications] kmymoney Reporter: allan <agander93>
Component: importerAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: git (master)   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 5.0.0
Sentry Crash Report:

Description allan 2016-11-22 13:52:08 UTC
On completing the CSV importer fields/columns, when I clicked Import,
the account selector showed only checking accounts.


This is the result of a recent code change circa line 646 in MyMoneyStatementReader::processTransactionEntry() -
"
if (brokerageactid.isEmpty()) {
      brokerageactid = SelectBrokerageAccount();
  }"
as it supplies a checking account for the investment account import.  On removing this code change, the import completed, but without any
account selection being offered.

In my case, KMM choses to import into an account which happens to be closed.  The user needs to be able to select the account into which to import, as a security/stock could be present in more than one investment account.  The importing CSV file cannot know what the user requires.

To avoid importing into a closed account, I've added a test for closed accounts  circa line 468 in csvwizard() -
"if ((statementHeader.contains(txt, Qt::CaseInsensitive)) && (!(*account).isClosed()))"

The import now proceeds and produces the account selection dialog, as required.
Comment 1 wojnilowicz 2017-02-03 17:01:06 UTC
Git commit 102ab58bb4717aa2e8ff516ef66ba6f29ab2f5a0 by Łukasz Wojniłowicz.
Committed on 03/02/2017 at 17:00.
Pushed by wojnilowicz into branch 'master'.

Don't find closed accounts in CSVWizard::findAccounts

Importing into closed account shouldn't occur automatically.
FIXED-IN:5.0

Signed-off-by: Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>

M  +1    -1    kmymoney/plugins/csvimport/csvwizard.cpp

https://commits.kde.org/kmymoney/102ab58bb4717aa2e8ff516ef66ba6f29ab2f5a0