Skip to content

Commit a8df935

Browse files
Ticket 53312: Bulk editing "Ordered By" in treatments (#546)
* Add store handling in the editor config for orderedby and endtreatmentorderedby * Remove redundant performedby metadata
1 parent 09be99c commit a8df935

7 files changed

Lines changed: 34 additions & 71 deletions

File tree

nirc_ehr/resources/web/nirc_ehr/model/sources/BehavioralCase.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,6 @@ EHR.model.DataModelManager.registerMetadata('BehavioralCase', {
9797
caseCategory: {
9898
hidden: true
9999
},
100-
performedby: {
101-
hidden: false,
102-
defaultValue: LABKEY.Security.currentUser.id.toString(),
103-
editorConfig: {
104-
store: {
105-
type: 'labkey-store',
106-
schemaName: 'core',
107-
sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.users',
108-
autoLoad: true
109-
}
110-
}
111-
},
112100
formCasesLink: {
113101
xtype: 'nirc_ehr-editCases'
114102
}

nirc_ehr/resources/web/nirc_ehr/model/sources/BulkBehavior.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,7 @@ EHR.model.DataModelManager.registerMetadata('BulkBehavior', {
4343
},
4444
qcstate: {
4545
hidden: true
46-
},
47-
performedby: {
48-
hidden: false,
49-
defaultValue: LABKEY.Security.currentUser.id.toString(),
50-
editorConfig: {
51-
store: {
52-
type: 'labkey-store',
53-
schemaName: 'core',
54-
sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.users',
55-
autoLoad: true
56-
}
57-
}
58-
},
46+
}
5947
},
6048
'study.clinical_observations': {
6149
type: {

nirc_ehr/resources/web/nirc_ehr/model/sources/BulkClinical.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,7 @@ EHR.model.DataModelManager.registerMetadata('BulkClinical', {
3636
columnConfig: {
3737
editable: false
3838
}
39-
},
40-
performedby: {
41-
hidden: false,
42-
defaultValue: LABKEY.Security.currentUser.id.toString(),
43-
editorConfig: {
44-
store: {
45-
type: 'labkey-store',
46-
schemaName: 'core',
47-
sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.users',
48-
autoLoad: true
49-
}
50-
}
51-
},
39+
}
5240
}
5341
}
5442
});

nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalCase.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,6 @@ EHR.model.DataModelManager.registerMetadata('ClinicalCase', {
9797
caseCategory: {
9898
hidden: true
9999
},
100-
performedby: {
101-
hidden: false,
102-
defaultValue: LABKEY.Security.currentUser.id.toString(),
103-
editorConfig: {
104-
store: {
105-
type: 'labkey-store',
106-
schemaName: 'core',
107-
sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.users',
108-
autoLoad: true
109-
}
110-
}
111-
},
112100
formCasesLink: {
113101
xtype: 'nirc_ehr-editCases'
114102
}

nirc_ehr/resources/web/nirc_ehr/model/sources/ClinicalDefaults.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,6 @@ EHR.model.DataModelManager.registerMetadata('ClinicalDefaults', {
100100
defaultValue: 'Clinical',
101101
hidden: true
102102
},
103-
performedby: {
104-
hidden: false,
105-
defaultValue: LABKEY.Security.currentUser.id.toString(),
106-
editorConfig: {
107-
store: {
108-
type: 'labkey-store',
109-
schemaName: 'core',
110-
111-
// 'performedby' is a text field in the dataset and its lookup to the userid is an int field - this mismatch causes it to disappear
112-
// from the display when a value is selected from the dropdown even though the 'userid' value gets saved as a text (this behavior was only seen
113-
// in the form panel but not in the grid panel).
114-
// casting it as a varchar when loading the store fixes this issue.
115-
sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName,FirstName,LastName FROM core.users',
116-
autoLoad: true
117-
}
118-
}
119-
},
120103
category: {
121104
defaultValue: 'Clinical',
122105
hidden: true,

nirc_ehr/resources/web/nirc_ehr/model/sources/NIRCDefault.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ EHR.model.DataModelManager.registerMetadata('Default', {
1111
},
1212
performedby: {
1313
hidden: false,
14-
defaultValue: LABKEY.Security.currentUser.id.toString(),
14+
defaultValue: LABKEY.Security.currentUser.id,
1515
getInitialValue: function (v, rec) {
1616
return LABKEY.Security.currentUser.id;
1717
},
@@ -35,6 +35,18 @@ EHR.model.DataModelManager.registerMetadata('Default', {
3535
defaultValue: null,
3636
columnConfig: {
3737
width: 160
38+
},
39+
editorConfig: {
40+
store: {
41+
type: 'labkey-store',
42+
schemaName: 'ehr_lookups',
43+
44+
// 'orderedby' is a text field in the dataset and its lookup to the userid is an int field - this mismatch causes it to disappear
45+
// from the display when a value is selected from the dropdown even though the 'userid' value gets saved as a text.
46+
// Casting it as a varchar when loading the store fixes this issue.
47+
sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName FROM ehr_lookups.veterinarians',
48+
autoLoad: true
49+
}
3850
}
3951
},
4052
scheduleddate: {
@@ -151,6 +163,16 @@ EHR.model.DataModelManager.registerMetadata('Default', {
151163
endTreatmentOrderedBy: {
152164
columnConfig: {
153165
width: 200
166+
},
167+
editorConfig: {
168+
store: {
169+
type: 'labkey-store',
170+
schemaName: 'ehr_lookups',
171+
172+
// see 'orderedby' comment above.
173+
sql: 'SELECT CAST (UserId AS VARCHAR) AS UserId,DisplayName FROM ehr_lookups.veterinarians',
174+
autoLoad: true
175+
}
154176
}
155177
}
156178
},

nirc_ehr/test/src/org.labkey.test/tests.nirc_ehr/NIRC_EHRTest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,16 @@ public void testClinicalCasesWorkflow()
836836
orderGrid.setGridCell(1, "frequency", "QID");
837837
orderGrid.clickDownArrowOnGrid(1, "route");
838838
orderGrid.setGridCell(1, "route", "IVAG");
839-
orderGrid.clickDownArrowOnGrid(1, "orderedby");
840-
orderGrid.setGridCell(1, "orderedby", NIRC_VET_NAME);
841839
orderGrid.completeEdit();
840+
841+
Locator.XPathLocator bulkEditWindow = _helper.openBulkEdit(orderGrid);
842+
_helper.toggleBulkEditExactField("Ordered By");
843+
_ext4Helper.selectComboBoxItem(Ext4Helper.Locators.formItemWithLabelContaining("Ordered By:"), NIRC_VET_NAME);
844+
waitAndClick(bulkEditWindow.append(Ext4Helper.Locators.ext4Button("Submit")));
845+
846+
Window msgWindow = new Window.WindowFinder(this.getDriver()).withTitle("Set Values").waitFor();
847+
msgWindow.clickButton("Yes", 0);
848+
842849
submitForm("Submit Final", "Finalize Form");
843850

844851
log("Completing today's Medication Schedule");
@@ -857,7 +864,6 @@ public void testClinicalCasesWorkflow()
857864
submitForm("Submit Final", "Finalize");
858865
stopImpersonating();
859866

860-
// TODO: This will be reimplemented in a current PR, this can than be uncommented.
861867
//Go to NIRC/EHR main page
862868
goToEHRFolder();
863869
impersonate(NIRC_FULL_SUBMITTER_VET);

0 commit comments

Comments
 (0)