Add project, protocol, group and location to the Rearrival form - #39
Merged
labkey-martyp merged 2 commits intoSep 11, 2026
Merged
Conversation
Acquisition type and CITES are hidden in their place, since a rearrival is not a new acquisition. The trigger now opens the project, protocol, group and housing records that the animal's departure closed, and sets calculated_status back to Alive when the rearrival is completed, reversing the rearrival carve-out made in #28.
A rearrival saved as In Progress or Review Required now writes Alive - In Progress like an arrival draft does, instead of leaving the animal Shipped while its housing and assignments are opened. The script-local demographics cache call is removed because validation never reads it; the demographics update itself refreshes the server-side animal cache.
labkey-bpatel
approved these changes
Sep 10, 2026
labkey-martyp
added a commit
to LabKey/ehrModules
that referenced
this pull request
Sep 11, 2026
## Rationale Any status recalculation for an animal that has arrived more than once fails with a database error instead of saving. The recalculation reads the animal's acquisition type from the arrival dataset filtered only on the animal, which throws as soon as a second arrival row exists. Death entry is the common way to hit this, and it is worst at centers that leave the status to the recalculation rather than writing it directly, where the save and the status are both lost. This surfaced while adding rearrivals to an institution module, but it affects every center whose arrival dataset carries an acquisition type. ## Related Pull Requests - LabKey/nircEHRModules#758 - LabKey/nbriEHRModules#39 ## Changes - Read the acquisition type from the animal's most recent arrival rather than from all of its arrival records at once.
labkey-martyp
commented
Sep 11, 2026
labkey-martyp
left a comment
Contributor
Author
There was a problem hiding this comment.
No related test failures.
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
The Rearrival form collects fields that do not apply to a returning animal and omits the ones that do, and a completed rearrival leaves the animal in a departed state. It asks for an acquisition type and a CITES number, though an animal that is coming back was already acquired, and it does not ask which project, protocol, group or location the animal returns to. This reverses the decision in #28 to leave rearrivals out of those assignment fields: a departure closes an animal's project, protocol, group and housing records, so a returning animal has none of them left to keep and each has to be opened again, along with putting the animal back to Alive.
Related Pull Requests
Changes