Skip to content

Keep review-required cases whole when updating or closing them - #786

Merged
labkey-martyp merged 13 commits into
release26.7-SNAPSHOTfrom
26.7_fb_case_update_review_required
Nov 28, 2026
Merged

labkey-martyp merged 13 commits into
release26.7-SNAPSHOTfrom
26.7_fb_case_update_review_required

Conversation

@labkey-martyp

@labkey-martyp labkey-martyp commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Rationale

This PR keeps a clinical case and the rest of its task in step whenever the case is saved from another form or closed, asks the user before a case form moves an existing Completed case to a new status, and stops same-day case closures from leaving the case's task impossible to save. Using Case Update on a case still in Review Required saved it from a new task, which moved only the case to Completed and left its remarks, observations and orders in review, still blocking death and departure entry for the animal; the Record Procedure and Record Treatment links did the same through the Clinical and Behavioral Rounds forms. Separately, closing a case before its automatic daily observation orders started gave those orders an end date before their start date, which raised a warning that disabled Submit Final on every later save of the task.

Related Pull Requests

None.

Changes

  • Case Update opens the case's own task until the case is Completed; a Completed case, or one on no task, opens a new case form instead.
  • Submitting a clinical or behavioral case form for an existing case that is Completed or on no task asks whether to move the whole case to the new status and onto the form's task, or to save only the form's other records; the case's own edits save either way.
  • A save from another task keeps the case's status and task unless the user moves it; one that edits a case still unfinished on its own task and would change its status is rejected with a message pointing to the case's own task.
  • Saving a draft never takes a submitted case back to In Progress, and a draft that edits such a case is rejected.
  • Rounds forms hide the case's Edit button and lock its date and time inputs, so the case stays read-only there.
  • A saved case always opens locked behind Edit, including its date and time inputs, and Edit never unlocks the animal Id; a case created on the page stays open after Save Draft.
  • Closing a case ends its orders in the same save, ending an order that starts after the close on its own start date, and deletes the unstarted daily observation orders that have no recorded observations.
  • Closing a case never moves an earlier order end date later, and moving a close later or clearing it reopens the orders that close ended.
  • The form's stale copy of an order can no longer overwrite an end date that closing or reopening the case set.
  • A case save changes its orders as the EHR admin user, so the saving user needs no rights to the case's Completed and Review Required orders.
  • Tests cover the Case Update link, the own-task status guard, drafts and moves on a submitted case, same-day case closes, recording a procedure against a case in review, and a review round trip through the case status dialog.

Case Update opens a case's own task while it is in review, so finalizing it completes the whole task, and closing a case deletes its not-yet-started daily observation orders instead of ending them before they begin.
Record Procedure and Record Treatment open a Rounds form on a new task whose Submit Final completed the case alone; the case now stays in review until its own task is finalized. Adds tests for the review-state guard, the Case Update link, and same-day case closes.
The test helper never asked for Completed, so the other-task check passed without exercising the guard.
The closing vet may lack delete permission on Completed and Review Required orders; orders that can't be deleted or already have observations now end on their start date instead. Case-close tests now save as a vet instead of the site admin.
Another task's save keeps the case's task and status, and is refused when it also edits the case; the Case Update link reopens the case's own task until the case is Completed. Also fixes three case tests that failed on this branch.
…eeping

A Case Update on a Completed case now moves the case to the new task so it can go back to review; vetreview fields rewritten on every save no longer count as case changes. Adds a test round-tripping a case between review and completed.
Closing a case now ends its orders in the same transaction and deletes unstarted ones after commit, an unchanged end date no longer reruns the close, and the cross-task case error says how to proceed.
Locking a case panel now also disables the date and time inputs inside its date fields, and Rounds forms no longer show a dead Edit button when a draft is reopened.
Cases on no task now get the status guard, Case Update opens the owning task of any form, and closing a case restores deleted orders when its close moves later, treats a date-only close as the whole day, and runs only after the close checks pass.
Closing a case now deletes only unstarted daily clinical observation orders, and automatic orders are inserted as the EHR service user.
Saves keep an existing case's status and task unless the user chooses to move it, and a draft never takes a submitted case back to In Progress. Also keeps the end dates a case close or reopen sets on its orders from being overwritten by the form's stale copy.

@labkey-martyp labkey-martyp left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Existing and new tests passing

@labkey-martyp
labkey-martyp merged commit b780e23 into release26.7-SNAPSHOT Nov 28, 2026
5 checks passed
@labkey-martyp
labkey-martyp deleted the 26.7_fb_case_update_review_required branch November 28, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants