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/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; 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',