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

FLAG-19 : Exception when Saving Flag Without Message #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion api/src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,5 @@ patientflags.errors.noPriorityName=Priority name is required
patientflags.errors.noRank=Rank is required
patientflags.errors.priorityNameTooLong=Name can only be 255 characters in length
patientflags.errors.styleTooLong=Style can only be 255 characters in length
patientflags.errors.invalidUsername=No user with that username
patientflags.errors.invalidUsername=No user with that username
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has the above line got anything to do with this ticket?

patientflags.errors.noMessage= Message is required
1 change: 1 addition & 0 deletions api/src/main/resources/messages_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,5 @@ patientflags.errors.noPriorityName=Le nom de la priorité est requis
patientflags.errors.noRank=Le rang est requis
patientflags.errors.priorityNameTooLong=Un nom ne peut comporter que 255 caractères
patientflags.errors.styleTooLong=Le style ne peut comporter que 255 caractères
patientflags.errors.noMessage= Message est requis
patientflags.errors.invalidUsername=Aucun utilisateur avec ce nom d''utilisateur
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public void validate(Object target, Errors errors) {

// name cannot be empty
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "patientflags.errors.noName");
// Message cannot be empty
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "message", "patientflags.errors.noMessage");

// criteria is no longer required, because of custom cases
//ValidationUtils.rejectIfEmptyOrWhitespace(errors, "criteria", "patientflags.errors.noCriteria");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ public boolean supports(Class clazz) {
public void validate(Object target, Errors errors) {
Priority priorityToValidate = (Priority) target;

// name and rank cannot be empty
// name , message and rank cannot be empty
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "patientflags.errors.noPriorityName");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "rank", "patientflags.errors.noRank");

ValidationUtils.rejectIfEmptyOrWhitespace(errors, "message", "patientflags.errors.noMessage");

// make sure that the name field isn't too large
if(priorityToValidate.getName().length() > 255)
errors.rejectValue("name", "patientflags.errors.priorityNameTooLong");
Expand Down