From 9798a34adfde3c1a9d602a4e4fe96105036f688a 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. --- .../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 e59ed096b99..d9c2b7836f6 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 0fbb9b625cb..ef703578f46 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 ea0f3773d2b..566ee9869bc 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.34.1