From 94ea7e2c60e1b53d86460a0214c005be7e063439 Mon Sep 17 00:00:00 2001 From: Binal Patel Date: Sat, 21 Feb 2026 19:42:19 -0800 Subject: [PATCH 1/2] Ticket 54467: Correct a death record (#665) * Allow admins to update Death records Co-authored-by: Marty Pradere --- nirc_ehr/resources/queries/study/deaths.js | 11 ++++++++--- nirc_ehr/resources/views/datasets.html | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/nirc_ehr/resources/queries/study/deaths.js b/nirc_ehr/resources/queries/study/deaths.js index 03b9d2df..99ef0498 100644 --- a/nirc_ehr/resources/queries/study/deaths.js +++ b/nirc_ehr/resources/queries/study/deaths.js @@ -71,11 +71,16 @@ function onUpsert(helper, scriptErrors, row, oldRow) { if (!helper.isETL()) { - //only allow death record to be created if animal is in demographics table + //skip other checks so that the admins can update a death record + if (helper.getEvent() === 'update' && LABKEY.Security.currentUser.isAdmin) { + return; + } + + //only allow death record to be created if the animal is in the demographics table if (idMap[row.Id]) { - // check if death record already exists for this animal - if (idMap[row.Id].calculated_status.toUpperCase() === 'DEAD' && row.QCStateLabel.toUpperCase() === 'COMPLETED') { + // check if a death record already exists for this animal + if (idMap[row.Id].calculated_status.toUpperCase() === 'DEAD' && deathIdMap[row.Id].QCStateLabel.toUpperCase() === 'COMPLETED') { EHR.Server.Utils.addError(scriptErrors, 'Id', 'Death record already exists for this animal.', 'ERROR'); } // check if the animal is at the center diff --git a/nirc_ehr/resources/views/datasets.html b/nirc_ehr/resources/views/datasets.html index 1b828030..f6a41502 100644 --- a/nirc_ehr/resources/views/datasets.html +++ b/nirc_ehr/resources/views/datasets.html @@ -6,7 +6,7 @@ const config = {displayField: 'Label', headerField: 'categoryId/label', target: webpart.wrapperDivId}; - const nonFormUpdates = ["Cases", "Procedures", "Drug Administration"]; + const nonFormUpdates = ["Treatment Cases", "Procedures", "Drug Administration", "Deaths"]; const hideUpdateRecords = []; @@ -66,12 +66,22 @@ params.queryUpdateURL = true; if(EHR.Security.hasPermission('Completed', 'update', {schemaName: 'study', queryName: item.queryName}) && hideUpdateRecords.indexOf(item.queryName) === -1){ - cfg.items.push({ + + if(nonFormUpdates.indexOf(item.queryName) !== -1) { + //adding an item here so that the 'Admin Update Records' link aligns with other links in the same "column" + cfg.items.push({ + xtype: 'box', + html: '' + }); + } + else { + cfg.items.push({ xtype: 'ldk-linkbutton', tooltip: item.searchTooltip || 'Click to update records', href: LABKEY.ActionURL.buildURL('ehr', 'updateQuery', null, params), text: 'Update Records' }); + } } params.queryUpdateURL = true; From c18875dba8f8dde8d50b5df2e7fe60145fa54d1c Mon Sep 17 00:00:00 2001 From: Marty Pradere Date: Sun, 22 Feb 2026 05:58:49 -0800 Subject: [PATCH 2/2] Couple small fixes (#666) * Add sex column to necropsy printable report * Make category user editable on cases --- nirc_ehr/resources/queries/study/cases.query.xml | 5 ++++- nirc_ehr/resources/views/necropsy.html | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/nirc_ehr/resources/queries/study/cases.query.xml b/nirc_ehr/resources/queries/study/cases.query.xml index fdf21f3e..b2b77625 100644 --- a/nirc_ehr/resources/queries/study/cases.query.xml +++ b/nirc_ehr/resources/queries/study/cases.query.xml @@ -50,7 +50,7 @@ Category - false + true false ehr_lookups @@ -61,6 +61,9 @@ true + + false + diff --git a/nirc_ehr/resources/views/necropsy.html b/nirc_ehr/resources/views/necropsy.html index 2d62d51b..49cfa91c 100644 --- a/nirc_ehr/resources/views/necropsy.html +++ b/nirc_ehr/resources/views/necropsy.html @@ -59,7 +59,7 @@ schemaName: 'study', queryName: 'deaths', filterArray: filterArray, - columns: 'Id,Id/demographics/species,date,reason,deathWeight,Id/lastProtocol/protocol,Id/lastProject/project', + columns: 'Id,Id/demographics/species,Id/demographics/gender,date,reason,deathWeight,Id/lastProtocol/protocol,Id/lastProject/project', }, title: 'Death', renderTo: 'animalDeath',