Skip to content

Commit 055ce14

Browse files
Fix treatment order updates (#1482)
* Remove ParticipantSequenceNum * Check for null return and errors
1 parent e075f2e commit 055ce14

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

onprc_ehr/src/org/labkey/onprc_ehr/query/ONPRC_EHRTriggerHelper.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ public Date createUpdatedTreatmentRow(Map<String, Object> row, Map<String, Objec
368368
Map<String, Object> toCreate = new CaseInsensitiveHashMap<>();
369369
toCreate.putAll(oldRow);
370370
toCreate.remove("lsid");
371+
toCreate.remove("ParticipantSequenceNum");
371372

372373
String originalObjectId = (String) toCreate.get("objectid");
373374
assert originalObjectId != null;
@@ -385,14 +386,19 @@ public Date createUpdatedTreatmentRow(Map<String, Object> row, Map<String, Objec
385386
List<Map<String, Object>> createdRows = treatmentOrders.getUpdateService().insertRows(getUser(), getContainer(), Arrays.asList(toCreate), errors, null, getExtraContext());
386387

387388
//also update records in drugs table
388-
if (!createdRows.isEmpty())
389+
if (createdRows != null && !createdRows.isEmpty())
389390
{
390391
TableInfo drugAdministration = getRealTable(getTableInfo("study", "Drug Administration"));
391392
SQLFragment sql = new SQLFragment("UPDATE " + drugAdministration.getSelectName() + " SET treatmentid = ? WHERE treatmentid = ?", newObjectId, originalObjectId);
392393
SqlExecutor se = new SqlExecutor(drugAdministration.getSchema().getScope());
393394
se.execute(sql);
394395
}
395396

397+
if (errors.hasErrors())
398+
{
399+
throw errors;
400+
}
401+
396402
return now;
397403
}
398404

0 commit comments

Comments
 (0)