replace undefined values with null in filters returned by get query before calling search or autocomplete

This commit is contained in:
Anand Doshi 2013-02-18 11:35:58 +05:30
parent 30a41df226
commit fb7bd1c77a
2 changed files with 15 additions and 7 deletions

View file

@ -155,11 +155,14 @@ function makeselector() {
if (typeof(q)==="string") {
args.query = q;
} else {
// replaced $.extend(args, q)
$.each(q, function(key, value) {
args[key] = value;
});
} else if($.isPlainObject(q)) {
if(q.filters) {
$.each(q.filters, function(key, value) {
q.filters[key] = value===undefined ? null : value;
});
}
$.extend(args, q);
}
}

View file

@ -639,10 +639,15 @@ LinkField.prototype.make_input = function() {
var q = me.get_custom_query();
if (typeof(q)==="string") {
args.query = q;
} else {
} else if($.isPlainObject(q)) {
if(q.filters) {
$.each(q.filters, function(key, value) {
q.filters[key] = value===undefined ? null : value;
});
}
$.extend(args, q);
}
wn.call({
method:'webnotes.widgets.search.search_link',
args: args,