Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bot] Fast-forward for 23.11.4 #888

Merged
merged 12 commits into from
Jan 9, 2024
72 changes: 51 additions & 21 deletions onprc_ehr/resources/scripts/onprc_ehr/onprc_triggers.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ exports.init = function(EHR){


EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_UPSERT, 'study','birth', function(helper, scriptErrors, row, oldRow){
//Added: 8-1-2019 R.Blasa
//Added: 8-1-2019 R.Blasa

if (row.Id && row.birth_condition == 'Fetus - Prenatal') {
helper.setScriptOptions({
Expand Down Expand Up @@ -450,7 +450,7 @@ exports.init = function(EHR){
}
});

//Added 1-12-2016 Blasa Menses TMB Records
//Added 1-12-2016 Blasa Menses TMB Records
EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.AFTER_UPSERT, 'study', 'clinical_observations', function(helper, scriptErrors, row, oldRow){

if (row.Id && row.category == 'Menses' ){
Expand Down Expand Up @@ -485,13 +485,13 @@ exports.init = function(EHR){
//Added 9-2-2015 Blasa
EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.AFTER_UPSERT, 'study', 'flags', function(helper, scriptErrors, row, oldRow){

if (row.Id ){
var msg = triggerHelper.sendCullListNotifications(row.Id,row.date, row.flag);
if (msg){
EHR.Server.Utils.addError(scriptErrors, 'category', msg, 'ERROR');
if (row.Id ){
var msg = triggerHelper.sendCullListNotifications(row.Id,row.date, row.flag);
if (msg){
EHR.Server.Utils.addError(scriptErrors, 'category', msg, 'ERROR');
}
}
}
});
});


//Added 4-27-2016 R.Blasa
Expand All @@ -512,7 +512,7 @@ exports.init = function(EHR){
EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.BEFORE_INSERT, 'study', 'assignment', function(helper, scriptErrors, row, oldRow){
//check number of allowed animals at assign/approve time. use different behavior than core EHR
if (!helper.isETL() && !helper.isQuickValidation() &&
//this is designed to always perform the check on imports, but also updates where the Id was changed
//this is designed to always perform the check on imports, but also updates where the Id was changed
!(oldRow && oldRow.Id && oldRow.Id==row.Id) &&
row.Id && row.project && row.date
){
Expand Down Expand Up @@ -625,7 +625,7 @@ exports.init = function(EHR){
});


//Modified: 10-13-2016 R.Blasa added arrival date parameter
//Modified: 10-13-2016 R.Blasa added arrival date parameter
EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.AFTER_UPSERT, 'study', 'birth', function(helper, errors, row, oldRow) {
//Modified: 3-20-2017 R.Blasa Fetal Prenatal updates
if (row.id && oldRow)
Expand Down Expand Up @@ -782,6 +782,21 @@ exports.init = function(EHR){
}
}

/* Added by Kollil, 11/17/2023. Tkt #10159
Added extra validation: 1. If volume is not null, must enter vol units
2. If amount is not null, must enter amount units
*/
if (!row.vol_units) {
if (row.volume) {
EHR.Server.Utils.addError(scriptErrors, 'vol_units', 'Must enter Vol Units if Volume is entered', 'WARN');
}
}
if (!row.amount_units ) {
if (row.amount) {
EHR.Server.Utils.addError(scriptErrors, 'amount_units', 'Must enter Amount Units if Amount is entered', 'WARN');
}
}

//Added: 10-14-2016 R.Blasa
if ((row.code == 'E-00070' || row.code == 'E-YY490'|| row.code == 'E-YYY45') && !row.remark){
EHR.Server.Utils.addError(scriptErrors, 'remark', 'A remark is required when entering this medication', 'WARN');
Expand Down Expand Up @@ -903,7 +918,7 @@ exports.init = function(EHR){
});

EHR.Server.TriggerManager.registerHandlerForQuery(EHR.Server.TriggerManager.Events.AFTER_UPSERT, 'study', 'arrival', function(helper, errors, row, oldRow) {
//Don't process normally if Pending -- Created: 4-25-2017 R.Blasa
//Don't process normally if Pending -- Created: 4-25-2017 R.Blasa
if (row.id && oldRow)
{
var acquiValueOld = triggerHelper.retrieveAcquisitionType(oldRow.acquisitionType);
Expand Down Expand Up @@ -1029,6 +1044,21 @@ exports.init = function(EHR){
}
}

/* Added by Kollil, 11/17/2023. Tkt #10159
Added extra validation: 1. If volume is not null, must enter vol units
2. If amount is not null, must enter amount units
*/
if (!row.vol_units) {
if (row.volume) {
EHR.Server.Utils.addError(scriptErrors, 'vol_units', 'Must enter Vol Units if Volume is entered', 'WARN');
}
}
if (!row.amount_units ) {
if (row.amount) {
EHR.Server.Utils.addError(scriptErrors, 'amount_units', 'Must enter Amount Units if Amount is entered', 'WARN');
}
}

if (row.frequency){
if (!triggerHelper.isTreatmentFrequencyActive(row.frequency)){
EHR.Server.Utils.addError(scriptErrors, 'frequency', 'This frequency has been disabled. Please select a different option', 'INFO');
Expand Down Expand Up @@ -1254,15 +1284,15 @@ exports.init = function(EHR){

//Added: 10-4-2022 R.Blasa
EHR.Server.TriggerManager.registerHandler(EHR.Server.TriggerManager.Events.COMPLETE, function(event, errors, helper){
// Send notifications when requests approved
var requestsApproved = helper.getRequestApprovedArray();
if (requestsApproved && requestsApproved.length > 0) {
var msgs = helper.getJavaHelper().sendRequestStateEmail("Request: Approved", requestsApproved);
if (msgs && msgs.length) {
LABKEY.ExtAdapter.each(msgs, function (msg) {
EHR.Server.Utils.addError(scriptErrors, 'qcstate', msg, 'INFO');
}, this);
}
}
// Send notifications when requests approved
var requestsApproved = helper.getRequestApprovedArray();
if (requestsApproved && requestsApproved.length > 0) {
var msgs = helper.getJavaHelper().sendRequestStateEmail("Request: Approved", requestsApproved);
if (msgs && msgs.length) {
LABKEY.ExtAdapter.each(msgs, function (msg) {
EHR.Server.Utils.addError(scriptErrors, 'qcstate', msg, 'INFO');
}, this);
}
}
});
};
4 changes: 3 additions & 1 deletion onprc_ehr/resources/views/printableReports.html
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,9 @@

params['TreatmentDate'] = Ext4.Date.format(date, LABKEY.extDefaultDateFormat);
params['NumDays'] = 1;
params['Category'] = 'Clinical';
// Modified: 12-12-2023 R. Blasa

params['Category'] = 'Clinical;Clinical on behalf of Research;Clinical on behalf of Surgical';

var timeOfDay = panel.down('#medicationTimeOfDayField').getURLParam();
if (timeOfDay){
Expand Down
125 changes: 125 additions & 0 deletions onprc_ehr/resources/web/onprc_ehr/model/sources/BehaviorDefaults.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/*
* Copyright (c) 2014-2019 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*
* Added by Kollil on 12/18/23. Please refer to tke # 10285 for details
*/
EHR.model.DataModelManager.registerMetadata('BehaviorDefaults', {
allQueries: {

},
byQuery: {
'study.clinremarks': {
category: {
defaultValue: 'Behavior',
hidden: true
},
hx: {
hidden: true
},
s: {
hidden: false
},
o: {
hidden: false
},
a: {
hidden: false
},
p: {
hidden: false
},
p2: {
hidden: true
},
remark: {
columnConfg: {
width: 350
}
}
},
'study.drug': {
category: {
defaultValue: 'Behavior'
},
code: {
editorConfig: {
xtype: 'ehr-snomedcombo',
defaultSubset: 'Behavior'
}
},
concentration: {
hidden: true
},
conc_units: {
hidden: true
},
dosage: {
hidden: true
},
dosage_units: {
hidden: true
},
volume: {
hidden: true
},
vol_units: {
hidden: true
},
amount: {
//hidden: true,
defaultValue: 1
},
amount_units: { //Changed by Kolli: 12/18/2023.
hidden: false,
defaultValue:'units'
},
lot: {
hidden: true
},
outcome: {
hidden: true
},
route: {
hidden: true,
allowBlank: true
},
reason: {
hidden: true
},
qualifier: {
hidden: true
},
enddate: {
hidden: true
},
project: {
getInitialValue: function(v, rec){
//return a default value only if this field is visible
var shouldReturn = false;
if (rec){
var meta = rec.fields.get('project');
if (meta){
shouldReturn = meta.hidden == false
}
}
return v ? v : shouldReturn ? EHR.DataEntryUtils.getDefaultClinicalProject() : null;
}
},
chargetype: {
defaultValue: 'No Charge'
}
},
'study.clinical_observations': {
area: {
hidden: true
},
category: {
lookup: {
filterArray: [LABKEY.Filter.create('category', 'Behavior')]
}
}
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ EHR.model.DataModelManager.registerMetadata('PathTissues', {
date: {
xtype: 'xdatetime',
header: 'Start Date',
allowBlank: false,
extFormat: LABKEY.extDefaultDateTimeFormat,
editorConfig: {
dateFormat: LABKEY.extDefaultDateFormat,
Expand All @@ -39,7 +40,8 @@ EHR.model.DataModelManager.registerMetadata('PathTissues', {
},
project: {
xtype: 'onprc_ehr-projectentryfield',
label: 'Center Project'
label: 'Center Project',
allowBlank: false
},
billingproject: {
xtype: 'onprc_ehr-projectentryfield',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,19 @@ EHR.model.DataModelManager.registerMetadata('PathTissues', {
},
project: {
xtype: 'onprc_ehr-projectentryfield',
allowBlank: false,
label: 'Center Project'
},
billingproject: {
xtype: 'onprc_ehr-projectentryfield',
label: 'Center Project Billing',
hidden: false


},

performedby: {
allowBlank: true,
hidden: true
},
procedureid: {
Expand Down Expand Up @@ -164,6 +167,7 @@ EHR.model.DataModelManager.registerMetadata('PathTissues', {
}
},
performedby: {
allowBlank: true,
hidden: true
},
tissue: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Ext4.define('ONPRC_EHR.window.CopyTissuesWindow', {
Ext4.Msg.wait('Loading...');
LABKEY.Query.selectRows({
schemaName: 'study',
queryName: 'tissueDistributions',
queryName: 'tissueDistributionWithTaskid',
columns: 'Id,tissue,tissue/meaning,project,project/displayName,project/investigatorId/lastName,recipient,recipient/lastname,dateOnly,parentid,sampletype,remark,requestcategory',
sort: '-dateOnly,formSort',
requiredVersion: 9.1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ Ext4.define('ONPRC_EHR.window.CreateNecropsyRequestWindow', {
var obj = {
requestid: row['requestid'],
objectid:row['objectid'],
taskid: config.taskId
taskid: config.taskId,
QCState: 25 //Added: 11-17-2023 R. Blasa
};

toUpdate.push(obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public BehaviorExamFormType(DataEntryFormContext ctx, Module owner)
}
}

addClientDependency(ClientDependency.supplierFromPath("ehr/model/sources/BehaviorDefaults.js"));
// addClientDependency(ClientDependency.supplierFromPath("ehr/model/sources/BehaviorDefaults.js"));
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/BehaviorDefaults.js"));
setStoreCollectionClass("EHR.data.ClinicalReportStoreCollection");
addClientDependency(ClientDependency.supplierFromPath("ehr/data/ClinicalReportStoreCollection.js"));
addClientDependency(ClientDependency.supplierFromPath("ehr/model/sources/ClinicalDefaults.js"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ public BehaviorRoundsFormType(DataEntryFormContext ctx, Module owner)
s.addConfigSource("BehaviorRounds");
}

addClientDependency(ClientDependency.supplierFromPath("ehr/model/sources/BehaviorDefaults.js"));
//addClientDependency(ClientDependency.supplierFromPath("ehr/model/sources/BehaviorDefaults.js"));
//Created the ONPRC version .js file to add default value for the amount units field by Kollil on 12/1923
//Refer to tkt # 10285
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/BehaviorDefaults.js"));
addClientDependency(ClientDependency.supplierFromPath("ehr/model/sources/BehaviorRounds.js"));
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/window/BehaviorCasesWindow.js"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@
import java.util.Arrays;
import java.util.List;

/**
* User: bimber
* Date: 7/29/13
* Time: 5:03 PM
*/

//Modified: 11-15-2023 R. Blasa

public class PathologyTissuesFormType extends TaskForm
{
public static final String NAME = "PathologyTissues";
Expand Down Expand Up @@ -82,22 +80,16 @@ public PathologyTissuesFormType(DataEntryFormContext ctx, Module owner)

}

addClientDependency(ClientDependency.supplierFromPath("ehr/model/sources/Pathology.js"));
addClientDependency(ClientDependency.supplierFromPath("ehr/model/sources/Necropsy.js"));
addClientDependency(ClientDependency.supplierFromPath("ehr/form/field/PathologyCaseNoField.js"));
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/buttons/pathologyButtons.js"));
addClientDependency(ClientDependency.supplierFromPath("ehr/window/CopyFromCaseWindow.js"));

addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/grid/DragDropGridPanel.js"));

addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/grid/DragDropGridPanel.js"));
//Added: 5-5-2017 R.Blasa
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/model/sources/PathologyTissues.js"));

// //Added: 5-24-2017 R.Blasa
setStoreCollectionClass("onprc_ehr.data.sources.PathologyTissuesStoreCollection");
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/data/sources/PathologyTissuesStoreCollection.js"));


//Added 7-14-2022 R.Blasa
addClientDependency(ClientDependency.supplierFromPath("onprc_ehr/form/field/PathologyTissuesField.js"));
}
Expand Down
Loading