Bug 439819 - Issue with changing credit card limits
Summary: Issue with changing credit card limits
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Unclassified
Component: reports (show other bugs)
Version: 5.1.2
Platform: Microsoft Windows Microsoft Windows
: NOR normal (vote)
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-14 04:06 UTC by Wayne Howard
Modified: 2021-07-24 09:54 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.1.3


Attachments
attachment-30087-0.html (2.64 KB, text/html)
2021-07-23 14:20 UTC, Wayne Howard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wayne Howard 2021-07-14 04:06:43 UTC
SUMMARY
Change to account limits breaks report "To Minimum Balance/Maximum Credit" My credit card limit was increased recently and I attempted to change the Maximum Credit under Edit Account.

STEPS TO REPRODUCE
1. Opened Account and selected edit account. The account limits for warning and maximum are showing blank.
2. Entered new maximum credit limit and selected OK.
3. Returned to home page and scrolled to Preferred Accounts.
4. New "To Minimum Balance/Maximum Credit" showing a negative number which equals current account balance and new account limit added together.
5. My other credit accounts are displaying the limits correctly on the "Preferred Account" report. These other credit accounts also have blank displays in their limits tabs. So as long as the limits are not changed, the report displays correctly.

OBSERVED RESULT
Extremely large negative number in the "Maximum Credit" column.

EXPECTED RESULT
A positive number reflecting new credit limit minus current account balance


SOFTWARE/OS VERSIONS
Windows: 10
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: Version 5.1.2-64335bc5d
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2 (built against 5.15.2)

ADDITIONAL INFORMATION
Comment 1 Thomas Baumgart 2021-07-14 13:48:05 UTC
I tried to duplicate this behavior without success. Differences: I was using 5.1.2-070754227 on Linux. Can you double check the account type? Is it really a credit-card account?
Comment 2 Wayne Howard 2021-07-14 14:22:23 UTC
(In reply to Thomas Baumgart from comment #1)
> I tried to duplicate this behavior without success. Differences: I was using
> 5.1.2-070754227 on Linux. Can you double check the account type? Is it
> really a credit-card account?

Yes, under the General tab, this account shows "Credit Card" grayed out.
Comment 3 Jeremy Whiting 2021-07-14 15:38:53 UTC
This is exactly the same issue I hit. My old kmymoney file from 4.x times, using all year with 5.0.x or 5.1.0 worked fine. Then recently installed 5.1.1 on windows and saw this same behavior. Credit card "Limits" tab doesn't show values for cards that I have set limits for them on previous builds.

In trying to debug I added some qDebug() lines around AmountEdit, but realized on windows those don't go anywhere since it's a gui app. So tried on linux and linux build of kmymoney master branch doesn't have this bug somehow.

I tried installing the latest nightly for windows, but still hit the same issue.
Comment 4 Thomas Baumgart 2021-07-15 04:02:40 UTC
To make those debug messages visible under Windows use DebugView (https://docs.microsoft.com/en-us/sysinternals/downloads/debugview). Since it seems a windows only problem, I won't be able to duplicate/fix it without your help.
Comment 5 Jeremy Whiting 2021-07-18 00:34:22 UTC
Thomas, thanks for the DebugView hint. That's a very useful tool. After a bit of wrangling with craft on windows I think I found the problem. I'm just not yet sure what the proper fix is. Here's what I found.

The locale settings from c++ lconv are saying for negative values use 0 : Currency symbol and quantity surrounded by parentheses. (which equates to eMyMoney::Money::ParensAround in KMM. That's fine all negative values on windows have () around them, while on linux here they have - in front instead. But because of that the AmountEditValidator marks (5000.00) as invalid and changes it immediately to "" when loading an existing kmy file with credit limits that are negative values.

So one of the following I guess is needed.
A) Make AmountEditValidator not derive from QDoubleValidator but instead be a custom type that understands all the different notations in MyMoneyMoney formatMoney
B) Only use the system eMyMoney::Money::signPosition in the html views, but not when setting text in an AmountEdit

I can get a patch ready with either approach, just wasn't sure which made more sense. Or maybe something completely different would be better?

In fiddling with this I also found I can't find a place to set how I want negative values to appear in KMM on windows. Maybe it needs to be a new setting at least on windows where the system locale's aren't editable? (Or maybe they are editable, but I haven't yet found where?)
Comment 6 Jeremy Whiting 2021-07-18 01:28:52 UTC
Ok, found a solution. Using approach B. MR coming shortly.

