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