5

Hi I am using CiviCrm 5 on wordpress,

donation amounts displayed with zeros floating points after the decimal for example 25.00000000 instead of 25

Is there any solution?

enter image description here

enter image description here

3

1 Answer 1

5
+100

Short answer: I've prepared a patch that I'd love for someone to test to fix this.

Longer answer: In recent months, CiviCRM has implemented support for currencies with more than two digits after the decimal point. This is important both for cryptocurrencies as well as certain countries' tax calculations. The decision was, "Store all currencies in the database with nine significant digits, and when displaying them, format them according to the rules of that currency."

This all happened in CiviCRM core and it went so well that end users who didn't need the greater accuracy didn't notice. Unfortunately, no one updated Simple Donate.

I don't use Simple Donate, but recently handled a similar problem in my custom code, so I looked and it was a 4 line fix.

I'd love for someone affected by this problem to test my patched version and report back if you have any problems with it. If there are no issues, I'll submit the patch to the original authors. I'd especially love feedback from users who don't use US dollars as their currency!

Find the fix on my Github repo or download directly. When unzipping, please be sure to rename the folder to match your old extension folder name that you're replacing.

10
  • As an additional comment - I noticed that no one had informed the original authors of the problem. The extension has a "Support" URL when you're in the extensions menu, but there are no tickets reporting this issue. Commented Jul 17, 2018 at 0:07
  • But shouldn't the extension be reading the Label field for the buttons and not the Amount field? I actually created an account on civicrm.com so I could report the problem the authors, but I haven't been able to log in.
    – fdarn
    Commented Jul 17, 2018 at 4:05
  • @fdarn This extension isn't written by the CiviCRM core team, so they won't be able to help you. I just posted a new question to show how to report a bug on an extension: civicrm.stackexchange.com/questions/25746/… Commented Jul 17, 2018 at 5:54
  • I posted the issue with the extension's authors, but seeing how they have 9 other issues they haven't responded to in over a year, I am not encouraged. So I take it nobody else uses Simple Donate. Is there another similar extension or option? Surely not everyone is using just the basic civi form?
    – fdarn
    Commented Jul 17, 2018 at 14:37
  • @fdarn If you could test my fix and confirm it solves the problem, they're more likely to merge something already written than write their own fix. As for whether it should be reading the label vs. the amount - I can't say. This is how the extension was written, and have no thoughts as to whether it's the best way. I think there's an argument that it would be hard to maintain the simple layout with arbitrary length labels, but I also see your argument that this is less flexible. Commented Jul 17, 2018 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.