Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-2129

When saving voided Person PersonSaveHandler should make sure the personVoidReason field is not empty, *not* the (patient) voidReason

    Details

    • Complexity:
      Low

      Description

      Currently the PersonSaveHandler performs the following logic before saving a person:

      	// do the checks for voided attributes (also in PersonVoidHandler)
      		if (person.isPersonVoided()) {
      			
      			if (!StringUtils.hasLength(person.getVoidReason()))
      				throw new APIException(
      				        "The voided bit was set to true, so a void reason is required at save time for person: "
      				                + person);
      			
      			if (person.getPersonVoidedBy() == null) {
      				person.setPersonVoidedBy(creator);
      			}
      			if (person.getPersonDateVoided() == null) {
      				person.setPersonDateVoided(dateCreated);
      			}
      		} else {
      			// voided is set to false
      			person.setPersonVoidedBy(null);
      			person.setPersonDateVoided(null);
      			person.setPersonVoidReason(null);
      		}
      	}
      

      The line "if (!StringUtils.hasLength(person.getVoidReason())" should be changed to "if (!StringUtils.hasLength(person.getPersonVoidReason())" to be consistent.

      Technically, if a person is voided, the patient associated with that person should be voided as well... but I was getting the "The voided bit was set to true..." exception when the Sync module was trying to ingest a record. I couldn't track down exactly what was happening, but I think that there was a sync record created during an intermediate state of a voiding/unvoided a person workflow.

        Gliffy Diagrams

          Attachments

            Attachments-Category-Modification

              Activity

                People

                • Assignee:
                  mogoodrich Mark Goodrich
                  Reporter:
                  mogoodrich Mark Goodrich
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: