https://bugs.kde.org/show_bug.cgi?id=524955

            Bug ID: 524955
           Summary: Built-in amount calculator misparses decimal comma
                    when LC_NUMERIC differs from LC_MONETARY
    Classification: Applications
           Product: kmymoney
      Version First 5.2.2
       Reported In:
          Platform: Mageia RPMs
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

DESCRIPTION
The built-in calculator opened from an amount field misinterprets monetary
values when LC_NUMERIC and LC_MONETARY use different decimal separators.

In my environment, monetary amounts use a comma as the decimal separator, while
the numeric locale uses a period. 
An initial amount such as 12,50 is interpreted by the calculator as 1250.
Arithmetic operations 
using that initial value therefore produce incorrect results.

STEPS TO REPRODUCE
1. Start KMyMoney with the following locale configuration:
  LANG=el_GR.UTF-8
  LC_NUMERIC=C
  LC_MONETARY=fr_FR.UTF-8

2. Create or edit a scheduled transaction.
3. Enter 12,50 in the amount field.
4. Open the built-in calculator from that field.
5. Multiply the amount by 2 and calculate the result.

OBSERVED RESULT
The initial amount is interpreted as 1250 and the multiplication produces 2500.
The same problem affects addition, subtraction, division and other calculator
operations.

EXPECTED RESULT
The calculator should interpret 12,50 as 12.50 and multiplying it by 2 should
produce 25,00.

SOFTWARE/OS VERSIONS
Operating System: Mageia 10
KDE Plasma Version: 6.5.5
KDE Frameworks Version: 6.22.0
Qt Version: 6.10.0
KMyMoney Version: 5.2.2

ADDITIONAL INFORMATION
Bug 522826 fixed the same locale mismatch in AmountValidator, but
KMyMoneyCalculator is a separate code path and still uses QLocale directly.
I tested the attached patch with success

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to