Skip to content

Commit 2c32319

Browse files
Merge 23.7 to develop
2 parents f78f28a + d4ebb5e commit 2c32319

2 files changed

Lines changed: 37 additions & 5 deletions

File tree

ehr/api-src/org/labkey/api/ehr/SharedEHRUpgradeCode.java

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,23 @@ public void fallthroughHandler(String methodName)
115115
else if (methodName.startsWith(IMPORT_FROM_TSV_PREFIX))
116116
{
117117
String[] tsvArguments = methodName.split(";");
118-
if (tsvArguments.length != 4)
118+
if (tsvArguments.length < 4 || tsvArguments.length > 5)
119119
{
120-
throw new UnsupportedOperationException("Expected three arguments for importFromTsv but got " + (tsvArguments.length - 1));
120+
throw new UnsupportedOperationException("Expected three or four arguments for importFromTsv but got " + (tsvArguments.length - 1));
121121
}
122122
String schemaName = tsvArguments[1];
123123
String queryName = tsvArguments[2];
124124
String tsvPath = tsvArguments[3];
125125

126-
_tsvImports.add(new TsvImport(schemaName, queryName, tsvPath));
126+
if (tsvArguments.length == 5)
127+
{
128+
String containerPath = tsvArguments[4];
129+
_tsvImports.add(new TsvImport(schemaName, queryName, tsvPath, containerPath));
130+
}
131+
else
132+
{
133+
_tsvImports.add(new TsvImport(schemaName, queryName, tsvPath));
134+
}
127135
}
128136
else if (methodName.startsWith(IMPORT_DOMAIN_TEMPLATE))
129137
{
@@ -216,7 +224,23 @@ public void moduleStartupComplete(ServletContext servletContext)
216224
{
217225
for (TsvImport tsvImport : _tsvImports)
218226
{
219-
importFile(tsvImport, container, user);
227+
if (tsvImport._containerPath != null)
228+
{
229+
Container tsvImportContainer = ContainerManager.getForPath(tsvImport._containerPath);
230+
if (tsvImportContainer != null)
231+
{
232+
importFile(tsvImport, tsvImportContainer, user);
233+
}
234+
else
235+
{
236+
LOG.warn("Unable to find container for path " + tsvImport._containerPath + ". Importing into EHR study container.");
237+
importFile(tsvImport, container, user);
238+
}
239+
}
240+
else
241+
{
242+
importFile(tsvImport, container, user);
243+
}
220244
}
221245

222246
if (_reloadFolder)
@@ -308,6 +332,7 @@ private static class TsvImport
308332
private final String _schemaName;
309333
private final String _queryName;
310334
private final String _tsvPath;
335+
private String _containerPath;
311336

312337
public TsvImport(String schemaName, String queryName, String tsvPath)
313338
{
@@ -316,6 +341,12 @@ public TsvImport(String schemaName, String queryName, String tsvPath)
316341
_tsvPath = tsvPath;
317342
}
318343

344+
public TsvImport(String schemaName, String queryName, String tsvPath, String containerPath)
345+
{
346+
this(schemaName, queryName, tsvPath);
347+
_containerPath = containerPath;
348+
}
349+
319350
@Override
320351
public boolean equals(Object o)
321352
{

ehr/api-src/org/labkey/api/ehr/dataentry/SingleQueryFormSection.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.labkey.api.ehr.dataentry;
1717

1818
import org.json.JSONObject;
19+
import org.labkey.api.util.JsonUtil;
1920
import org.labkey.api.view.template.ClientDependency;
2021

2122
import java.util.HashMap;
@@ -46,7 +47,7 @@ public JSONObject toJSON(DataEntryFormContext ctx, boolean includeFormElements)
4647
formConfig.put("title", null);
4748
formConfig.put("label", null);
4849
formConfig.put("maxItemsPerCol", 8);
49-
ret.put("formConfig", formConfig);
50+
ret.put("formConfig", JsonUtil.toJsonPreserveNulls(formConfig));
5051

5152
return ret;
5253
}

0 commit comments

Comments
 (0)