From deba32b7cd332b05a438886fa39bbd5b2df4375f Mon Sep 17 00:00:00 2001 From: Blou Date: Mon, 9 Jan 2023 16:32:03 -0500 Subject: [PATCH] Bug 27113: (follow-up) diacritics/acccents in sought word would make autocomplete return nothing --- koha-tmpl/intranet-tmpl/js/elasticsearch/autocomplete.js | 1 + .../bootstrap/js/opac-elasticsearch/opac-autocomplete.js | 1 + 2 files changed, 2 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/js/elasticsearch/autocomplete.js b/koha-tmpl/intranet-tmpl/js/elasticsearch/autocomplete.js index 6c9ff58330..ae89321796 100644 --- a/koha-tmpl/intranet-tmpl/js/elasticsearch/autocomplete.js +++ b/koha-tmpl/intranet-tmpl/js/elasticsearch/autocomplete.js @@ -116,6 +116,7 @@ function autocomplete(inp, nb, left, right) { myset = GetSetAutocomplete(data, prefix, key); /* append set to autocomplete */ + tmp_input = tmp_input.normalize("NFD").replace(/\p{Diacritic}/gu, ""); if ( tmp_input + prefix == data['val'] + data['prefix'] && token_counter === parseInt(data['token_counter'], 10)){ a.innerHTML = ""; for (let item of myset){ diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/opac-elasticsearch/opac-autocomplete.js b/koha-tmpl/opac-tmpl/bootstrap/js/opac-elasticsearch/opac-autocomplete.js index 0bcdb9dc82..b37d8e3b22 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/opac-elasticsearch/opac-autocomplete.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/opac-elasticsearch/opac-autocomplete.js @@ -112,6 +112,7 @@ function autocomplete(inp, nb, left, right) { myset = GetSetAutocomplete(data, prefix, key); /* append set to autocomplete */ + tmp_input = tmp_input.normalize("NFD").replace(/\p{Diacritic}/gu, ""); if ( tmp_input + prefix == data['val'] + data['prefix'] && token_counter === parseInt(data['token_counter'], 10)){ a.innerHTML = ""; for (let item of myset){ -- 2.34.1