Bug 402672

Summary: Can't edit loan account with institution of "Accounts with no institution assigned"
Product: [Applications] kmymoney Reporter: Kevin Christy <zwitster>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal CC: killphi+kde
Priority: NOR    
Version: 5.0.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.0.5
Sentry Crash Report:
Attachments: App crash screenshot
About KMyMoney
About KMyMoney - Libraries tab
New crash information added by DrKonqi

Description Kevin Christy 2018-12-29 00:28:16 UTC
Created attachment 117162 [details]
App crash screenshot

SUMMARY
Trying to edit one of the first accounts I created with no institution. I was able to edit a "credit card" account that also had no initial institution, but the loan account crashes the program each time.

STEPS TO REPRODUCE
1. Create a loan account with no institution selected so it becomes "Accounts with no institution assigned"
2. After account is created, try to edit with either toolbar Edit Account button or context menu from right-click. Happens from either Institutions or Accounts view.


OBSERVED RESULT
Uncaught error:
unknown institution /builddir/build/BUILD/kmymoney-5.0.2/kmymoney/mymoney/storage/mymoneystoragemgr.cpp:561

EXPECTED RESULT
Edit account details and assign/change institution.

SOFTWARE/OS VERSIONS
Windows: 
MacOS: 
Linux/KDE Plasma: Fedora 29
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 5.52.0
Qt Version: 5.11.1

ADDITIONAL INFORMATION
Comment 1 Kevin Christy 2018-12-29 00:29:10 UTC
Created attachment 117163 [details]
About KMyMoney
Comment 2 Kevin Christy 2018-12-29 00:29:48 UTC
Created attachment 117164 [details]
About KMyMoney - Libraries tab
Comment 3 killphi+kde 2019-05-02 05:43:40 UTC
Created attachment 119792 [details]
New crash information added by DrKonqi

kmymoney (5.0.2) using Qt 5.11.3

- What I was doing when the application crashed:
Tried to test out loans as a means to allocate money for a saving goal.
Created a loan without credit institution.

Deleting account is greyed out from context menu;
Trying to edit account will crash the application every time.
Error Details given:
"unknown institution /builddir/build/BUILD/kmymoney-5.0.2/kmymoney/mymoney/storage/mymoneystoragemgr.cpp:561"

-- Backtrace (Reduced):
#12 0x00005574df8da8ed in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kmymoney-5.0.2-2.fc29.x86_64/kmymoney/main.cpp:246
Comment 4 killphi+kde 2019-05-03 03:44:16 UTC
(In reply to killphi+kde from comment #3)
> Deleting account is greyed out from context menu;

That was an error on my end.
Found the recurring payment, deleted that, and was able to delete the loan account.


I would still expect to be unable to create an "illegal" loan account to prevent such errors from occuring, or at least more helpful error messages on how to resolve this, if not better handling in the code itself.
Comment 5 Thomas Baumgart 2019-05-11 14:04:28 UTC
Git commit 5824844052b429c1ef6b7f62b8163aaa83add09f by Thomas Baumgart.
Committed on 11/05/2019 at 14:04.
Pushed by tbaumgart into branch '5.0'.

Allow to edit loan account not assigned to institution
FIXED-IN: 5.0.5

M  +5    -1    kmymoney/wizards/newloanwizard/keditloanwizard.cpp

https://commits.kde.org/kmymoney/5824844052b429c1ef6b7f62b8163aaa83add09f
Comment 6 Jack 2019-05-17 19:38:59 UTC
(In reply to killphi+kde from comment #4)
How was your loan account "illegal" and can you suggest and addition to the manual to at least warn about this problem?
Comment 7 killphi+kde 2019-05-17 23:36:20 UTC
(In reply to Jack from comment #6)
> How was your loan account "illegal"

Illegal in terms of "case not properly handled by code", not national-law-illegal.
It was missing a financial institution.
- Possible to enter such a loan into the system
- Impossible to edit the loan once it's in the system


> addition to the manual to at least warn about this problem?

I do not think adding this to the manual would have warned about anything.
My suggestion was to have a better/dedicated error message in-program when trying to enter/edit such a loan.
However, from skimming over the diff of the patch for 5.0.5, this seems to have been fixed by catching the error when reading the data from storage, which makes it possible to edit loans without financial institutions.

AKA all my issues have been adressed.