End visit, Delete visit not working

I tried to delete and void visits of a patient from the legacy admin ui. But it results in errors:

When I try to end a visit, I get:

'Visit #3' failed to validate with reason: patient: Patient Id is required, visitType: Visit Type is required, startDatetime: Start date is required`

When trying to delete it throws the API exception:

SEVERE: org.springframework.dao.DataIntegrityViolationException: not-null property references a null or transient value : org.openmrs.Visit.startDatetime; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value : org.openmrs.Visit.startDatetime] with root cause
org.hibernate.PropertyValueException: not-null property references a null or transient value : org.openmrs.Visit.startDatetime

Are you able to reproduce this at? qa-refapp.openmrs.org

I am curious about this issue as well. Have you found out any solution for this ?

Did you reproduce it on qa-refapp?

I couldnt reprodoce it there. But I managed to fix it by

  1. Updating the visitForm.jsp. Change the hidden field name from patientId to patient.patientId

  2. Updating the VisitFormController.java. Both voidVisit and purgeVisit I updated with

    visit = Context.getVisitService().getVisit(visit.getId()); Context.getVisitService().voidVisit(visit, voidReason);

    visit = Context.getVisitService().getVisit(visit.getId()); Context.getVisitService().purgeVisit(visit);