Commit c7060439 authored by Boris Kocherov's avatar Boris Kocherov

erp5_officejs: schema_editor: use Query builder instead string concatination. thanks @jerome

parent f61a5271
/*global window, rJS, RSVP, jIO, URL, /*global window, rJS, RSVP, jIO, URL, Query,
promiseEventListener, document*/ promiseEventListener, document*/
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, jIO, rJS, RSVP) { (function (window, jIO, rJS, RSVP, Query) {
"use strict"; "use strict";
rJS(window) rJS(window)
...@@ -88,11 +88,25 @@ ...@@ -88,11 +88,25 @@
url = arr[0], url = arr[0],
reference, reference,
args; args;
// return g.jio_getAttachment(id, "data", {format: "json"});
if (url.startsWith("urn:jio:reference?")) { if (url.startsWith("urn:jio:reference?")) {
reference = decodeURIComponent(url.replace("urn:jio:reference?", "")); reference = decodeURIComponent(url.replace("urn:jio:reference?", ""));
args = { args = {
query: '(portal_type: "JSON Schema") AND ((reference: "' + reference + '"))', query: Query.objectToSearchText({
type: "complex",
operator: "AND",
query_list: [
{
key: "portal_type",
type: "simple",
value: "JSON Schema"
},
{
key: "reference",
type: "simple",
value: reference
}
]
}),
limit: [0, 1], limit: [0, 1],
select_list: [], select_list: [],
sort_on: [["modification_date", "descending"]] sort_on: [["modification_date", "descending"]]
...@@ -199,4 +213,4 @@ ...@@ -199,4 +213,4 @@
}); });
}); });
}); });
}(window, jIO, rJS, RSVP)); }(window, jIO, rJS, RSVP, Query));
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