Bug 271294 - Modifying transactions with spaces in their amounts causes them to be reset to 0
Summary: Modifying transactions with spaces in their amounts causes them to be reset to 0
Status: RESOLVED FIXED
Alias: None
Product: skrooge
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Stephane MANKOWSKI
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-19 14:16 UTC by Harald Hvaal
Modified: 2011-07-28 19:04 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot of application. (105.50 KB, image/png)
2011-04-21 11:36 UTC, Harald Hvaal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Hvaal 2011-04-19 14:16:44 UTC
Version:           unspecified
OS:                Linux

Like the title says.
I'm using NOK currency (not sure if this applies to all currencies)

Reproducible: Always

Steps to Reproduce:
- Select a transaction with amount set to anything above 999 (because the formatting will insert a space between every three digits, which seems to be what is causing this issue)
- Press modify button

Actual Results:  
Amount field of transaction is set to 0

Expected Results:  
No change
Comment 1 Stephane MANKOWSKI 2011-04-19 19:22:51 UTC
Hi,

I tried to reproduce the problem but I am not able.
Could you give me more information ?

What is your skrooge version ? 

What is your locale (Norwegian) ?

Could you send me a screen capture ?
Comment 2 Harald Hvaal 2011-04-19 21:49:42 UTC
My environment locale:

harald@kozue:~$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

...but in KDE locale settings, "Country or region" is set to Norway.

I tried to set these locale settings to United States of America, and then do the following:

- add new dummy account
- add new transaction, amount 9999USD
(in the amount field, this is now formatted as "+ 9,999.00")
- deselect, select transation in operations view
- click amount field
- click Modify
(amount of operation was now set to 0)

Now, when I tried this with US locale, it did not always happen, and I haven't completely figured out when yet. It seems the regional setting "Thousands separator" in the KDE locale settings might have an influence.
Right now it's late and due to lack of time more debugging will have to wait a day or two.
Comment 3 Stephane MANKOWSKI 2011-04-20 20:20:20 UTC
Hi,

I formatted my currency like you "+ 9,999.00" but I am still not able to reproduce the problem.

Could you confirm that you are using Skrooge 0.8.0 at least ?
Comment 4 Stephane MANKOWSKI 2011-04-20 20:26:01 UTC
Could you launch Skrooge from a console and tell me if you have a trace like this when you are able to reproduce the error ?
WARNING: SKGServices::stringToDouble(xxx) failed

If yes, could tell me what is the value of xxx in your case ?
Comment 5 Harald Hvaal 2011-04-21 11:36:36 UTC
Created attachment 59180 [details]
Screenshot of application. 

Pressing modify in the attached screenshot will reset the amount to 0.
Comment 6 Harald Hvaal 2011-04-21 11:37:43 UTC
(In reply to comment #3)
> Could you confirm that you are using Skrooge 0.8.0 at least ?

Yes, I am using 0.8.1.
Comment 7 Harald Hvaal 2011-04-21 11:39:03 UTC
(In reply to comment #4)
> If yes, could tell me what is the value of xxx in your case ?

Indeed, I am getting:

##WARNING: SKGServices::stringToDouble(+ 9 999,00) failed
Comment 8 Stephane MANKOWSKI 2011-04-21 21:42:51 UTC
Git commit 5c5b59711308c1f6663cdec9422b135ccbbeb5d2 by Stephane Mankowski.
Committed on 21/04/2011 at 21:51.
Pushed by smankowski into branch 'master'.

BUG: 271294: Modifying transactions with spaces in their amounts causes them to be reset to 0

M  +1    -0    CHANGELOG     
M  +9    -1    skgbasegui/skgcalculatoredit.cpp     
M  +11   -0    skgbasegui/skgcalculatoredit.h     
M  +2    -0    skrooge_operation/skgoperationpluginwidget.cpp     

http://commits.kde.org/skrooge/5c5b59711308c1f6663cdec9422b135ccbbeb5d2
Comment 9 Harald Hvaal 2011-07-27 18:36:12 UTC
Sorry, but this bug is still there, running 0.9.0
I have a transaction for 15 000 NOK, and I select it and press Modify, and it instantly changes to 0.
As before, I am getting in the console: 
##WARNING: SKGServices::stringToDouble(+ 15 000,00) failed
##WARNING: SKGServices::stringToDouble(+ 15 000,00) failed

(yes, twice)

Note, I am seeing the same thing also when changing the name for a bank account; the initial balance goes to 0.
Comment 10 Stephane MANKOWSKI 2011-07-28 19:04:19 UTC
Git commit 2ee57c4aaa944a3aeadb754d20f1d5ba2c6e5638 by Stephane Mankowski.
Committed on 28/07/2011 at 21:04.
Pushed by smankowski into branch 'Feature'.

BUG: 271294: Modifying transactions with spaces in their amounts causes them to be reset to 0

M  +34   -18   plugins/skrooge/skrooge_bank/skgbankpluginwidget_base.ui
M  +1    -1    plugins/skrooge/skrooge_unit/skgunitpluginwidget.cpp
M  +1    -1    CHANGELOG
M  +2    -1    skgbasegui/skgcalculatoredit.h
M  +29   -15   skgbasegui/skgcalculatoredit.cpp
M  +30   -14   plugins/skrooge/skrooge_unit/skgunitpluginwidget_base.ui
M  +2    -1    plugins/skrooge/skrooge_bank/skgbankpluginwidget.cpp

http://commits.kde.org/skrooge/2ee57c4aaa944a3aeadb754d20f1d5ba2c6e5638