Bug 361004 - CSV Importer doesn't read DecimalSymbol stored in csvimporterrc
Summary: CSV Importer doesn't read DecimalSymbol stored in csvimporterrc
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: importer (show other bugs)
Version: git (master)
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-26 07:32 UTC by wojnilowicz
Modified: 2016-04-24 05:31 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.8.0
Sentry Crash Report:


Attachments
CSV Test File (329 bytes, text/plain)
2016-03-26 07:32 UTC, wojnilowicz
Details
Column Assignment for CSV file (73.47 KB, image/png)
2016-03-26 07:33 UTC, wojnilowicz
Details
Warning about decimal symbol (13.08 KB, image/png)
2016-03-26 07:33 UTC, wojnilowicz
Details
Patch to fix this issue (1.24 KB, patch)
2016-03-26 07:35 UTC, wojnilowicz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wojnilowicz 2016-03-26 07:32:05 UTC
During creation of Investment profile I choose my DecimalSymbol to be comma. That setting is saved in csvimporterrc as DecimalSymbol=1. If I want to reuse my investment profile to import some more CSV files I get warning (see attachment) about DecimalSymbol not found in my CSV file and afterwards DecimalSymbol in csvimporterrc is overridden to 0 ie. DecimalSymbol=1 which means dot. That's unwanted bec  

Reproducible: Always

Steps to Reproduce:
1. File->Import->CSV
2. Select investment
3. Create new profile
4. Field delimiter to comma, Text delimiter to double quotes
5. Assign columns (see attachment)
6. Next on start line/end line
7. Change Decimal Symbol from dot to comma and press exit
8. For information purposes: Open ~/.kde/share/config/csvimporterrc  and see that under your newly created profile DecimalSymbol=1, which means comma
9. File->Import->CSV
10. Select investment
11. Select your newly created profile
12. Select  "Skip setup" checkbox and do as you would normally import CSV file then close importer.

Actual Results:  
1) Warning about decimal symbol
2) DecimalSymbol gets changed in ~/.kde/share/config/csvimporterrc from 1 (comma) to 0 (dot) without my will


Expected Results:  
1) No warning at all
2) DecimalSymbol shouldn't be changed without my will or without informing me

The problem is in readSettings() of investprocessing.cpp. There is a line 

tmp = profilesGroup.readEntry("", 0);

which reads nothing at all from csvimporterrc so DecimalSymbol is always set to 0. That line should look like this

tmp = profilesGroup.readEntry("DecimalSymbol", 0);

which will read DecimalSymbol parameter and if nothing is there it will be set to 0.
Comment 1 wojnilowicz 2016-03-26 07:32:59 UTC
Created attachment 98096 [details]
CSV Test File
Comment 2 wojnilowicz 2016-03-26 07:33:22 UTC
Created attachment 98097 [details]
Column Assignment for CSV file
Comment 3 wojnilowicz 2016-03-26 07:33:53 UTC
Created attachment 98098 [details]
Warning about decimal symbol
Comment 4 wojnilowicz 2016-03-26 07:35:09 UTC
Created attachment 98099 [details]
Patch to fix this issue

Please revise it and apply to master branch.
Comment 5 allan 2016-03-26 18:54:53 UTC
Well spotted!  Now, why did I do that?

I'll come back to this later.

Allan