-
Notifications
You must be signed in to change notification settings - Fork 93
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
Add validation for 2 positive integer fields #146
Conversation
leemyongpakvn
commented
Jul 1, 2022
Questions | Answers |
---|---|
Description? | Field requires positive integer value need validation before saving |
Type? | improvement |
BC breaks? | no |
Deprecations? | no |
Fixed ticket? | Fixes PrestaShop/PrestaShop#28929 |
How to test? | Check above issue |
Field requires positive integer value need validation before saving
Hello @leemyongpakvn Thank you for your involvement in the project Code Before : Code After : Thank you again. |
@okom3pom Thanks for your tool suggestion. I have updated with php-cs-fixer's fixed code. |
'%s is invalid. Please enter an integer greater than %s.'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for this PR. I report 2 types of improvement that can be made for my opinion. I let you take a look on these.
In fact, in Validate class: isUnsignedId is just an alias of isUnsignedInt Co-authored-by: Amoifr <31698966+Amoifr@users.noreply.github.com>
Co-authored-by: Amoifr <31698966+Amoifr@users.noreply.github.com>
Clearer variable name and function name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @leemyongpakvn ,
Thanks for the PR!
Tested the following on 1.7.8.x
, 8.0.x
and develop
branch:
Special characters, accented characters, mix of integer/char, fractioned number, negative number.
If using any of the above characters, it won't save. I have an error message: ✅
But if I enter 0
in BO, it will save. ❌
Therefore, there's an error in FO, I can paginate infinitely: ❌
Screen.Recording.2022-09-15.at.10.43.32.mov
Another thing is missing in the alert: the cross to close it. ❌
For example:
Could you check ?
Thanks!
and Better Module display message functions
@florine2623 Thanks for testing and informing. I have added one more positive number check and used Module::displayError for close button. @kpodemski has checked again and approved :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @leemyongpakvn ,
Tested on 1.7.8.x, 8.0.x, develop.
Looking great !
Alert message is fixed, 0 can't be saved, FO pagination is now OK.
It is QA ✅ !
Thanks!
Thanks @leemyongpakvn :) |