From 32e4a27e193ec1f8c897b66ad5a25e3b0074a427 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 6 Dec 2022 11:19:31 -0300 Subject: [PATCH] Bug 32401: Remove x-koha-query support HTTP headers can only contain ASCII characters, and it is thus impractical to use a header for passing DB queries that could contain non-ascii characters. We don't need it, and should be removed. This patch removes traces from the datatables.js files and also from detail.tt, which had it set to false anyway. See bug 32406 and bug 32409 for the cases in which it was being used, and problematic. Signed-off-by: David Nind --- .../prog/en/modules/catalogue/detail.tt | 1 - koha-tmpl/intranet-tmpl/prog/js/datatables.js | 12 ++---------- koha-tmpl/opac-tmpl/bootstrap/js/datatables.js | 12 ++---------- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index e59ed096b9..d9c2b7836f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -1651,7 +1651,6 @@ Note that permanent location is a code, and location may be an authval. "ajax": { "url": bundle_table_url }, - "header_filter": false, "embed": [ "biblio", "return_claim.patron" diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index 0fbb9b625c..ef703578f4 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -553,10 +553,6 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { if(options.embed) { xhr.setRequestHeader('x-koha-embed', Array.isArray(options.embed)?options.embed.join(','):options.embed); } - if(options.header_filter && options.query_parameters) { - xhr.setRequestHeader('x-koha-query', options.query_parameters); - delete options.query_parameters; - } }, 'dataFilter': function(data, type) { var json = {data: JSON.parse(data)}; @@ -666,12 +662,8 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { if(query_parameters.length) { query_parameters = JSON.stringify(query_parameters.length === 1?query_parameters[0]:{"-and": query_parameters}); - if(options.header_filter) { - options.query_parameters = query_parameters; - } else { - dataSet.q = query_parameters; - delete options.query_parameters; - } + dataSet.q = query_parameters; + delete options.query_parameters; } else { delete options.query_parameters; } diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js b/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js index ea0f3773d2..566ee9869b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js @@ -141,10 +141,6 @@ $.fn.dataTable.ext.buttons.clearFilter = { if(options.embed) { xhr.setRequestHeader('x-koha-embed', Array.isArray(options.embed)?options.embed.join(','):options.embed); } - if(options.header_filter && options.query_parameters) { - xhr.setRequestHeader('x-koha-query', options.query_parameters); - delete options.query_parameters; - } }, 'dataFilter': function(data, type) { var json = {data: JSON.parse(data)}; @@ -180,12 +176,8 @@ $.fn.dataTable.ext.buttons.clearFilter = { if(query_parameters.length) { query_parameters = JSON.stringify(query_parameters.length === 1?query_parameters[0]:query_parameters); - if(options.header_filter) { - options.query_parameters = query_parameters; - } else { - dataSet.q = query_parameters; - delete options.query_parameters; - } + dataSet.q = query_parameters; + delete options.query_parameters; } else { delete options.query_parameters; } -- 2.30.2