diff --git a/EHR_ComplianceDB/resources/schemas/dbscripts/postgresql/EHR_ComplianceDB-25.000-25.001.sql b/EHR_ComplianceDB/resources/schemas/dbscripts/postgresql/EHR_ComplianceDB-25.000-25.001.sql
new file mode 100644
index 000000000..52811f63a
--- /dev/null
+++ b/EHR_ComplianceDB/resources/schemas/dbscripts/postgresql/EHR_ComplianceDB-25.000-25.001.sql
@@ -0,0 +1 @@
+ALTER TABLE ehr_compliancedb.requirementsperemployee ADD COLUMN LSID LSIDtype;
\ No newline at end of file
diff --git a/EHR_ComplianceDB/resources/schemas/dbscripts/sqlserver/EHR_ComplianceDB-25.000-25.001.sql b/EHR_ComplianceDB/resources/schemas/dbscripts/sqlserver/EHR_ComplianceDB-25.000-25.001.sql
new file mode 100644
index 000000000..df2cbf19e
--- /dev/null
+++ b/EHR_ComplianceDB/resources/schemas/dbscripts/sqlserver/EHR_ComplianceDB-25.000-25.001.sql
@@ -0,0 +1 @@
+ALTER TABLE ehr_compliancedb.requirementsperemployee ADD Lsid LsidType null;
\ No newline at end of file
diff --git a/EHR_ComplianceDB/resources/schemas/ehr_compliancedb.xml b/EHR_ComplianceDB/resources/schemas/ehr_compliancedb.xml
index 824de80e8..7ea7baa14 100644
--- a/EHR_ComplianceDB/resources/schemas/ehr_compliancedb.xml
+++ b/EHR_ComplianceDB/resources/schemas/ehr_compliancedb.xml
@@ -453,6 +453,17 @@
true
Key
+
+ lsidtype
+ true
+ true
+ false
+
+ ObjectUri
+ Object
+ exp
+
+
Employee Id
diff --git a/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBModule.java b/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBModule.java
index b4616010b..c17ff3540 100644
--- a/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBModule.java
+++ b/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBModule.java
@@ -19,9 +19,11 @@
import org.jetbrains.annotations.Nullable;
import org.labkey.api.data.DbSchema;
import org.labkey.api.data.DbSchemaType;
+import org.labkey.api.exp.property.PropertyService;
import org.labkey.api.ldk.ExtendedSimpleModule;
import org.labkey.api.ldk.LDKService;
import org.labkey.api.ldk.notification.NotificationService;
+import org.labkey.ehr_compliancedb.model.EHRComplianceDBDomainKind;
import org.labkey.ehr_compliancedb.notification.EmployeeComplianceNotification;
import org.labkey.api.module.ModuleContext;
import org.labkey.ehr_compliancedb.api.EHR_ComplianceService;
@@ -49,7 +51,7 @@ public String getName()
@Override
public @Nullable Double getSchemaVersion()
{
- return 12.44;
+ return 25.001;
}
@Override
@@ -64,6 +66,7 @@ protected void init()
addController(CONTROLLER_NAME, EHR_ComplianceDBController.class);
EHR_ComplianceService.setInstance(new EHR_ComplianceServiceImpl());
+ PropertyService.get().registerDomainKind(new EHRComplianceDBDomainKind());
}
@Override
diff --git a/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBUserSchema.java b/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBUserSchema.java
index 82af20161..370843787 100644
--- a/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBUserSchema.java
+++ b/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/EHR_ComplianceDBUserSchema.java
@@ -25,8 +25,10 @@
import org.labkey.api.module.Module;
import org.labkey.api.query.DefaultSchema;
import org.labkey.api.query.QuerySchema;
+import org.labkey.api.query.SimpleTableDomainKind;
import org.labkey.api.query.SimpleUserSchema;
import org.labkey.api.security.User;
+import org.labkey.ehr_compliancedb.model.EHRComplianceDBDomainKind;
/**
* User: bimber
@@ -36,6 +38,7 @@
public class EHR_ComplianceDBUserSchema extends SimpleUserSchema
{
public static final String TABLE_REQUIREMENTS = "requirements";
+ private static final String TABLE_REQUIREMENTSPEREMPLOYEE = "requirementsperemployee";
public EHR_ComplianceDBUserSchema(User user, Container container, DbSchema dbschema)
{
@@ -50,6 +53,23 @@ public TableInfo createTable(String name, ContainerFilter cf)
SchemaTableInfo table = _dbSchema.getTable(name);
return new ContainerScopedTable<>(this, table, cf, "requirementname").init();
}
+ else if (TABLE_REQUIREMENTSPEREMPLOYEE.equalsIgnoreCase(name))
+ {
+ SchemaTableInfo table = _dbSchema.getTable(name);
+ return new SimpleTable<>(this, table, cf)
+ {
+ // There are issues with the '_' in the name of this module and creating template domains. This addresses
+ // the domain URI by normalizing with the domain kind.
+ @Override
+ public String getDomainURI()
+ {
+ if (_objectUriCol == null)
+ return null;
+
+ return SimpleTableDomainKind.getDomainURI(EHRComplianceDBDomainKind.KIND_NAME, getName(), getDomainContainer(), _userSchema.getUser());
+ }
+ }.init();
+ }
return super.createTable(name, cf);
}
diff --git a/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/model/EHRComplianceDBDomainKind.java b/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/model/EHRComplianceDBDomainKind.java
new file mode 100644
index 000000000..e99f4860c
--- /dev/null
+++ b/EHR_ComplianceDB/src/org/labkey/ehr_compliancedb/model/EHRComplianceDBDomainKind.java
@@ -0,0 +1,57 @@
+package org.labkey.ehr_compliancedb.model;
+
+import org.labkey.api.data.Container;
+import org.labkey.api.exp.property.Domain;
+import org.labkey.api.gwt.client.model.GWTPropertyDescriptor;
+import org.labkey.api.query.ExtendedTableDomainKind;
+import org.labkey.api.security.User;
+import org.labkey.api.security.permissions.AdminPermission;
+import org.labkey.data.xml.domainTemplate.DomainTemplateType;
+import org.labkey.data.xml.domainTemplate.EHRComplianceDBTemplateType;
+
+
+import java.util.List;
+import java.util.Set;
+
+public class EHRComplianceDBDomainKind extends ExtendedTableDomainKind
+{
+ public static final String KIND_NAME = "EHRComplianceDB";
+
+ @Override
+ public boolean canCreateDefinition(User user, Container container)
+ {
+ return container.hasPermission("EHRComplianceDBDomainKind.canCreateDefinition", user, AdminPermission.class);
+ }
+
+ @Override
+ protected String getSchemaName()
+ {
+ return KIND_NAME.toLowerCase();
+ }
+
+ @Override
+ protected String getNamespacePrefix()
+ {
+ return KIND_NAME.toLowerCase();
+ }
+
+ @Override
+ public String getKindName()
+ {
+ return KIND_NAME;
+ }
+
+ @Override
+ public Set getReservedPropertyNames(Domain domain, User user)
+ {
+ return super.getReservedPropertyNames(domain, user);
+ }
+
+ @Override
+ public boolean matchesTemplateXML(String templateName, DomainTemplateType template, List properties)
+ {
+ return template instanceof EHRComplianceDBTemplateType;
+ }
+}
+
+
diff --git a/ehr/resources/queries/study/HousingOverlaps.sql b/ehr/resources/queries/study/HousingOverlaps.sql
index a4efd7d90..2889b8eca 100644
--- a/ehr/resources/queries/study/HousingOverlaps.sql
+++ b/ehr/resources/queries/study/HousingOverlaps.sql
@@ -1,40 +1,21 @@
-/*
- * Copyright (c) 2011-2019 LabKey Corporation
- *
- * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
- */
-
/**
* This query is designed to find housing records that overlap. In this query, the overlap to calculated based on both date and time
* A record that ends at the same time that a second record begins is not considered an overlap.
- */
-PARAMETERS(StartDate TIMESTAMP, EndDate TIMESTAMP, Room CHAR DEFAULT NULL, Cage CHAR DEFAULT NULL)
+ Modified by Kollil on 7/23/25 - Added Area field to the query and the rooms are filtered by area(s) selected, refer to tkt # 12894
+ */
SELECT
-h.lsid,
-h.id,
-h.room,
-h.cage,
-h.date,
-h.enddate,
-h.reason,
-h.remark,
-h.qcstate
-
+ h.lsid,
+ h.id,
+ h.room.area as area, -- Added by Kollil
+ h.room,
+ h.cage,
+ h.date,
+ h.enddate,
+ h.reason,
+ h.remark,
+ h.qcstate
FROM study.housing h
-
WHERE
+ h.qcstate = 18
-(h.room = ROOM OR ROOM IS NULL or ROOM = '') AND
-(h.cage = CAGE OR CAGE IS NULL OR CAGE = '') AND
-
-/* entered startdate must be <= entered enddate */
-coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) <= coalesce(ENDDATE, now())
-and
-
-/* entered startdate must be less than record's enddate */
-coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) < coalesce(h.enddate, now())
-and
-
-/* entered enddate must be greater than record's startdate */
-coalesce(ENDDATE, now()) >= coalesce(h.date, now())
\ No newline at end of file
diff --git a/ehr/resources/queries/study/HousingOverlapsById.sql b/ehr/resources/queries/study/HousingOverlapsById.sql
deleted file mode 100644
index 6296f7ef7..000000000
--- a/ehr/resources/queries/study/HousingOverlapsById.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2011-2019 LabKey Corporation
- *
- * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
- */
-
-PARAMETERS(StartDate TIMESTAMP, EndDate TIMESTAMP, Room CHAR DEFAULT NULL, Cage CHAR DEFAULT NULL)
-
-SELECT
-h.Id,
-cast(StartDate as timestamp) as date
-
-FROM study.housing h
-
-WHERE
-
-(h.room = ROOM OR ROOM IS NULL or ROOM = '') AND
-(h.cage = CAGE OR CAGE IS NULL OR CAGE = '') AND
-
-/* entered startdate must be <= enddate */
-coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) <= coalesce(ENDDATE, now())
-and
-
-/* entered startdate must be less than record's enddate */
-coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) < coalesce(h.enddate, now())
-and
-
-/* entered enddate must be greater than record's startdate */
-coalesce(ENDDATE, now()) >= coalesce(h.date, now())
-
-GROUP BY h.Id
\ No newline at end of file
diff --git a/ehr/resources/queries/study/HousingOverlapsById/.qview.xml b/ehr/resources/queries/study/HousingOverlapsById/.qview.xml
deleted file mode 100644
index 603b1f172..000000000
--- a/ehr/resources/queries/study/HousingOverlapsById/.qview.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ehr/resources/queries/study/HousingOverlapsByIdDateOnly.sql b/ehr/resources/queries/study/HousingOverlapsByIdDateOnly.sql
deleted file mode 100644
index a6fa7185e..000000000
--- a/ehr/resources/queries/study/HousingOverlapsByIdDateOnly.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2012-2019 LabKey Corporation
- *
- * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
- */
-
-PARAMETERS(StartDate TIMESTAMP, EndDate TIMESTAMP, Room CHAR DEFAULT NULL, Cage CHAR DEFAULT NULL)
-
-SELECT
-h.Id,
-cast(StartDate as timestamp) as date
-
-FROM study.housing h
-
-WHERE
-
-(h.room = ROOM OR ROOM IS NULL or ROOM = '') AND
-(h.cage = CAGE OR CAGE IS NULL OR CAGE = '') AND
-
-/* entered startdate must be <= enddate */
-cast(coalesce(STARTDATE , cast('1900-01-01' as DATE)) as DATE) <= cast(coalesce(ENDDATE, now()) as DATE)
-and
-
-/* entered startdate must be less than record's enddate */
-cast(coalesce(STARTDATE , cast('1900-01-01' as DATE)) as DATE) < cast(coalesce(h.enddate, now()) as DATE)
-and
-
-/* entered enddate must be greater than record's startdate */
-cast(coalesce(ENDDATE, now()) as DATE) >= cast(coalesce(h.date, now()) as DATE)
-
-GROUP BY h.Id
\ No newline at end of file
diff --git a/ehr/resources/queries/study/HousingOverlapsByIdDateOnly/.qview.xml b/ehr/resources/queries/study/HousingOverlapsByIdDateOnly/.qview.xml
deleted file mode 100644
index 32b8acce5..000000000
--- a/ehr/resources/queries/study/HousingOverlapsByIdDateOnly/.qview.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ehr/resources/queries/study/HousingOverlapsById.query.xml b/ehr/resources/queries/study/HousingOverlapsReport.query.xml
similarity index 82%
rename from ehr/resources/queries/study/HousingOverlapsById.query.xml
rename to ehr/resources/queries/study/HousingOverlapsReport.query.xml
index 1f1321218..1256b36ac 100644
--- a/ehr/resources/queries/study/HousingOverlapsById.query.xml
+++ b/ehr/resources/queries/study/HousingOverlapsReport.query.xml
@@ -1,17 +1,15 @@
-
+
Housing Overlaps
- This query identifies distinct animal IDs that overlapped with given housing records, accounting for date and time
+ This query identifies distinct housing records that overlapped with the given housing records, accounting for date and time
-
+
true
-
-
- Start Date
+ true
diff --git a/ehr/resources/queries/study/HousingOverlapsReport.sql b/ehr/resources/queries/study/HousingOverlapsReport.sql
new file mode 100644
index 000000000..f2cb68596
--- /dev/null
+++ b/ehr/resources/queries/study/HousingOverlapsReport.sql
@@ -0,0 +1,27 @@
+PARAMETERS(StartDate TIMESTAMP, EndDate TIMESTAMP)
+
+SELECT
+ h.lsid,
+ h.id,
+ h.room,
+ h.cage,
+ h.date,
+ h.enddate,
+ h.reason,
+ h.remark,
+ h.qcstate
+
+FROM study.housing h
+
+WHERE
+
+/* entered startdate must be <= entered enddate */
+ coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) <= coalesce(ENDDATE, now())
+ and
+
+/* entered startdate must be less than record's enddate */
+ coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) < coalesce(h.enddate, now())
+ and
+
+/* entered enddate must be greater than record's startdate */
+ coalesce(ENDDATE, now()) >= coalesce(h.date, now())
\ No newline at end of file
diff --git a/ehr/resources/queries/study/HousingOverlapsReport/.qview.xml b/ehr/resources/queries/study/HousingOverlapsReport/.qview.xml
new file mode 100644
index 000000000..7edf3755c
--- /dev/null
+++ b/ehr/resources/queries/study/HousingOverlapsReport/.qview.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ehr/resources/queries/study/HousingOverlapsByIdDateOnly.query.xml b/ehr/resources/queries/study/HousingOverlapsReportDateOnly.query.xml
similarity index 79%
rename from ehr/resources/queries/study/HousingOverlapsByIdDateOnly.query.xml
rename to ehr/resources/queries/study/HousingOverlapsReportDateOnly.query.xml
index 967758d1c..ae23c19fe 100644
--- a/ehr/resources/queries/study/HousingOverlapsByIdDateOnly.query.xml
+++ b/ehr/resources/queries/study/HousingOverlapsReportDateOnly.query.xml
@@ -1,17 +1,15 @@
-
+
- Housing Overlaps
- This query identifies all distinct animal IDs that overlapped with housing records, accounting for date only, not date/time
+ Housing Overlaps (Date Only)
+ This query identifies overlapping housing records, accounting for date only, not date/time
-
+
true
-
-
- Start Date
+ true
diff --git a/ehr/resources/queries/study/HousingOverlapsReportDateOnly.sql b/ehr/resources/queries/study/HousingOverlapsReportDateOnly.sql
new file mode 100644
index 000000000..65847cacd
--- /dev/null
+++ b/ehr/resources/queries/study/HousingOverlapsReportDateOnly.sql
@@ -0,0 +1,24 @@
+PARAMETERS(StartDate TIMESTAMP, EndDate TIMESTAMP)
+
+SELECT
+ h.lsid,
+ h.id,
+ h.room,
+ h.cage,
+ h.date,
+ h.enddate,
+ h.reason,
+ h.remark,
+ h.qcstate
+
+FROM study.housing h
+
+WHERE
+
+ (
+ (cast(COALESCE(STARTDATE, '1900-01-01') AS DATE) >= cast(h.date AS DATE) AND cast(COALESCE(STARTDATE, '1900-01-01') AS DATE) < cast(COALESCE(h.enddate, now()) AS DATE))
+ OR
+ (cast(COALESCE(ENDDATE, now()) AS DATE) > cast(h.date AS DATE) AND cast(COALESCE(ENDDATE, now()) AS DATE) <= cast(COALESCE(h.enddate, now()) AS DATE))
+ OR
+ (cast(COALESCE(STARTDATE, '1900-01-01') AS DATE) <= cast(h.date AS DATE) AND cast(COALESCE(ENDDATE, now()) AS DATE) >= cast(COALESCE(h.enddate, now()) AS DATE))
+ )
\ No newline at end of file
diff --git a/ehr/resources/views/ehrTemplates.html b/ehr/resources/views/ehrTemplates.html
index a759d4d35..85e8be151 100644
--- a/ehr/resources/views/ehrTemplates.html
+++ b/ehr/resources/views/ehrTemplates.html
@@ -54,19 +54,52 @@
});
}
+ createEHRComplianceDomainHandler = function () {
+ var ctx = EHR.Utils.getEHRContext();
+ var container = document.getElementById("ehrcompliance_container").value;
+ if (!container) {
+ LABKEY.Utils.alert("Error", "Must enter the container path of the compliance folder.");
+ }
+ else {
+ LABKEY.Domain.create({
+ module: ctx ? ctx['EHRCustomModule'] : null,
+ domainKind: "EHRComplianceDB",
+ domainGroup: "ehrcompliancedb",
+ importData: false,
+ containerPath: container,
+ success: function () {
+ LABKEY.Utils.alert("Success", "EHR_ComplianceDB tables updated successfully.");
+ },
+ failure: function (e) {
+ LABKEY.Utils.alert("Error", e.exception);
+ }
+ });
+ }
+ }
+
LABKEY.Utils.onReady(function(){
document.getElementById('createEHRDomainHandler')['onclick'] = function(){ createEHRDomainHandler(); return false; }
document.getElementById('createEHRLookupsDomainHandler')['onclick'] = function(){ createEHRLookupsDomainHandler(); return false; }
document.getElementById('createEHRBillingDomainHandler')['onclick'] = function(){ createEHRBillingDomainHandler(); return false; }
+ document.getElementById('createEHRComplianceDomainHandler')['onclick'] = function(){ createEHRComplianceDomainHandler(); return false; }
});
\ No newline at end of file
diff --git a/ehr/resources/views/housingOverlaps.html b/ehr/resources/views/housingOverlaps.html
index 9736656cc..48f211317 100644
--- a/ehr/resources/views/housingOverlaps.html
+++ b/ehr/resources/views/housingOverlaps.html
@@ -1,210 +1,278 @@
+
+
\ No newline at end of file
diff --git a/ehr/resources/web/ehr/data/EncounterStoreCollection.js b/ehr/resources/web/ehr/data/EncounterStoreCollection.js
index 8239cbda5..a669ecef2 100644
--- a/ehr/resources/web/ehr/data/EncounterStoreCollection.js
+++ b/ehr/resources/web/ehr/data/EncounterStoreCollection.js
@@ -64,7 +64,7 @@ Ext4.define('EHR.data.EncounterStoreCollection', {
model.set('Id', parentRec.get('Id'));
}
- if (model.fields.get('date') && !model.get('date') && parentRec.get('date')){
+ if (model.fields.get('date')?.inheritDefaultDateFromParent && !model.get('date') && parentRec.get('date')){
model.set('date', parentRec.get('date'));
}
diff --git a/ehr/resources/web/ehr/ehr_api.lib.xml b/ehr/resources/web/ehr/ehr_api.lib.xml
index 59f74effe..ead5f3356 100644
--- a/ehr/resources/web/ehr/ehr_api.lib.xml
+++ b/ehr/resources/web/ehr/ehr_api.lib.xml
@@ -63,6 +63,7 @@
+
diff --git a/ehr/resources/web/ehr/form/field/BuildingField.js b/ehr/resources/web/ehr/form/field/BuildingField.js
new file mode 100644
index 000000000..ea9f75cb9
--- /dev/null
+++ b/ehr/resources/web/ehr/form/field/BuildingField.js
@@ -0,0 +1,59 @@
+Ext4.define('EHR.form.field.BuildingField', {
+ extend: 'Ext.ux.CheckCombo',
+ alias: 'widget.ehr-buildingfield',
+
+ fieldLabel: 'Building',
+ nullCaption: '[Blank]',
+ editable: false,
+ expandToFitContent: true,
+ addAllSelector: true,
+ typeAhead: true,
+
+ initComponent: function(){
+ Ext4.apply(this, {
+ displayField:'name',
+ valueField: 'name',
+ queryMode: 'local',
+ store: Ext4.create('LABKEY.ext4.data.Store', {
+ schemaName: 'ehr_lookups',
+ queryName: 'buildings',
+ sort: 'name',
+ filterArray: [LABKEY.Filter.create('dateDisabled', true, LABKEY.Filter.Types.ISBLANK)],
+ autoLoad: true
+ })
+ });
+
+ this.callParent(arguments);
+
+ if (this.pairedWithRoomField)
+ this.addRoomListeners();
+ },
+
+
+ addRoomListeners: function(){
+ this.on('select', function(field, records){
+ if (!records.length)
+ return;
+
+ var buildings = [];
+ Ext4.Array.forEach(records, function(r){
+ buildings.push(r.get('name'));
+ }, this);
+
+ var roomField = this.getRoomField();
+ roomField.suspendEvents();
+ roomField.selectByBuildings(buildings);
+ roomField.resumeEvents();
+ }, this);
+
+ this.on('render', function(field){
+ var val = field.getValue();
+ val = Ext4.isArray(val) || !val ? val : [val];
+
+ var roomField = this.getRoomField();
+ roomField.suspendEvents();
+ roomField.selectByBuildings(val);
+ roomField.resumeEvents();
+ }, this);
+ }
+});
\ No newline at end of file
diff --git a/ehr/resources/web/ehr/form/field/RoomField.js b/ehr/resources/web/ehr/form/field/RoomField.js
index 28bf62cf2..8c14a8bc7 100644
--- a/ehr/resources/web/ehr/form/field/RoomField.js
+++ b/ehr/resources/web/ehr/form/field/RoomField.js
@@ -19,7 +19,7 @@ Ext4.define('EHR.form.field.RoomField', {
type: 'labkey-store',
schemaName: 'ehr_lookups',
queryName: 'rooms',
- columns: 'room,room_sortValue,area',
+ columns: 'room,room_sortValue,area,building',
sort: 'room_sortValue',
filterArray: this.getStoreFilterArray(),
autoLoad: true
@@ -76,6 +76,35 @@ Ext4.define('EHR.form.field.RoomField', {
}
},
+ selectByBuildings: function(buildings){
+ if (!this.rendered || !this.store){
+ this.on('afterrender', function(field){
+ field.selectByBuildings(buildings);
+ }, this, {single: true});
+
+ return;
+ }
+
+ this.store.clearFilter();
+ if (!this.store.getCount()){
+ this.store.on('load', function(store){
+ this.selectByBuildings(buildings);
+ }, this, {single: true});
+ }
+ else {
+ if (buildings && buildings.length){
+ var values = [];
+ this.store.each(function(rec){
+ if (buildings.indexOf(rec.get('building')) != -1){
+ values.push(rec.get('room'));
+ }
+ }, this);
+
+ this.setValue(values);
+ }
+ }
+ },
+
filterByAreas: function(areas){
this.store.clearFilter();
if (!this.rendered){
diff --git a/ehr/resources/web/ehr/model/sources/EncounterChild.js b/ehr/resources/web/ehr/model/sources/EncounterChild.js
index 68ea4e3e1..d27cdc046 100644
--- a/ehr/resources/web/ehr/model/sources/EncounterChild.js
+++ b/ehr/resources/web/ehr/model/sources/EncounterChild.js
@@ -12,7 +12,8 @@ EHR.model.DataModelManager.registerMetadata('EncounterChild', {
}
},
date: {
- inheritDateFromParent: true
+ inheritDateFromParent: true,
+ inheritDefaultDateFromParent: true
},
project: {
inheritFromParent: true
diff --git a/ehr/resources/web/ehr/navMenu.js b/ehr/resources/web/ehr/navMenu.js
index 74bbd49af..8f4d6048c 100644
--- a/ehr/resources/web/ehr/navMenu.js
+++ b/ehr/resources/web/ehr/navMenu.js
@@ -107,11 +107,19 @@ Ext4.define('EHR.NavMenu', {
item = this.renderer(tmp.items[j])
}
else {
- //NOTE: this is the default renderer
- item = {
- //Creates links for the navigation panel
- html: ''+tmp.items[j].name+''
+ if (tmp.items[j].target){
+ item = {
+ //Creates links for the navigation panel to a target
+ html: ''+tmp.items[j].name+''
+ }
+ }else{
+ item = {
+ //Creates links for the navigation panel
+ html: ''+tmp.items[j].name+''
+ }
}
+ //NOTE: this is the default renderer
+
}
section.add(item)
}
diff --git a/ehr/resources/web/ehr/window/EncounterAddRecordWindow.js b/ehr/resources/web/ehr/window/EncounterAddRecordWindow.js
index c6c52090a..4846e3deb 100644
--- a/ehr/resources/web/ehr/window/EncounterAddRecordWindow.js
+++ b/ehr/resources/web/ehr/window/EncounterAddRecordWindow.js
@@ -96,8 +96,16 @@ Ext4.define('EHR.window.EncounterAddRecordWindow', {
var model = this.targetGrid.store.createModel({});
var obj = {};
Ext4.Array.forEach(['Id', 'date', 'parentid', 'project'], function(field){
- if (this.targetGrid.store.getFields().get(field)){
- obj[field] = rec.get(field);
+ const fieldConfig = this.targetGrid.store.getFields().get(field);
+ if (fieldConfig){
+ if (field === 'date') {
+ if (fieldConfig.inheritDefaultDateFromParent) {
+ obj[field] = rec.get(field);
+ }
+ }
+ else {
+ obj[field] = rec.get(field);
+ }
}
}, this);
diff --git a/ehr/resources/web/ehr/window/SaveTemplateWindow.js b/ehr/resources/web/ehr/window/SaveTemplateWindow.js
index 6a727c2ac..63d222e80 100644
--- a/ehr/resources/web/ehr/window/SaveTemplateWindow.js
+++ b/ehr/resources/web/ehr/window/SaveTemplateWindow.js
@@ -204,7 +204,8 @@ Ext4.define('EHR.window.SaveTemplateWindow', {
var rows = [];
this.down('#theForm').items.each(function(tab){
- var selections = tab.down('#recordSelector').getValue().inputValue;
+ var radioGroup = tab.down('#recordSelector');
+ var selections = radioGroup.getValue()[radioGroup.down('[name]').name];
var fields = tab.down('#fieldSelector').getValue().fields;
if (!fields.length)
@@ -220,7 +221,7 @@ Ext4.define('EHR.window.SaveTemplateWindow', {
var records = [];
if (selections == 'selected'){
- records = this.grid.getSelectionModel().getSelections();
+ records = this.targetGrid.getSelectionModel().getSelection();
if (!records.length){
Ext4.Msg.hide();
diff --git a/ehr/src/org/labkey/ehr/utils/TriggerScriptHelper.java b/ehr/src/org/labkey/ehr/utils/TriggerScriptHelper.java
index 5f43e97c0..73ca925ae 100644
--- a/ehr/src/org/labkey/ehr/utils/TriggerScriptHelper.java
+++ b/ehr/src/org/labkey/ehr/utils/TriggerScriptHelper.java
@@ -2558,8 +2558,7 @@ public int compare(Map o1, Map o2)
Date date = _dateTimeFormat.parse(row.get("date").toString());
if (!dateOnly && date.getHours() == 0 && date.getMinutes() == 0)
{
- Exception e = new Exception();
- _log.warn("Attempting to terminate " + dataset + " records with a rounded date. This might indicate upstream code is rounding the date: " + _dateTimeFormat.format(date), e);
+ _log.warn("Attempting to terminate " + dataset + " records with a rounded date. This might indicate upstream code is rounding the date: " + _dateTimeFormat.format(date));
}
SimpleFilter filter = new SimpleFilter(FieldKey.fromString("Id"), row.get("Id"));
diff --git a/ehr/test/src/org/labkey/test/pages/ehr/NotificationAdminPage.java b/ehr/test/src/org/labkey/test/pages/ehr/NotificationAdminPage.java
index 7eba6ebe6..ef494bb64 100644
--- a/ehr/test/src/org/labkey/test/pages/ehr/NotificationAdminPage.java
+++ b/ehr/test/src/org/labkey/test/pages/ehr/NotificationAdminPage.java
@@ -97,7 +97,7 @@ public void clickRunReportInBrowser(String name)
{
log("Clicking Run Report in browser for " + name);
name = name.replace(" ", "");
- clickAndWait(Locator.tagWithAttributeContaining("a", "href", name).withText("Run Report In Browser"));
+ waitAndClickAndWait(Locator.tagWithAttributeContaining("a", "href", name).withText("Run Report In Browser"));
}
public void clickManuallyTriggerEmail(String name)
diff --git a/snd/test/src/org/labkey/test/tests/snd/SNDTest.java b/snd/test/src/org/labkey/test/tests/snd/SNDTest.java
index 824db2a20..f1ac6fa62 100644
--- a/snd/test/src/org/labkey/test/tests/snd/SNDTest.java
+++ b/snd/test/src/org/labkey/test/tests/snd/SNDTest.java
@@ -1048,6 +1048,7 @@ public void preTest()
//TODO: once exp tables are exposed - do a full cleanup from snd.pkgs, exp.DomainDescriptor, exp.PropertyDomain, exp.PropertyDescriptor
}
+ @SuppressWarnings("JUnit3StyleTestMethodInJUnit4Class") // Explicitly called as part of setup
public void testSNDImport()
{
//go to SND Project
@@ -1264,7 +1265,7 @@ public void cloneDraftPackage()
assertEquals("2", fairReviewRow.getMin());
assertEquals("7", fairReviewRow.getMax());
assertEquals(":-)", fairReviewRow.getDefault());
- assertEquals(true, fairReviewRow.getRequired());
+ assertTrue(fairReviewRow.getRequired());
assertEquals("lol", fairReviewRow.getRedactedText());
}
@@ -1404,7 +1405,7 @@ public void saveNewPackage()
assertEquals("2", reviewRow.getMin());
assertEquals("7", reviewRow.getMax());
assertEquals("men", reviewRow.getDefault());
- assertEquals(true, reviewRow.getRequired());
+ assertTrue(reviewRow.getRequired());
assertEquals("and women", reviewRow.getRedactedText());
}
@@ -1545,11 +1546,11 @@ public void editCategories() throws Exception
CategoryEditRow surgeryRowCat = catPage.getCategory("Surgery");
assertNotNull("Surgery category should exist", surgeryRowCat);
- assertEquals("Surgery category should be active", true, surgeryRowCat.getIsActive());
+ assertTrue("Surgery category should be active", surgeryRowCat.getIsActive());
CategoryEditRow ourCat = catPage.getCategory(editedCategory);
assertNotNull("test edit category should exist", ourCat);
- assertEquals("test edit category should be inactive", false, ourCat.getIsActive());
+ assertFalse("test edit category should be inactive", ourCat.getIsActive());
assertEquals("test edit category should have new description", editedCategory, ourCat.getDescription());
SelectRowsCommand catsCmd = new SelectRowsCommand("snd", "PkgCategories");
@@ -1803,12 +1804,17 @@ public void testProjectApis() throws Exception
public void testSuperPackageApis() throws Exception
{
goToProjectHome();
- goToSchemaBrowser();
//insert super package
runScript(SAVEPACKAGEAPI_CHILDREN);
goToSchemaBrowser();
- viewQueryData("snd", "SuperPkgs");
+ selectQuery("snd", "SuperPkgs");
+ // Issue 52277: Be sure that the call to analyze the query has completed by waiting for the dependency report,
+ // ensuring it won't be chosen as a deadlock victim
+ waitForText("Dependency Report");
+ Locator viewData = Locator.linkWithText("view data");
+ waitAndClickAndWait(viewData);
+
assertTextPresent(TEST_SUPER_PKG_DESCRIPTION_1, 1);
checkResults(TEST_SUPER_PKG_DESCRIPTION_1,
Arrays.asList(TEST_SUPER_PKG_START_ID1 + 1, // top-level super package is the + 0, so start at + 1
@@ -1818,8 +1824,7 @@ public void testSuperPackageApis() throws Exception
//update super package without cloning, with children
runScript(UPDATESUPERPACKAGEAPI_CHILDREN);
- goToSchemaBrowser();
- viewQueryData("snd", "SuperPkgs");
+ refresh();
assertTextPresent(TEST_SUPER_PKG_DESCRIPTION_2, 1);
assertTextNotPresent(TEST_SUPER_PKG_DESCRIPTION_1);
checkResults(TEST_SUPER_PKG_DESCRIPTION_2,
@@ -1832,8 +1837,7 @@ public void testSuperPackageApis() throws Exception
//update super package with cloning
runScript(UPDATESUPERPACKAGEAPI_CLONE);
- goToSchemaBrowser();
- viewQueryData("snd", "SuperPkgs");
+ refresh();
assertTextPresent(TEST_SUPER_PKG_DESCRIPTION_3, 1);
assertTextPresent(TEST_SUPER_PKG_DESCRIPTION_2, 1);
checkResults(TEST_SUPER_PKG_DESCRIPTION_3,
@@ -1846,8 +1850,7 @@ public void testSuperPackageApis() throws Exception
//update super package without cloning, without children
runScript(UPDATESUPERPACKAGEAPI_NOCHILDREN);
- goToSchemaBrowser();
- viewQueryData("snd", "SuperPkgs");
+ refresh();
assertTextPresent(TEST_SUPER_PKG_DESCRIPTION_4, 1);
assertTextPresent(TEST_SUPER_PKG_DESCRIPTION_3, 1);
assertTextNotPresent(TEST_SUPER_PKG_DESCRIPTION_2);
@@ -2170,7 +2173,7 @@ public void categoryPermissionsUI() throws Exception
{
value = getPermissionTableValue(i, 1);
assertNotNull(value);
- assertTrue(value.equals("None"));
+ assertEquals("None", value);
categoryRows.add(i);
}
}
@@ -2182,7 +2185,7 @@ public void categoryPermissionsUI() throws Exception
{
value = getPermissionTableValue(r, 1);
assertNotNull(value);
- assertTrue(value.equals("SND Reader"));
+ assertEquals("SND Reader", value);
}
findButton("Clear All").click();
@@ -2192,7 +2195,7 @@ public void categoryPermissionsUI() throws Exception
{
value = getPermissionTableValue(categoryRows.get(k), 1);
assertNotNull(value);
- assertTrue(value.equals("None"));
+ assertEquals("None", value);
click(getSimpleTableCell(Locator.id("category-security"), categoryRows.get(k), 1));
clickRoleInOpenDropDown(permissions.get(k));
}
@@ -2203,7 +2206,7 @@ public void categoryPermissionsUI() throws Exception
{
value = getPermissionTableValue(categoryRows.get(j), 1);
assertNotNull(value);
- assertTrue(value.equals(permissions.get(j)));
+ assertEquals(value, permissions.get(j));
}
}