Commit a3fc5406 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_web_renderjs_ui: fix code to support cases of queries with two parameters

parent 1567b352
......@@ -27,22 +27,35 @@
});
})
.declareMethod('getSearchCriteria', function (a, b) {
var key, value;
if (this.state.extended_search_mapping.hasOwnProperty(b)) {
var key, value, query;
if (this.state.extended_search_mapping.hasOwnProperty(a) &&
this.state.extended_search_mapping.hasOwnProperty(b)) {
query = new ComplexQuery({
operator: "AND",
type: "complex",
query_list: [
new SimpleQuery({
operator: "",
key: this.state.extended_search_mapping[a].key,
type: "simple",
value: this.state.extended_search_mapping[a].value
}),
new SimpleQuery({
operator: "",
key: this.state.extended_search_mapping[b].key,
type: "simple",
value: this.state.extended_search_mapping[b].value
})
]
});
} else if (this.state.extended_search_mapping.hasOwnProperty(b)) {
key = this.state.extended_search_mapping[b].value;
value = a;
} else {
key = this.state.extended_search_mapping[a].key;
value = this.state.extended_search_mapping[a].value;
}
return Query.objectToSearchText(
new SimpleQuery({
operator: "",
key: key,
type: "simple",
value: value
})
);
return Query.objectToSearchText(query);
})
/////////////////////////////////////////////////////////////////
// declared methods
......@@ -187,6 +200,7 @@
"select_list": select_list
};
}
return gadget.getUrlParameter('extended_search')
.push(function (extended_search) {
if (extended_search) {
......@@ -310,6 +324,11 @@
data_mapping[label_list[i - 1]][state] =
result_list[i].data.rows[j].value[gadget.state.y];
}
// Can I change state here?
gadget.state.extended_search_mapping[state] = {
key: gadget.state.x,
value: state
};
if (state_list.indexOf(state) === -1) {
state_list.push(state);
}
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>997.29949.14410.11229</string> </value>
<value> <string>997.29983.5320.38758</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1641979761.56</float>
<float>1641980191.85</float>
<string>UTC</string>
</tuple>
</state>
......
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