-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
4158 Add validation to disallow negative quantity for kit items. #4163
4158 Add validation to disallow negative quantity for kit items. #4163
Conversation
On a quick testing, I am seeing a problem -- in that if we have an error, the line items are disappearing (and they shouldn't). That's a separate, pre-existing issue, though. |
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.
@aniketpatidar Thanks for the PR!
My main role is looking out for the end-user's interest, rather than making sure the technical aspects are perfect.
I'd like to see a friendlier error message here -- the person trying to enter a kit might not understand what they did wrong when they see "Line items.quantity must be a positive number, Line items is invalid," as we don't use that wording in the user interface.
For a model of friendlier errors, I recommend you look in a couple of places:
1/ On kit, If the value for kit is negative, we have a friendlier message: "Value in cents must be greater than or equal to 0",
2/ A better model for this case is on distributions. If we enter a negative item quantity there we give an error like this: "Sorry, we weren't able to save the distribution. Validation failed: Inventory Adult Briefs (Large/X-Large)'s quantity needs to be at least 1"
So, if you could, please, make the error something like "Sorry, we weren't able to save the kit. Validation failed: [Item name]'s quantity needs to be at least 1" that would be ideal.
Thanks again.
Sure, I'll make those adjustments to the error message in the PR. Thanks for the detailed feedback! @cielf |
That will be better than what you had, but I would prefer it without the "Line Items is invalid". Can you model it after how it is handled with the distributions (which, I believe, also deals with line items, but is not showing that 'line items is invalid')? Thanks. |
I will make these changes as per your suggestion. Thanks! |
I've made the updates as per your suggestion. |
Looks good, functionality-wise, to me. @dorner - can you take a look from a technical p.o.v.? |
I'll make those changes. Thanks! |
f169e41
to
e55d267
Compare
I've made the updates as per your suggestion. |
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.
Looks good, thanks! In the future, please don't force-push the branch (or do a sync with rebase) since it blows away the history of the review.
Got it, noted for the future. Thanks for the heads-up! @dorner |
Looks good to me too. Note: I have added fixing the disappearing info on error to our long list of things to write up for people to fix. |
…rgood#4163" This reverts commit ceec002.
Resolves #4158
Description
This PR fixes the validation for the quantity of items in a kit. Previously, negative values were allowed for the quantity, which does not make sense. This change ensures that only positive values are allowed for the quantity of items in a kit.
Type of change
How Has This Been Tested?
To test this change:
It gives you an error.