diff --git a/nirc_ehr/resources/queries/study/arrival.js b/nirc_ehr/resources/queries/study/arrival.js
index 7f1d4366..9a245644 100644
--- a/nirc_ehr/resources/queries/study/arrival.js
+++ b/nirc_ehr/resources/queries/study/arrival.js
@@ -11,14 +11,12 @@ function onInit(event, helper){
});
}
-EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_INSERT, 'study', 'Arrival', function(helper, scriptErrors, row, oldRow) {
+EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_UPSERT, 'study', 'Arrival', function(helper, scriptErrors, row, oldRow) {
- if (triggerHelper.animalIdExists(row.Id)) {
+ // Due to order of operation, this needs to be done in upsert instead of insert
+ if (helper.getEvent() == 'insert' && row.Id && triggerHelper.animalIdExists(row.Id)) {
EHR.Server.Utils.addError(scriptErrors, 'Id', 'Animal Id ' + row.Id + ' is already in use. Please use a different Id.', 'ERROR');
}
-});
-
-EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_UPSERT, 'study', 'Arrival', function(helper, scriptErrors, row, oldRow) {
if (row.eventDate) {
row.date = row.eventDate;
diff --git a/nirc_ehr/resources/queries/study/deaths.query.xml b/nirc_ehr/resources/queries/study/deaths.query.xml
index efa2b558..cd8b8e8c 100644
--- a/nirc_ehr/resources/queries/study/deaths.query.xml
+++ b/nirc_ehr/resources/queries/study/deaths.query.xml
@@ -17,8 +17,12 @@
title
-
-
+
+ true
+
+
+ true
+
true
diff --git a/nirc_ehr/resources/queries/study/deaths/.qview.xml b/nirc_ehr/resources/queries/study/deaths/.qview.xml
index d04d768b..c6d14aec 100644
--- a/nirc_ehr/resources/queries/study/deaths/.qview.xml
+++ b/nirc_ehr/resources/queries/study/deaths/.qview.xml
@@ -7,7 +7,5 @@
-
-
\ No newline at end of file
diff --git a/nirc_ehr/resources/views/necropsy.html b/nirc_ehr/resources/views/necropsy.html
index f7390155..5b51a70d 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,remark,performedby,Id/lastProtocol/protocol,Id/lastProject/project',
+ columns: 'Id,Id/demographics/species,date,reason,Id/lastProtocol/protocol,Id/lastProject/project',
},
title: 'Death',
renderTo: 'animalDeath',
diff --git a/nirc_ehr/resources/web/nirc_ehr/model/sources/DeathNecropsy.js b/nirc_ehr/resources/web/nirc_ehr/model/sources/DeathNecropsy.js
index 4be79f4c..8deb34ba 100644
--- a/nirc_ehr/resources/web/nirc_ehr/model/sources/DeathNecropsy.js
+++ b/nirc_ehr/resources/web/nirc_ehr/model/sources/DeathNecropsy.js
@@ -12,6 +12,12 @@ EHR.model.DataModelManager.registerMetadata('DeathNecropsy', {
dateFormat: 'Y-m-d',
timeFormat: 'H:i'
},
+ },
+ remark: {
+ hidden: true
+ },
+ performedby: {
+ hidden: true
}
},
'study.necropsy': {
diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/section/NIRCTissueDispositionFormSection.java b/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/section/NIRCTissueDispositionFormSection.java
index 290d1193..ed018a20 100644
--- a/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/section/NIRCTissueDispositionFormSection.java
+++ b/nirc_ehr/src/org/labkey/nirc_ehr/dataentry/section/NIRCTissueDispositionFormSection.java
@@ -27,6 +27,7 @@ public List getTbarButtons()
List defaults = super.getTbarButtons();
defaults.remove("ADDANIMALS");
defaults.remove("TEMPLATE");
+ defaults.add("TEMPLATE_NO_ID_NO_DATE");
return defaults;
}
diff --git a/nirc_ehr/src/org/labkey/nirc_ehr/query/NIRC_EHRTriggerHelper.java b/nirc_ehr/src/org/labkey/nirc_ehr/query/NIRC_EHRTriggerHelper.java
index 0f86c196..af3d6d6c 100644
--- a/nirc_ehr/src/org/labkey/nirc_ehr/query/NIRC_EHRTriggerHelper.java
+++ b/nirc_ehr/src/org/labkey/nirc_ehr/query/NIRC_EHRTriggerHelper.java
@@ -267,13 +267,9 @@ public String saveBirthRecord(String id, Map row) throws QueryUp
public boolean animalIdExists(String id)
{
TableInfo ti = getTableInfo("study", "demographics");
- if (ti != null)
- {
- SimpleFilter filter = new SimpleFilter(FieldKey.fromString("Id"), id);
- TableSelector ts = new TableSelector(ti, PageFlowUtil.set("lsid"), filter, null);
- return ts.exists();
- }
- return false;
+ SimpleFilter filter = new SimpleFilter(FieldKey.fromString("Id"), id);
+ TableSelector ts = new TableSelector(ti, PageFlowUtil.set("lsid"), filter, null);
+ return ts.exists();
}
public boolean birthExists(String id)