From 4d6ebbafdd5eb55cb4603c1dd08eed641756e6c0 Mon Sep 17 00:00:00 2001 From: jekkos Date: Sat, 6 Jun 2026 22:50:51 +0200 Subject: [PATCH] fix: tax rate inputs blank with comma-decimal locales (#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 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 #4553 Regression from commit 42ba39d29 * 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 #4553 * revert: remove type=number from tax rate inputs Resolution from PR #4555 review: Revert to text inputs for locale-specific tax rate fields. The type='number' attribute was added in commit 42ba39d29, 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 #4553 --------- Co-authored-by: Ollama --- app/Views/configs/tax_config.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/Views/configs/tax_config.php b/app/Views/configs/tax_config.php index 7b970e6a6..23248082c 100644 --- a/app/Views/configs/tax_config.php +++ b/app/Views/configs/tax_config.php @@ -51,10 +51,6 @@
'number', - 'step' => 'any', - 'min' => '0', - 'max' => '100', 'name' => 'default_tax_1_rate', 'id' => 'default_tax_1_rate', 'class' => 'form-control input-sm', @@ -76,10 +72,6 @@
'number', - 'step' => 'any', - 'min' => '0', - 'max' => '100', 'name' => 'default_tax_2_rate', 'id' => 'default_tax_2_rate', 'class' => 'form-control input-sm',