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

CI4: Localization issue with decimals in Customer view modal #3893

Closed
objecttothis opened this issue Dec 12, 2023 · 5 comments
Closed

CI4: Localization issue with decimals in Customer view modal #3893

objecttothis opened this issue Dec 12, 2023 · 5 comments
Assignees
Labels
bug CodeIgniter4 Issue relates to the conversion to CodeIgniter 4
Milestone

Comments

@objecttothis
Copy link
Member

objecttothis commented Dec 12, 2023

Currently only entering decimals using a period . decimal separator works properly. If the selected localization uses a comma , for the decimal separator, entering values per localization settings does not work properly.

For example entering 5,45
image

results in 545.00 being stored, recalled and displayed
image

This is generally an issue in all text fields where decimals are entered.

Two issues need to be addressed
1- Localization specific validation of numbers
2- Proper conversion, storage and display in the database. The database/business logic should always use, store and return decimals using a period.

It appears what is happening is that the comma is being stripped out rather than replaced. I suspect the code is assuming the comma is used for a thousands separator, which should be stripped out when storing decimals

@objecttothis objecttothis added bug CodeIgniter4 Issue relates to the conversion to CodeIgniter 4 labels Dec 12, 2023
@objecttothis objecttothis added this to the 3.4.0 milestone Dec 12, 2023
@jekkos jekkos self-assigned this Dec 29, 2023
@jekkos
Copy link
Member

jekkos commented Dec 29, 2023

MIght be related to #3872 . I was looking into that function today. I'm not sure if the validation actually works, it will try to parse the number in the configured locale and stop the submit in case this does not work. I had the impression that it accepted just about anything

@objecttothis
Copy link
Member Author

This is a problem in the sales register view as well.

@objecttothis objecttothis assigned objecttothis and unassigned jekkos Mar 12, 2024
@objecttothis
Copy link
Member Author

I've made a few changes to the decimal parsing in the locale helper and wrapped a few values in the parsing functions. I still need to work through suppliers and on to find any others.

@objecttothis
Copy link
Member Author

Pushed another commit to fix this issue in the sales controller. We are going to need to apply these same fixes for decimals throughout the code if we want them to be compatible with the comma for decimal separator.

@jekkos
Copy link
Member

jekkos commented Apr 30, 2024

still an issue this one, will check this later on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug CodeIgniter4 Issue relates to the conversion to CodeIgniter 4
Projects
None yet
Development

No branches or pull requests

2 participants