Commit 140a196f authored by Romain Courteaud's avatar Romain Courteaud

WIP [erp5storage] Allow toquery the catalog with the group_by parameter

parent 657f7610
......@@ -474,6 +474,7 @@
if (context.hasCapacity("list") &&
((options.query === undefined) || context.hasCapacity("query")) &&
((options.sort_on === undefined) || context.hasCapacity("sort")) &&
((options.group_by === undefined) || context.hasCapacity("group")) &&
((options.select_list === undefined) ||
context.hasCapacity("select")) &&
((options.include_docs === undefined) ||
......
......@@ -420,7 +420,7 @@
ERP5Storage.prototype.hasCapacity = function (name) {
return ((name === "list") || (name === "query") ||
(name === "select") || (name === "limit") ||
(name === "sort"));
(name === "sort") || (name === "group"));
};
function isSingleLocalRoles(parsed_query) {
......@@ -488,7 +488,8 @@
local_roles,
local_role_found = false,
selection_domain,
sort_list = [];
sort_list = [],
group_list = [];
if (options.query) {
parsed_query = jIO.QueryFactory.create(options.query);
result_list = isSingleLocalRoles(parsed_query);
......@@ -554,10 +555,8 @@
}
}
if (options.sort_on) {
for (i = 0; i < options.sort_on.length; i += 1) {
sort_list.push(JSON.stringify(options.sort_on[i]));
}
if (options.group_by) {
group_list = options.group_by;
}
if (selection_domain) {
......@@ -573,6 +572,7 @@
select_list: options.select_list || ["title", "reference"],
limit: options.limit,
sort_on: sort_list,
group_by: group_list,
local_roles: local_roles,
selection_domain: selection_domain
})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment