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
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
*/
Ext4.define("AnimalGroupsStore", {
extend: 'Ext.data.Store',
fields: ['code', 'categoryCode', 'name', {name: 'date', type: 'date', submitFormat: 'Y-m-d'}, {
name: 'endDate',
type: 'date',
submitFormat: 'Y-m-d'
}, 'comment', 'sortOrder'],
fields: ['code', 'categoryCode', 'name',
{name: 'date', type: 'date', dateReadFormat: 'Y-m-d', submitFormat: 'Y-m-d'},
{name: 'endDate', type: 'date', dateReadFormat: 'Y-m-d', submitFormat: 'Y-m-d' },
'comment', 'sortOrder'],
autoLoad: false,
proxy: {
type: 'ajax',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public ApiResponse execute(SimpleApiJsonForm simpleApiJsonForm, BindException er
if (mappedRows.get("code") != null && (Integer) mappedRows.get("code") != 0)
{
mappedRows.put("category_code", o.get("categoryCode"));
mappedRows.put("sort_order", o.get("sortOrder"));
mappedRows.put("sort_order", o.isNull("sortOrder") ? null : o.get("sortOrder"));

// update existing row
rowsList.add(mappedRows);
Expand All @@ -482,7 +482,7 @@ public ApiResponse execute(SimpleApiJsonForm simpleApiJsonForm, BindException er
//mappedRows.put("code", -1);
mappedRows.put("objectId", GUID.makeGUID());
mappedRows.put("category_code", o.get("categoryCode"));
mappedRows.put("sort_order", o.get("sortOrder"));
mappedRows.put("sort_order", o.isNull("sortOrder") ? null : o.get("sortOrder"));
rowsList.add(mappedRows);
qus.insertRows(getUser(), getContainer(), rowsList, batchErrors, null, null);
if (batchErrors.hasErrors()) throw batchErrors;
Expand Down
6 changes: 5 additions & 1 deletion snprc_ehr/src/org/labkey/snprc_ehr/domain/AnimalGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.json.JSONObject;
import org.labkey.api.data.Entity;
import org.labkey.api.util.DateUtil;

import java.util.Date;

Expand Down Expand Up @@ -111,6 +112,9 @@ public void setSortOrder(String sortOrder)

public JSONObject toJSON()
{
return new JSONObject(this);
JSONObject json = new JSONObject(this);
json.put("date", DateUtil.formatIsoDate(date));
json.put("endDate", DateUtil.formatIsoDate(endDate));
return json;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -353,16 +353,34 @@ protected void initSND()

protected void createSNDCategories() throws CommandException, IOException
{
InsertRowsCommand command = new InsertRowsCommand("snd", "PkgCategories");
SelectRowsCommand selectCommand = new SelectRowsCommand("snd", "PkgCategories");
selectCommand.setColumns(List.of("Description"));
SelectRowsResponse response = selectCommand.execute(createDefaultConnection(), getProjectName());

List<String> existingCategories = new ArrayList<>();
for (Map<String, Object> row : response.getRows())
{
Object description = row.get("Description");
if (description != null)
existingCategories.add(String.valueOf(description));
}

InsertRowsCommand insertCommand = new InsertRowsCommand("snd", "PkgCategories");
boolean hasNewCategories = false;
for (String category : SND_CATEGORIES)
{
command.addRow(new HashMap<>(Maps.of(
if (existingCategories.contains(category))
continue;

insertCommand.addRow(new HashMap<>(Maps.of(
"Description", category,
"Active", true
)));
hasNewCategories = true;
}

command.execute(createDefaultConnection(), getProjectName());
if (hasNewCategories)
insertCommand.execute(createDefaultConnection(), getProjectName());
}

protected void createSNDPackages() throws Exception
Expand Down Expand Up @@ -617,7 +635,7 @@ protected void deleteRoomRecords() throws CommandException, IOException
@Override
protected void populateInitialData()
{
beginAt(WebTestHelper.getBaseURL() + "/SNPRC_EHR/" + getContainerPath() + "/populateData.view");
beginAt(WebTestHelper.buildURL("SNPRC_EHR", getContainerPath(), "populateData"));

repopulate("Lookup Sets");
repopulate("All");
Expand Down
Loading
Loading