Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix currency symbol for Total Amount on contribution page #17703

Merged
merged 1 commit into from
Jul 17, 2020

Conversation

mattwire
Copy link
Contributor

Overview

"Total Amount" shows default system currency symbol if contribution page is configured to use a different currency.

Setup a simple contribution page with a price set and a text amount/quantity field. Set the currency on the contribution page to something other than the CiviCRM default.

Before

image

After

image

Technical Details

The correct currency symbol is assigned to the form but not used because the currency is formatted by CRM.formatMoney.
We change that to only return a number and append the currency symbol we already have. Note there is currently no way to pass the currency into CRM.formatMoney via javascript.

Comments

@eileenmcnaughton As you've started working on brick money as a formatter in CiviCRM this could probably be resolved in a better way. This fixes the immediate problem and indicates where a better formatter could be introduced. But that's probably something to work on after this is fixed.
@jitendrapurohit Can you review?

@civibot
Copy link

civibot bot commented Jun 27, 2020

(Standard links)

@irenemeisel
Copy link

(CiviCRM Review Template DEL-1.2)

  • General standards

    • Explain (r-explain)

      • PASS : The goal/problem/solution have been adequately explained in the PR.
    • User impact (r-user)

      • PASS: The change would be intuitive or unnoticeable for a majority of users who work with this feature.
    • Run it (r-run)

      • PASS:
        I duplicated this problem on the master branch and the patch fixed it
  • Developer standards
    * UNREVIEWED
    I don't feel qualified to assess the code

  • Code quality (r-code)
    * UNREVIEWED

  • Maintainability (r-maint)
    * UNREVIEWED

  • Test results (r-test)

      * __PASS__: The test results are all-clear.
    

@seamuslee001
Copy link
Contributor

Code quality looks ok here and it has been r-run merging

@seamuslee001 seamuslee001 merged commit e8a3818 into civicrm:master Jul 17, 2020
@eileenmcnaughton
Copy link
Contributor

thanks for the review @irenemeisel

@mlutfy
Copy link
Member

mlutfy commented Dec 9, 2020

This code assumes that the currency formatting displays the currency before the amount, which only applies to English-speaking countries and some South American countries. Quebec, Europe, Russia and most of Asia place the currency after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants