From e358100ebfb25814a7b499b40e6b1a5d8c3c1274 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 Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi (cherry picked from commit a4546536298a8c921de434de0ea3fbd58c6dd303) Signed-off-by: Jacob O'Mara --- .../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 9d9e3a3379..84d11fc8a5 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 378fea1054..2e922c64a6 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.39.5