diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index f6b079c794..197c2e09fd 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -578,8 +578,8 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { function build_query(col, value){ - // escape SQL special characters - value = value.replace(/(\%|\_|\\)/g, "\\$1" ); + // escape SQL special character \ + value = value.replace(/(\\)/g, "\\$1" ); var parts = []; var attributes = col.data.split(':'); @@ -590,6 +590,9 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { if ( value.match(/^\^(.*)\$$/) ) { value = value.replace(/^\^/, '').replace(/\$$/, ''); criteria = "exact"; + } else { + // escape SQL LIKE special characters % and _ + value = value.replace(/(\%|\_)/g, "\\$1"); } part[!attr.includes('.')?'me.'+attr:attr] = criteria === 'exact' ? value