Forms In "General Actions" Section of the Ref App Patient Dashboard Should not be Opened in the Active Visit Context

Context

Using the reference application we want to be able to record past visit notes even when there is an existing active visit for a patient but this does not seem to be possible with the way the ref app is behaving when comparing the “Current Visit Actions” as opposed to “General Actions” on the patient dashboard.

Current Behavior

On the patient dashboard of the reference application I noticed that if a form is added to both the “Current Visit Actions” and the “General Actions” sections the way the application behaves when opening it is the same when there is an active visit. That is, the form is opened in the context of the active visit. This happens even when the user decides to open a previous visit from the “Recent Visit” section. I know this because I duplicated the “Visit Note” which comes built in, added the duplicate to the “General Actions” section via the Configure Metadata → Manage Forms. When I opening the form while there is no any active visit, I am able to change the encounter date to whatever past date I want (i.e. the date picker only restricts future dates, see below)





On the other hand when there is an active visit, the date picker restricts the date choice to the active visit date range (if the visit happens to span multiple days, see below)





This happens even when the form is opened in the context of the past visits(See below).





Desired Behavior

I think the “General actions” forms should not be restricted to the active visit context, also performing action in a previous visit context should happen in the context of the previous visit.

I am using Reference application version 2.6.1.

Are you able to reproduce this in the latest release of the reference application? For instance here http://demo.openmrs.org/

Attempting to create a new HTML form on https://demo.openmrs.org throws the exception below.

HTTP Status 500 - Request processing failed; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value : org.openmrs.Form.dateCreated type Exception report

message Request processing failed; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value : org.openmrs.Form.dateCreated

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value : org.openmrs.Form.dateCreated

How about here? http://qa-refapp.openmrs.org/

Thank you. Yes the behavior is reproducible on the QA server.

In other words, you would like the general actions forms to be saved in the context of the current and past visits?

I think the general actions should be general meaning they should not be tied to the current active visit. Just to be clear below is what I think should happen.

  1. If there is an active visit, when the user clicks a general action, the action should not be tied to that active visit because there is already a current visit actions section which in my opinion should be the right place for that type of behavior.

  2. If there is no active visit, the application actually behaves the way it should. Only general actions are displayed and they are not tied to any specific visit.

  3. On the other hand if a user is on the visit page, the actions which by the way are not distinguished as general vs current should apply to the current opened visit as the message on the page implies anyway as opposed to always be tied to either the active visit if available or not tied to any visit if there isn’t any active visit already.

Just for the sake of completeness, do you have a current use case that is affected by this state of things? If yes, do you mind describing it?

It is specified in the initial part of the original post.

Do you wanna create a ticket for this?