-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
TRUNK-6030 : The allergy field in the Allergy UI should validate the input string #4534
base: master
Are you sure you want to change the base?
Changes from 1 commit
29c680c
c6877ea
4ea96dc
e97ebe6
22c9a46
19764d3
e4b5326
78742af
339f7eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
moved `if` inside the `else` block
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,11 +63,6 @@ public void validate(Object target, Errors errors) { | |
ValidationUtils.rejectIfEmpty(errors, "patient", "allergyapi.patient.required"); | ||
|
||
Allergy allergy = (Allergy) target; | ||
|
||
// Additional validation: Ensure allergen does not contain numeric values | ||
if (allergy.getAllergen() != null && StringUtils.isNumeric(allergy.getAllergen().getNonCodedAllergen())) { | ||
errors.rejectValue("allergen", "error.allergyapi.allergy.Allergen.cannotContainNumeric"); | ||
} | ||
|
||
if (allergy.getReactionNonCoded() != null) { | ||
if (NumberUtils.isParsable(allergy.getReactionNonCoded())) { | ||
|
@@ -87,6 +82,11 @@ public void validate(Object target, Errors errors) { | |
} else if (!allergen.isCoded() && StringUtils.isBlank(allergen.getNonCodedAllergen())) { | ||
errors.rejectValue("allergen", "allergyapi.allergen.nonCodedAllergen.required"); | ||
} | ||
|
||
// Additional validation: Ensure allergen does not contain numeric values | ||
if (allergy.getAllergen() != null && StringUtils.isNumeric(allergy.getAllergen().getNonCodedAllergen())) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the condition There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ManojLL Done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @subhamkumarr When committing, include a meaningful commit message that references the relevant JIRA ticket ID, |
||
errors.rejectValue("allergen", "error.allergyapi.allergy.Allergen.cannotContainNumeric"); | ||
} | ||
|
||
if (allergy.getAllergyId() == null && allergy.getPatient() != null) { | ||
Allergies existingAllergies = patientService.getAllergies(allergy.getPatient()); | ||
|
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.
remove the comment