I have yet to find a way to change the decimal symbol, which is "." and the thousand symbol, which is "," to be switched around, we are using this module on a danish site and need it to display the results correctly, right now something that is actually just a decimal result, many read as being a thousand result.

This is a critical fix we need as the site we are using it on will go live on monday, please help!

Comments

seutje’s picture

Version: 6.x-1.2 » master
StatusFileSize
new493 bytes

holas, attached patch checks for the presence of the format number module and if it exists, it will try to run the value through format_number with a decimal count of 2 (hardcoded)

it does this only in the submit handler for the calculator, so the actual API function remains untouched

(changing version as I doubt this will be committed to an already released version)

patch made against HEAD

seutje’s picture

StatusFileSize
new530 bytes

same thing on API level, still with hardcoded 2 decimals

Graloth’s picture

Applying those patches result in the calculation result always being 0,00 (, being decimal symbol now)

nevermind, was my own mistake :)

kbahey’s picture

Priority: Critical » Normal
Status: Active » Needs work

@seutje

If you can expand the patch to allow a configurable number of digits to the right of the decimal point, that would be a great feature to have.

We kill 2 birds with one stone that way.

seutje’s picture

I'll see if I find some spare time for that, but can't make any promises to get it done before DC, already feel like I'm slacking on my core issues q.q

so should I bake this in the API call or only in the form submit? or should I have it simply throw a hook so others can easily fiddle with the formatting?

amateescu’s picture

Version: master » 6.x-1.x-dev
Status: Needs work » Needs review
StatusFileSize
new1.47 KB

Here is a patch that allows the user to specify the number of decimals returned in the result.

amateescu’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

amateescu’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new3.52 KB

Follow-up patch for this issue. We should default $decimals to NULL in case the user wants the actual currency exchange result to process it later.

Edit: Also added some code clean-ups in this patch.

amateescu’s picture

Status: Needs review » Fixed

Commited with 31c0354.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.