I found the windows currency format setting. Nowhere in settings app of course, but in Control Panel -> Clock & Region -> Change Date Time & Number Formats -> Additional settings... -> Currency tab there's a place to select how negative currencies should show. The way kmm gets it from setlocale and localeconv works perfectly with that to decide how negative numbers appear on home in KMM.

https://invent.kde.org/office/kmymoney/-/merge_requests/108 <-- MR here.
Comment 7 Thomas Baumgart 2021-07-23 13:16:15 UTC
Git commit b3ffeec21438efb18326159cd75530aee29ca133 by Thomas Baumgart.
Committed on 23/07/2021 at 13:15.
Pushed by tbaumgart into branch '5.1'.

Allow parens around an amount to be a valid when locale uses it

A locale can request numbers to be presented with parens around the
value. This change allows them to be entered in this format in the
amount fields.
FIXED-IN: 5.1.3

M  +1    -0    kmymoney/widgets/CMakeLists.txt
M  +46   -0    kmymoney/widgets/amountvalidator.cpp
M  +2    -0    kmymoney/widgets/amountvalidator.h
M  +1    -0    kmymoney/widgets/tests/CMakeLists.txt

https://invent.kde.org/office/kmymoney/commit/b3ffeec21438efb18326159cd75530aee29ca133
Comment 8 Wayne Howard 2021-07-23 14:20:43 UTC
Created attachment 140280 [details]
attachment-30087-0.html

I agree with you. W10 bug rectified.

On Fri, Jul 23, 2021, 08:16 Thomas Baumgart <bugzilla_noreply@kde.org>
wrote:

> https://bugs.kde.org/show_bug.cgi?id=439819
>
> Thomas Baumgart <thb@net-bembel.de> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>    Version Fixed In|                            |5.1.3
>              Status|CONFIRMED                   |RESOLVED
>       Latest Commit|                            |
> https://invent.kde.org/offi
>                    |
> |ce/kmymoney/commit/b3ffeec2
>                    |
> |1438efb18326159cd75530aee29
>                    |                            |ca133
>          Resolution|---                         |FIXED
>
> --- Comment #7 from Thomas Baumgart <thb@net-bembel.de> ---
> Git commit b3ffeec21438efb18326159cd75530aee29ca133 by Thomas Baumgart.
> Committed on 23/07/2021 at 13:15.
> Pushed by tbaumgart into branch '5.1'.
>
> Allow parens around an amount to be a valid when locale uses it
>
> A locale can request numbers to be presented with parens around the
> value. This change allows them to be entered in this format in the
> amount fields.
> FIXED-IN: 5.1.3
>
> M  +1    -0    kmymoney/widgets/CMakeLists.txt
> M  +46   -0    kmymoney/widgets/amountvalidator.cpp
> M  +2    -0    kmymoney/widgets/amountvalidator.h
> M  +1    -0    kmymoney/widgets/tests/CMakeLists.txt
>
>
> https://invent.kde.org/office/kmymoney/commit/b3ffeec21438efb18326159cd75530aee29ca133
>
> --
> You are receiving this mail because:
> You reported the bug.
Comment 9 Thomas Baumgart 2021-07-24 09:54:46 UTC
Git commit 451accf2ef79d4ca2d457808f6c818a9395d8942 by Thomas Baumgart.
Committed on 24/07/2021 at 09:54.
Pushed by tbaumgart into branch 'master'.

Allow parens around an amount to be a valid when locale uses it

A locale can request numbers to be presented with parens around the
value. This change allows them to be entered in this format in the
amount fields.

(cherry picked from commit b3ffeec21438efb18326159cd75530aee29ca133)

M  +1    -0    kmymoney/widgets/CMakeLists.txt
M  +46   -0    kmymoney/widgets/amountvalidator.cpp
M  +2    -0    kmymoney/widgets/amountvalidator.h
M  +1    -0    kmymoney/widgets/tests/CMakeLists.txt

https://invent.kde.org/office/kmymoney/commit/451accf2ef79d4ca2d457808f6c818a9395d8942