diff --git a/public/js/legacy/webpage/search.js b/public/js/legacy/webpage/search.js index d782cd3331..e6bb086c68 100644 --- a/public/js/legacy/webpage/search.js +++ b/public/js/legacy/webpage/search.js @@ -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); } } diff --git a/public/js/legacy/widgets/form/fields.js b/public/js/legacy/widgets/form/fields.js index 2bdc997d2c..bb348cf4f2 100644 --- a/public/js/legacy/widgets/form/fields.js +++ b/public/js/legacy/widgets/form/fields.js @@ -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,