Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions ehr/src/org/labkey/ehr/EHRController.java
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ public ApiResponse execute(DiscardFormForm form, BindException errors)
public static class EHRQueryForm extends QueryForm
{
private boolean _showImport = false;
private boolean _queryUpdateURL = false;

public boolean isShowImport()
{
Expand All @@ -322,6 +323,16 @@ public void setShowImport(boolean showImport)
{
_showImport = showImport;
}

public boolean isQueryUpdateURL()
{
return _queryUpdateURL;
}

public void setQueryUpdateURL(boolean queryUpdateURL)
{
_queryUpdateURL = queryUpdateURL;
}
}

@RequiresPermission(UpdatePermission.class)
Expand Down Expand Up @@ -417,7 +428,24 @@ else if (isReactForm(form.getSchemaName(), form.getQueryName()))
}

DetailsURL updateUrl;
if (EHRServiceImpl.get().isUseFormEditUI(getContainer()) && null != ti.getColumn("taskid"))
if (form.isQueryUpdateURL())
{
// Send to the query controller's basic row-level update form
StringBuilder sb = new StringBuilder("query-updateQueryRow.view?schemaName=");
sb.append(ti.getUserSchema().getName());
sb.append("&queryName=");
sb.append(ti.getName());
for (String pk : pks)
{
sb.append("&");
sb.append(pk);
sb.append("=${");
sb.append(pk);
sb.append("}");
}
updateUrl = DetailsURL.fromString(sb.toString());
}
else if (EHRServiceImpl.get().isUseFormEditUI(getContainer()) && null != ti.getColumn("taskid"))
{
updateUrl = DetailsURL.fromString("/ehr/dataEntryForm.view?taskid=${taskid}&formType=${taskid/formType}");
}
Expand Down Expand Up @@ -1445,8 +1473,8 @@ public ModelAndView getView(EnterDataForm form, BindException errors)
{
if (form.getFormType() == null)
{
errors.reject(ERROR_MSG, "Must provide either the form type");
return null;
errors.reject(ERROR_MSG, "Must provide a form type");
return new SimpleErrorView(errors);
}

_def = DataEntryManager.get().getFormByName(form.getFormType(), getContainer(), getUser());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public void testCustomButtons()
recallLocation();
List<String> submenuItems = dr.getHeaderMenuOptions("More Actions");
List<String> expectedSubmenu = Arrays.asList("Jump To History", "Return Distinct Values","Show Record History","Compare Weights","Edit Records");
Assert.assertEquals("More actions menu did not contain expected options",expectedSubmenu, submenuItems);
Assert.assertTrue("More actions menu did not contain expected options. Expected: " + expectedSubmenu + ", but found: " + submenuItems, submenuItems.containsAll(expectedSubmenu));
}

private void testUserAgainstAllStates(@LoggedParam EHRUser user)
Expand Down