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

Give.fn.unFormatCurrency fn with Denmark currency amount return incorrect value. #2838

Closed
2 tasks
emgk opened this issue Feb 23, 2018 · 3 comments
Closed
2 tasks
Assignees
Milestone

Comments

@emgk
Copy link
Contributor

emgk commented Feb 23, 2018

Issue Overview

When unformatting Denmark formatted amount for example kr. 54,000 it should be 54000 but it returns 0.54 which is incorrect.

dsfsf

Expected Behavior

  • Should returns proper unformatted value.

Current Behavior

  • Return incorrect amount.

Todos

  • Tests
  • Documentation

WordPress Environment

``` ### WordPress Environment ###

Home URL: http://newgive.test
Site URL: http://newgive.test
WP Version: 4.9.4
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: ✔
WP Cron: ✔
Language: en_US
Permalink Structure: /%year%/%monthnum%/%day%/%postname%/
Show on Front: posts
Table Prefix Length: wp_
Table Prefix Length: 3
Table Prefix Status: Acceptable
Admin AJAX: Accessible
Registered Post Statuses: publish, future, draft, pending, private, trash, auto-draft, inherit, refunded, failed, revoked, cancelled, abandoned, processing, preapproval

Server Environment

Hosting Provider: DBH: localhost, SRV: newgive.test
TLS Connection: Connection uses TLS 1.2
TLS Connection: Probably Okay
Server Info: nginx/1.10.1
PHP Version: 7.0.3
PHP Post Max Size: 1,000 MB
PHP Time Limit: 0
PHP Max Input Vars: 3000
PHP Max Upload Size: 1,000 MB
cURL Version: ❌ 7.38.0, OpenSSL/1.0.1t - We recommend a minimum cURL version of 7.40.
SUHOSIN Installed: –
MySQL Version: ❌ 5.5.55 - We recommend a minimum MySQL version of 5.6. See: WordPress Requirements
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
gzip: ✔
GD Graphics Library: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

Give Configuration

Give Version: 2.0.4
Give Cache: Enabled
Database Updates: All DB Updates Completed.
Give Cache: Enabled
Give Cache: ✔New Donation✔Donation Receipt✔New Offline Donation✔Offline Donation Instructions✔New User Registration✔User Registration Information✔Email access
Upgraded From: –
Test Mode: Enabled
Currency Code: USD
Currency Position: Before
Decimal Separator: .
Thousands Separator: ,
Success Page: http://newgive.test/donation-confirmation/
Failure Page: http://newgive.test/donation-failed/
Donation History Page: http://newgive.test/donation-history/
Give Forms Slug: /donations/
Enabled Payment Gateways: Test Donation, Offline Donation
Default Payment Gateway: Test Donation
PayPal IPN Verification: Enabled
PayPal IPN Notifications: N/A
Donor Email Access: Enabled

Session Configuration

Give Use Sessions: Enabled
Session: Disabled

Active Give Add-ons

Give - Currency Switcher: ❌ Unlicensed – by WordImpress – 1.0.0

Other Active Plugins

WP Crontrol: by John Blackbourn & contributors – 1.6.2

Inactive Plugins

Theme

Name: Twenty Seventeen
Version: 1.4
Author URL: https://wordpress.org/
Child Theme: No – If you're modifying Give on a parent theme you didn't build personally, then we recommend using a child theme. See: How to Create a Child Theme

</details>
@ravinderk ravinderk self-assigned this Feb 23, 2018
@ravinderk ravinderk added the bug label Feb 23, 2018
@ravinderk ravinderk added this to the 2.0.5 milestone Feb 23, 2018
ravinderk added a commit that referenced this issue Feb 23, 2018
Give.fn.unFormatCurrency will not able for unformat number if currency symbol contains decimal separator for example kr. 54,000 will be converted to 0.54 instead of 54000.

To fix this issue we are removing currency symbol from currency before passing to accounting unformat function.
ravinderk added a commit that referenced this issue Feb 23, 2018
Give.fn.unFormatCurrency will not able for unformat number if currency symbol contains decimal separator for example kr. 54,000 will be converted to 0.54 instead of 54000.

To fix this issue we are removing currency symbol from currency before passing to accounting unformat function.
ravinderk referenced this issue Feb 23, 2018
fix(form): unformat formatted price when contain currency symbol with decimal like kr.
DevinWalker added a commit that referenced this issue Feb 28, 2018
* release/2.1: (38 commits)
  fix(dashboard-widget): incorrect stat for this year #2847
  fix(cache): typo in text domain
  fix(cache): typo in function name
  fix(compat): resolve caching conflict with W3TC
  fix(form): #2838
  fix(compat): Change hook that load give text domain #2784
  style(code): improve formatting
  fix(form): sanitize default minimum amount
  fix(donation): Change Minimum Amount to 1.0 if empty  #2819
  fix(phpcs): Fix phpcs error #2819
  refactor(donation): Remove unwanted condition check #2819
  fix(donation): Fix amount format #2819
  fix(donation): Fix minimum donation amount check #2819
  refactor(import-settings): use core functions and sanitize $_POST
  feat(export): Make checkbox fields for export checked by default
  feat(export): Add feature to selectively export fields
  fix(media-uploads): upload file to correct folder
  fix(cache): prevent possible cache  conflict on multisite
  fix(db): use get_offset fn instead of repeatable logic
  style(db):improve code formatting
  ...
DevinWalker added a commit that referenced this issue Feb 28, 2018
* release/2.1: (39 commits)
  fix(dashboard-widget): incorrect stat for this year #2847
  fix(cache): typo in text domain
  fix(cache): typo in function name
  feat(admin-plugin): Add Give menu in plugin menu section #2278
  fix(compat): resolve caching conflict with W3TC
  fix(form): #2838
  fix(compat): Change hook that load give text domain #2784
  style(code): improve formatting
  fix(form): sanitize default minimum amount
  fix(donation): Change Minimum Amount to 1.0 if empty  #2819
  fix(phpcs): Fix phpcs error #2819
  refactor(donation): Remove unwanted condition check #2819
  fix(donation): Fix amount format #2819
  fix(donation): Fix minimum donation amount check #2819
  refactor(import-settings): use core functions and sanitize $_POST
  feat(export): Make checkbox fields for export checked by default
  feat(export): Add feature to selectively export fields
  fix(media-uploads): upload file to correct folder
  fix(cache): prevent possible cache  conflict on multisite
  fix(db): use get_offset fn instead of repeatable logic
  ...
@mehul0810
Copy link
Contributor

Slack Call Summary

Participants: @mehul0810 @ravinderk
Topic: Discussion about functioning of currency unformatting
Result: @ravinderk explained how we have bound currency unformatting. I will check with the currency having , as decimal operator

@mehul0810
Copy link
Contributor

@ravinderk Currencies with , (comma) as decimal operators like Colombian peso or Costa Rican Colon are not unformatting currency properly as shown in below screenshot.
image

Also, have a question, how we are handling currencies which can have , as well as . as a decimal operator as per https://en.wikipedia.org/wiki/Decimal_separator? Countries using both marks are South Africa, Namibia, and Luxembourg.

@ravinderk
Copy link
Collaborator

Fix: d7ba094

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

No branches or pull requests

3 participants