Skip to content

fix: tax rate inputs blank with comma-decimal locales (#4555) - #1

Merged
waleedbutt merged 1 commit into
productionfrom
master
Jun 8, 2026
Merged

waleedbutt merged 1 commit into
productionfrom
master

Conversation

@waleedbutt

Copy link
Copy Markdown
Collaborator
  • fix: tax rate inputs blank with comma-decimal locales

The to_tax_decimals() function returns locale-formatted values (e.g. "18,00" for comma-decimal locales like fr_FR, de_DE). Browsers reject comma-decimal values in and render the field blank.

Use raw float value instead - PHP serializes floats with period decimal regardless of locale. The parse_tax() on the save side already handles locale-aware parsing, so round-tripping works correctly.

Fixes opensourcepos#4553
Regression from commit 42ba39d

  • fix: tax rate input locale handling - save path

The display fix (using (float) instead of to_tax_decimals()) was correct but incomplete. The save path in Config.php also needed fixing because parse_tax() misinterprets dot-decimal values from type="number" inputs when locale uses comma as decimal separator.

Root cause: Browsers submit type="number" inputs as dot-decimal (e.g., "5.5") regardless of locale. With comma-decimal locales like de_DE, parse_tax() treats the dot as thousands separator, causing 5.5 to be saved as 5.

Fix: Replace parse_tax() with direct (float) cast for these inputs since type="number" already guarantees dot-decimal format.

Includes tests for tax rate handling with various decimal values.

Fixes opensourcepos#4553

  • revert: remove type=number from tax rate inputs

Resolution from PR opensourcepos#4555 review: Revert to text inputs for locale-specific tax rate fields.

The type='number' attribute was added in commit 42ba39d, but it caused issues with locale-specific decimal separators. Browsers submit type='number' inputs as dot-decimal regardless of locale, which breaks comma-decimal locales.

Solution: Revert to text inputs which use to_tax_decimals() for display and parse_tax() for saving, correctly handling locale-specific formatting.

Changes:

  • tax_config.php: Remove type='number', step, min, max attributes
  • tax_config.php: Restore to_tax_decimals() for value display
  • Config.php: Restore parse_tax() for tax rate parsing
  • ConfigTest.php: Remove tests added for the type='number' approach

Fixes opensourcepos#4553


…4555)

* fix: tax rate inputs blank with comma-decimal locales

The to_tax_decimals() function returns locale-formatted values
(e.g. "18,00" for comma-decimal locales like fr_FR, de_DE).
Browsers reject comma-decimal values in <input type="number">
and render the field blank.

Use raw float value instead - PHP serializes floats with period
decimal regardless of locale. The parse_tax() on the save side
already handles locale-aware parsing, so round-tripping works
correctly.

Fixes opensourcepos#4553
Regression from commit 42ba39d

* fix: tax rate input locale handling - save path

The display fix (using (float) instead of to_tax_decimals()) was
correct but incomplete. The save path in Config.php also needed
fixing because parse_tax() misinterprets dot-decimal values from
type="number" inputs when locale uses comma as decimal separator.

Root cause: Browsers submit type="number" inputs as dot-decimal
(e.g., "5.5") regardless of locale. With comma-decimal locales
like de_DE, parse_tax() treats the dot as thousands separator,
causing 5.5 to be saved as 5.

Fix: Replace parse_tax() with direct (float) cast for these
inputs since type="number" already guarantees dot-decimal format.

Includes tests for tax rate handling with various decimal values.

Fixes opensourcepos#4553

* revert: remove type=number from tax rate inputs

Resolution from PR opensourcepos#4555 review: Revert to text inputs for locale-specific
tax rate fields.

The type='number' attribute was added in commit 42ba39d, but it caused
issues with locale-specific decimal separators. Browsers submit type='number'
inputs as dot-decimal regardless of locale, which breaks comma-decimal locales.

Solution: Revert to text inputs which use to_tax_decimals() for display
and parse_tax() for saving, correctly handling locale-specific formatting.

Changes:
- tax_config.php: Remove type='number', step, min, max attributes
- tax_config.php: Restore to_tax_decimals() for value display
- Config.php: Restore parse_tax() for tax rate parsing
- ConfigTest.php: Remove tests added for the type='number' approach

Fixes opensourcepos#4553

---------

Co-authored-by: Ollama <[email protected]>
@waleedbutt
waleedbutt merged commit 41e31f9 into production Jun 8, 2026
@waleedbutt
waleedbutt deleted the master branch June 8, 2026 22:56
@waleedbutt
waleedbutt restored the master branch June 15, 2026 04:58
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

Successfully merging this pull request may close these issues.

Tax rate inputs blank with comma-decimal locales (az_AZ, fr_FR, etc.) after type=number added

2 participants