Skip to content

Commit 75bf480

Browse files
Merge 25.7 to 25.9
2 parents 3d85215 + 0e15803 commit 75bf480

24 files changed

Lines changed: 445 additions & 446 deletions

EHR_ComplianceDB/resources/queries/ehr_compliancedb/employeecategory.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ function beforeDelete(row, errors){
2424
var fields = ['categoryname'], fieldName;
2525
for (var i=0;i<fields.length;i++){
2626
fieldName = fields[i];
27-
if (helper.verifyNotUsed('ehr_compliancedb', 'employees', 'category', row[fieldName])){
27+
if (helper.verifyNotUsed('ehr_compliancedb', 'employees', 'category', row[fieldName], 'employeecategory')){
2828
addError(errors, fieldName, 'Cannot delete row with value: ' + row[fieldName] + ' because it is referenced by the employees table');
2929
}
3030

31-
if (helper.verifyNotUsed('ehr_compliancedb', 'requirementspercategory', 'category', row[fieldName])){
31+
if (helper.verifyNotUsed('ehr_compliancedb', 'requirementspercategory', 'category', row[fieldName], 'employeecategory')){
3232
addError(errors, fieldName, 'Cannot delete row with value: ' + row[fieldName] + ' because it is referenced by the requirementspercategory table');
3333
}
3434

35-
if (helper.verifyNotUsed('ehr_compliancedb', 'sopbycategory', 'category', row[fieldName])){
35+
if (helper.verifyNotUsed('ehr_compliancedb', 'sopbycategory', 'category', row[fieldName], 'employeecategory')){
3636
addError(errors, fieldName, 'Cannot delete row with value: ' + row[fieldName] + ' because it is referenced by the sopbycategory table');
3737
}
3838
}

EHR_ComplianceDB/resources/queries/ehr_compliancedb/employeelocations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function beforeDelete(row, errors){
2222
var fields = ['location'], fieldName;
2323
for (var i=0;i<fields.length;i++){
2424
fieldName = fields[i];
25-
if (helper.verifyNotUsed('ehr_compliancedb', 'employees', 'location', row[fieldName])){
25+
if (helper.verifyNotUsed('ehr_compliancedb', 'employees', 'location', row[fieldName], 'employeelocations')){
2626
errors[fieldName] = ['Cannot delete row with value: ' + row[fieldName] + ' because it is referenced by the employees table'];
2727
}
2828
}

EHR_ComplianceDB/resources/queries/ehr_compliancedb/employees.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ function beforeDelete(row, errors){
6363
query = queries[j];
6464
for (var i=0;i<fields.length;i++){
6565
fieldName = fields[i];
66-
if (helper.verifyNotUsed('ehr_compliancedb', query, 'employeeid', row[fieldName])){
66+
if (helper.verifyNotUsed('ehr_compliancedb', query, 'employeeid', row[fieldName], 'employees')){
6767
addError(errors, fieldName, 'Cannot delete row with value: ' + row[fieldName] + ' because it is referenced by the table ' + query);
6868
}
6969
}
7070
}
7171

7272
//also check trainer
73-
if (helper.verifyNotUsed('ehr_compliancedb', 'completiondates', 'trainer', row[fieldName])){
73+
if (helper.verifyNotUsed('ehr_compliancedb', 'completiondates', 'trainer', row[fieldName], 'employees')){
7474
addError(errors, fieldName, 'Cannot delete row with value: ' + row[fieldName] + ' because it is referenced by the table completiondates');
7575
}
7676
}

EHR_ComplianceDB/resources/queries/ehr_compliancedb/employeetitles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function beforeDelete(row, errors){
2222
var fields = ['title'], fieldName;
2323
for (var i=0;i<fields.length;i++){
2424
fieldName = fields[i];
25-
if (helper.verifyNotUsed('ehr_compliancedb', 'employees', fieldName, row[fieldName])){
25+
if (helper.verifyNotUsed('ehr_compliancedb', 'employees', fieldName, row[fieldName], 'employeetitles')){
2626
errors[fieldName] = ['Cannot delete row with value: ' + row[fieldName] + ' because it is referenced by the employees table'];
2727
}
2828
}

EHR_ComplianceDB/resources/queries/ehr_compliancedb/employeetypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function beforeDelete(row, errors){
2222
var fields = ['type'], fieldName;
2323
for (var i=0;i<fields.length;i++){
2424
fieldName = fields[i];
25-
if (helper.verifyNotUsed('ehr_compliancedb', 'employees', fieldName, row[fieldName])){
25+
if (helper.verifyNotUsed('ehr_compliancedb', 'employees', fieldName, row[fieldName], 'employeetypes')){
2626
errors[fieldName] = ['Cannot delete row with value: ' + row[fieldName] + ' because it is referenced by the employees table'];
2727
}
2828
}

EHR_ComplianceDB/resources/queries/ehr_compliancedb/requirements.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function beforeDelete(row, errors){
6363
query = queries[j];
6464
for (var i=0;i<fields.length;i++){
6565
fieldName = fields[i];
66-
if (helper.verifyNotUsed('ehr_compliancedb', query, 'requirementname', row[fieldName])){
66+
if (helper.verifyNotUsed('ehr_compliancedb', query, 'requirementname', row[fieldName], 'requirements')){
6767
addError(errors, fieldName, 'Cannot delete row with value: ' + row[fieldName] + ' because it is referenced by the table ' + query);
6868
}
6969
}

EHR_ComplianceDB/resources/queries/ehr_compliancedb/requirementtype.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function beforeDelete(row, errors){
2222
var fields = ['type'], fieldName;
2323
for (var i=0;i<fields.length;i++){
2424
fieldName = fields[i];
25-
if (helper.verifyNotUsed('ehr_compliancedb', 'requirements', fieldName, row[fieldName])){
25+
if (helper.verifyNotUsed('ehr_compliancedb', 'requirements', fieldName, row[fieldName], 'requirementtype')){
2626
errors[fieldName] = ['Cannot delete row with value: ' + row[fieldName] + ' because it is referenced by the requirements table'];
2727
}
2828
}

EHR_ComplianceDB/resources/queries/ehr_compliancedb/unit_names.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function beforeDelete(row, errors){
2626
query = queries[j];
2727
for (var i=0;i<fields.length;i++){
2828
fieldName = fields[i];
29-
if (helper.verifyNotUsed('ehr_compliancedb', query, 'unit', row[fieldName])){
29+
if (helper.verifyNotUsed('ehr_compliancedb', query, 'unit', row[fieldName], 'unit_names')){
3030
addError(errors, fieldName, 'Cannot delete row with value: ' + row[fieldName] + ' because it is referenced by the table ' + query);
3131
}
3232
}

ehr/resources/queries/ehr_lookups/procedures.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66

77
var console = require("console");
88
var LABKEY = require("labkey");
9+
var triggers = require("ehr/triggers");
10+
triggers.initScript(this);
11+
var EHR = triggers.EHR;
912

10-
var helper = org.labkey.ldk.query.LookupValidationHelper.create(LABKEY.Security.currentContainer.id, LABKEY.Security.currentUser.id, 'ehr_lookups', 'procedures');
13+
var lookupValidationHelper = org.labkey.ldk.query.LookupValidationHelper.create(LABKEY.Security.currentContainer.id, LABKEY.Security.currentUser.id, 'ehr_lookups', 'procedures');
1114

12-
13-
function beforeDelete(row, errors){
14-
if (helper.verifyNotUsed('study', 'encounters', 'procedureid', row['rowid'])){
15+
EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_DELETE, 'ehr_lookups', 'procedures', function(helper, scriptErrors, row, oldRow){
16+
if (lookupValidationHelper.verifyNotUsed('study', 'encounters', 'procedureid', row['rowid'], 'procedures')) {
1517
addError(errors, 'name', 'Cannot delete row with ID: ' + row['rowid'] + ' because it is referenced by the table encounters. You should inactivate this item instead.');
1618
}
17-
}
19+
});
1820

1921
function addError(errors, fieldName, msg){
2022
if (!errors[fieldName])
Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,21 @@
1-
/*
2-
* Copyright (c) 2011-2019 LabKey Corporation
3-
*
4-
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
5-
*/
6-
71
/**
82
* This query is designed to find housing records that overlap. In this query, the overlap to calculated based on both date and time
93
* A record that ends at the same time that a second record begins is not considered an overlap.
10-
*/
11-
PARAMETERS(StartDate TIMESTAMP, EndDate TIMESTAMP, Room CHAR DEFAULT NULL, Cage CHAR DEFAULT NULL)
124
5+
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
6+
*/
137
SELECT
14-
h.lsid,
15-
h.id,
16-
h.room,
17-
h.cage,
18-
h.date,
19-
h.enddate,
20-
h.reason,
21-
h.remark,
22-
h.qcstate
23-
8+
h.lsid,
9+
h.id,
10+
h.room.area as area, -- Added by Kollil
11+
h.room,
12+
h.cage,
13+
h.date,
14+
h.enddate,
15+
h.reason,
16+
h.remark,
17+
h.qcstate
2418
FROM study.housing h
25-
2619
WHERE
20+
h.qcstate = 18
2721

28-
(h.room = ROOM OR ROOM IS NULL or ROOM = '') AND
29-
(h.cage = CAGE OR CAGE IS NULL OR CAGE = '') AND
30-
31-
/* entered startdate must be <= entered enddate */
32-
coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) <= coalesce(ENDDATE, now())
33-
and
34-
35-
/* entered startdate must be less than record's enddate */
36-
coalesce( STARTDATE , cast('1900-01-01 00:00:00.0' as timestamp)) < coalesce(h.enddate, now())
37-
and
38-
39-
/* entered enddate must be greater than record's startdate */
40-
coalesce(ENDDATE, now()) >= coalesce(h.date, now())

0 commit comments

Comments
 (0)