diff --git a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonNameResource1_8.java b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonNameResource1_8.java index 171c10cd7..4d0faf912 100644 --- a/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonNameResource1_8.java +++ b/omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/PersonNameResource1_8.java @@ -216,6 +216,14 @@ public void purge(PersonName pn, RequestContext context) throws ResponseExceptio */ @Override public PersonName save(PersonName newName) { + if (newName.isPreferred()){ + for (PersonName pN : newName.getPerson().getNames()){ + if (!pN.equals(newName)){ + pN.setPreferred(false); + } + } + } + // make sure that the name has actually been added to the person boolean needToAdd = true; for (PersonName pn : newName.getPerson().getNames()) {