Repository navigation
Keep review-required cases whole when updating or closing them - #786
Merged
labkey-martyp merged 13 commits intoNov 28, 2026
Merged
Conversation
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.
labkey-bpatel
approved these changes
Nov 25, 2026
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
commented
Nov 28, 2026
labkey-martyp
left a comment
Contributor
Author
There was a problem hiding this comment.
Existing and new tests passing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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