Lite version: Fix number field validation for custom decimal separators#2248
Lite version: Fix number field validation for custom decimal separators#2248shervElmi wants to merge 2 commits into
Conversation
WalkthroughThe changes introduce a new static method in a currency helper class that normalizes decimal characters in number strings. Additionally, updates to a field type class now retrieve a custom decimal separator and use the new helper method when processing minimum and maximum numeric values. These modifications adjust how decimal values are interpreted for validation. Changes
Sequence Diagram(s)sequenceDiagram
participant FT as FrmFieldType::add_min_max
participant Field as FrmField::get_option
participant CH as FrmCurrencyHelper
FT->>Field: get_option('custom_decimal_separator')
FT->>Field: get_option('minnum')
FT->>Field: get_option('maxnum')
FT->>CH: replace_custom_decimal_char(minnum, custom_decimal_separator)
FT->>CH: replace_custom_decimal_char(maxnum, custom_decimal_separator)
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
⏰ Context from checks skipped due to timeout of 90000ms (9)
🔇 Additional comments (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
| } | ||
|
|
||
| $max = FrmField::get_option( $this->field, 'maxnum' ); | ||
| $max = FrmCurrencyHelper::replace_custom_decimal_char( FrmField::get_option( $this->field, 'maxnum' ), $decimal_separator ); |
There was a problem hiding this comment.
It would be nice if we could do this without requiring changes in Lite.
This is also rather dangerous, since we don't really want to use custom_decimal_separator in Lite even if it does exist, since the setting could no longer be available to someone who is no longer using Pro.
There was a problem hiding this comment.
I’ve reverted these changes and will handle them in Pro. However, let’s keep replace_custom_decimal_char in the Lite version with this PR. Does that sound good to you?
There was a problem hiding this comment.
If it isn't being used in Lite I don't see why it would make sense in Lite.
There was a problem hiding this comment.
I thought it might be useful in the future, but you’re right. 👍🏻
There was a problem hiding this comment.
@Crabcyborg, could you close this PR? I’ve made the necessary changes in the Pro version.
Main PR:
https://github.com/Strategy11/formidable-pro/pull/5629#issuecomment-2663420187