Bugzilla – Attachment 161645 Details for
Bug 35943
SQL reports groups/subgroups whose name contains regexp special characters break table filtering
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35943: Fix group/subgroup filtering of saved reports
Bug-35943-Fix-groupsubgroup-filtering-of-saved-rep.patch (text/plain), 3.80 KB, created by
Julian Maurice
on 2024-01-30 14:47:17 UTC
(
hide
)
Description:
Bug 35943: Fix group/subgroup filtering of saved reports
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2024-01-30 14:47:17 UTC
Size:
3.80 KB
patch
obsolete
>From 3b64cd32348ea116442025a8d9ba864aaa63d1d4 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Tue, 30 Jan 2024 15:13:47 +0100 >Subject: [PATCH] Bug 35943: Fix group/subgroup filtering of saved reports > >Use code instead of name for filtering and escape regexp special >characters. > >This patch also disables datatables' smart filtering as it is not >recommended to use with regexp filtering > >https://datatables.net/reference/api/search() > >Test plan: >1. Create a report in a group named "Foo + Bar" and in a subgroup named > "Baz + Quux" >2. Create other reports in group "Foo + Bar" but in other subgroups, as > well as in other groups. This is useful to see the effect of > filtering >3. Go to the saved reports page and verify that navigating between tabs > have the desired result. Same for the subgroup select >--- > .../en/modules/reports/guided_reports_start.tt | 18 ++++++++---------- > 1 file changed, 8 insertions(+), 10 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >index 5d1132bb426..b16329f8781 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >@@ -319,10 +319,10 @@ > <td class="report_type"> > [% savedreport.type | html %] > </td> >- <td class="report_group"> >+ <td data-search="[% savedreport.report_group | html %]" class="report_group"> > [% savedreport.groupname | html %] > </td> >- <td> >+ <td data-search="[% savedreport.report_subgroup | html %]"> > [% savedreport.subgroupname | html %] > </td> > <td class="report_notes"> >@@ -1967,9 +1967,9 @@ > $("#subgroup_filter").change(function() { > var selected = $(this).find('option:selected'); > var sg_id = $(selected).val(); >- var sg_name = $(selected).text(); > if (sg_id.length > 0) { >- rtable.fnFilter('^' + sg_name + '$', 5, true, true, true, false); >+ const input = '^' + $.fn.dataTable.util.escapeRegex(sg_id) + '$'; >+ rtable.fnFilter(input, 5, true, false, true, false); > rtable.fnSetColumnVis(5, false); > } else { > rtable.fnFilter('', 5); >@@ -2280,15 +2280,13 @@ > rtable.fnSetColumnVis(5, true); > > var g_id = tab.find("a").data("tabname"); >- var g_name = tab.find("a").text().trim(); >- >- if ( g_name == _("All") ) { >- g_id = ""; >- g_name = ""; >+ if (g_id === 'reports') { >+ g_id = ''; > } > > if (g_id && g_id.length > 0) { >- rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false); >+ const input = '^' + $.fn.dataTable.util.escapeRegex(g_id) + '$'; >+ rtable.fnFilter(input, 4, true, false, true, false); > rtable.fnSetColumnVis(4, false); > for(var i in group_subgroups[g_id]) { > $("#subgroup_filter").append( >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35943
:
161645
|
161793
|
163694