Skip to content
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-6219: Obs should be considered a group if it ever had group members #4544

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions api/src/main/java/org/openmrs/validator/ObsValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ private void validateHelper(Obs obs, Errors errors, List<Obs> ancestors, boolean
errors.rejectValue("obsDatetime", "error.null");
}

boolean isObsGroup = obs.hasGroupMembers(true);
// if this is an obs group (i.e., parent) make sure that it has no values (other than valueGroupId) set
if (obs.hasGroupMembers()) {
if (isObsGroup) {
if (obs.getValueCoded() != null) {
errors.rejectValue("valueCoded", "error.not.null");
}
Expand Down Expand Up @@ -150,7 +151,7 @@ else if (obs.getValueBoolean() == null && obs.getValueCoded() == null && obs.get
errors.rejectValue("concept", "error.null");
}
// if there is a concept, and this isn't a group, perform validation tests specific to the concept datatype
else if (!obs.hasGroupMembers()) {
else if (!isObsGroup) {
ConceptDatatype dt = c.getDatatype();
if (dt != null) {
if (dt.isBoolean() && obs.getValueBoolean() == null) {
Expand Down
Loading