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

HTML-777: Validate that encounter dates times are within visit start and end date. #48

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,16 @@ && hasNoTimeComponent(formEncounter.getEncounterDatetime())) {
new FormSubmissionError("general-form-error", ui.message("htmlformentryui.datetimeBeforeVisitDate")));
}

if (validationErrors.size() > 0) {
return returnHelper(validationErrors, fes, null);
}
} else if (visit != null) {
if (encounter.getEncounterDatetime().before(visit.getStartDatetime())) {
validationErrors.add(new FormSubmissionError("general-form-error", ui.message("htmlformentryui.datetimeAfterVisitDate")));
}
if (visit.getStopDatetime() != null && encounter.getEncounterDatetime().after(visit.getStopDatetime())) {
validationErrors.add(new FormSubmissionError("general-form-error", ui.message("htmlformentryui.datetimeBeforeVisitDate")));
}
if (validationErrors.size() > 0) {
return returnHelper(validationErrors, fes, null);
}
Expand Down