From 6bfca4f2325806fa83b14a06cd6bb108e0517977 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Tue, 22 Sep 2026 14:18:32 -0700 Subject: [PATCH 1/4] Count only current occupants in roomUtilization (#55) ## Rationale Room occupancy counts in the room utilization query report every animal ever housed in a room rather than the animals housed there now, so a count never drops when a room empties. The count feeds the "show occupied only" option in the room picker, which as a result cannot hide a room that was ever used. ## Related Pull Requests None. ## Changes - Restrict the housing join in the room utilization query to current, non-draft stays. - Keep the restriction in the join condition rather than a filter, so rooms with no current occupants are still reported. --- nbri_ehr/resources/queries/ehr_lookups/roomUtilization.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nbri_ehr/resources/queries/ehr_lookups/roomUtilization.sql b/nbri_ehr/resources/queries/ehr_lookups/roomUtilization.sql index de3fa9e..4b15932 100644 --- a/nbri_ehr/resources/queries/ehr_lookups/roomUtilization.sql +++ b/nbri_ehr/resources/queries/ehr_lookups/roomUtilization.sql @@ -11,6 +11,6 @@ SELECT r.area, FROM ehr_lookups.rooms r LEFT JOIN study.housing h -ON r.room = h.room +ON r.room = h.room AND h.isActive = true AND h.qcstate.publicdata = true GROUP BY r.room, r.building, r.area \ No newline at end of file From d70690fbcade7d7af20c417bd3586501f9dc6a8e Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Wed, 23 Sep 2026 13:53:46 -0700 Subject: [PATCH 2/4] Lock the case Id once a saved case is loaded (#57) ## Rationale Prevents an existing case from being reassigned to a different animal through the data entry forms. Editing a saved case re-enabled every field on the case panel, including the animal Id, so a case could silently be moved to another animal with no warning and no record of the original. ## Related Pull Requests None. ## Changes - The animal Id stays read-only once a saved case is loaded on the Clinical Cases, Behavioral Cases, Clinical Rounds and Behavioral Rounds forms. - Creating a new case is unaffected; the Id is editable until the case is saved. --- nbri_ehr/resources/web/nbri_ehr/field/EditCase.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/nbri_ehr/resources/web/nbri_ehr/field/EditCase.js b/nbri_ehr/resources/web/nbri_ehr/field/EditCase.js index 9b240a5..16f9421 100644 --- a/nbri_ehr/resources/web/nbri_ehr/field/EditCase.js +++ b/nbri_ehr/resources/web/nbri_ehr/field/EditCase.js @@ -74,10 +74,14 @@ Ext4.define('NBRI_EHR.form.EditCases', { fieldEnableChange: function(disable){ var panel = this.up('panel'); panel.items.each(function(item){ - if (item.name != 'objectid'){ - this.disableItem(item, disable); - this.disabledDisplay(item, disable); - } + if (item.name === 'objectid') + return; + + // A saved case stays bound to its animal, so Edit must never reopen the Id. + var itemDisable = disable || (this.editing && item.name === 'Id'); + + this.disableItem(item, itemDisable); + this.disabledDisplay(item, itemDisable); }, this); }, @@ -93,11 +97,11 @@ Ext4.define('NBRI_EHR.form.EditCases', { }, onCaseSelect: function(){ + this.editing = true; this.fieldEnableChange(true); if (this.readonly) { return; } - this.editing = true; this.disabled = true; this.editBtn.show(); }, From 7461428e94eb6f11925830ddb9c980c53758b449 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Wed, 23 Sep 2026 15:07:21 -0700 Subject: [PATCH 3/4] Auto-assign distinct project ids on project insert (#58) ## Rationale New projects could not be entered through the Import Data page, and multi-row imports gave every project the same Project Id. The Import Single form treated the blank Project Id as a required field and blocked submit, even though the trigger assigns it; that trigger then reused one id for every row in an import, which breaks updates and deletes by key. ## Related Pull Requests None. ## Changes - Hide Project Id from the insert and update forms so the trigger can assign it. - Assign each imported row its own Project Id. --- nbri_ehr/resources/queries/ehr/project.js | 2 +- nbri_ehr/resources/queries/ehr/project.query.xml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/nbri_ehr/resources/queries/ehr/project.js b/nbri_ehr/resources/queries/ehr/project.js index bb57d44..33ecb6e 100644 --- a/nbri_ehr/resources/queries/ehr/project.js +++ b/nbri_ehr/resources/queries/ehr/project.js @@ -26,7 +26,7 @@ function onInit(event, helper){ function onUpsert(helper, scriptErrors, row, oldRow) { if (!helper.isETL()) { if (!row.project) { - row.project = nextProjectNum; + row.project = nextProjectNum++; } } } \ No newline at end of file diff --git a/nbri_ehr/resources/queries/ehr/project.query.xml b/nbri_ehr/resources/queries/ehr/project.query.xml index 97ce065..cd38553 100644 --- a/nbri_ehr/resources/queries/ehr/project.query.xml +++ b/nbri_ehr/resources/queries/ehr/project.query.xml @@ -17,6 +17,9 @@ Project Id + + false + false From b4770657cddad02b331609dd6fc80d74a8c83010 Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Mon, 28 Sep 2026 09:57:15 -0700 Subject: [PATCH 4/4] Add perDiem column to cages (#59) ## Rationale Adds a perDiem column to ehr_lookups.cage so each cage can carry its per diem billing code. ## Related Pull Requests None. ## Changes - New short text column (up to 10 characters) on the cage table, provisioned through the domain template - Column titled "Per Diem" and shown in the default cages grid --- nbri_ehr/resources/domain-templates/ehr_lookups.template.xml | 4 ++++ nbri_ehr/resources/queries/ehr_lookups/cage.query.xml | 3 +++ nbri_ehr/resources/queries/ehr_lookups/cage/.qview.xml | 1 + 3 files changed, 8 insertions(+) diff --git a/nbri_ehr/resources/domain-templates/ehr_lookups.template.xml b/nbri_ehr/resources/domain-templates/ehr_lookups.template.xml index 051dfb2..b96a281 100644 --- a/nbri_ehr/resources/domain-templates/ehr_lookups.template.xml +++ b/nbri_ehr/resources/domain-templates/ehr_lookups.template.xml @@ -55,6 +55,10 @@ string + + string + 10 + dateTime diff --git a/nbri_ehr/resources/queries/ehr_lookups/cage.query.xml b/nbri_ehr/resources/queries/ehr_lookups/cage.query.xml index c3b3060..88ddffe 100644 --- a/nbri_ehr/resources/queries/ehr_lookups/cage.query.xml +++ b/nbri_ehr/resources/queries/ehr_lookups/cage.query.xml @@ -33,6 +33,9 @@ value + + Per Diem + diff --git a/nbri_ehr/resources/queries/ehr_lookups/cage/.qview.xml b/nbri_ehr/resources/queries/ehr_lookups/cage/.qview.xml index 6f9c44d..6d3b27f 100644 --- a/nbri_ehr/resources/queries/ehr_lookups/cage/.qview.xml +++ b/nbri_ehr/resources/queries/ehr_lookups/cage/.qview.xml @@ -3,6 +3,7 @@ +