From 8550e7bdedc2d9e67cafa9a5cea323deb1de57cc Mon Sep 17 00:00:00 2001 From: Maharshi Patel Date: Tue, 10 Oct 2023 21:18:20 +0530 Subject: [PATCH] chore: deprecated get_filter_as_json Instead of removing get_filter_as_json add console warn. --- frappe/public/js/frappe/utils/utils.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/frappe/public/js/frappe/utils/utils.js b/frappe/public/js/frappe/utils/utils.js index f4dbe35b4a..0a2fb45194 100644 --- a/frappe/public/js/frappe/utils/utils.js +++ b/frappe/public/js/frappe/utils/utils.js @@ -1605,6 +1605,20 @@ Object.assign(frappe.utils, { return string; } }, + // deprecated! + get_filter_as_json(filters) { + console.warn("frappe.utils.get_filter_as_json is deprecated."); + // convert filter array to json + let filter = null; + if (filters.length) { + filter = {}; + filters.forEach((arr) => { + filter[arr[1]] = [arr[2], arr[3]]; + }); + filter = JSON.stringify(filter); + } + return filter; + }, process_filter_expression(filter) { return new Function(`return ${filter}`)();