[FIX] web: check if second date exists in search_filters

After commit 6739e10, we have two widgets to be able to choose
two dates according to the operator (e.g. between).
So, the second widget is not always available.

'toString' generates the string to put in the facet and should
convert the second date only if the second widget exists.

Before this commit, it was not possible to make search filters with
only one date because we try to get value of widget that does not exist.
This commit is contained in:
Adrien Dieudonne
2016-08-10 09:11:23 +02:00
parent 5d7be21e28
commit a5eb720875
@@ -222,7 +222,7 @@ ExtendedSearchProposition.DateTime = ExtendedSearchProposition.Field.extend({
},
toString: function () {
var str = formats.format_value(this.get_value(), { type:this.attributes['type'] });
if (this.datewidget_2.get_value()) {
if (this.datewidget_2 && this.datewidget_2.get_value()) {
str += ' and ' + formats.format_value(this.datewidget_2.get_value(), { type:this.attributes['type'] });
}
return str;