From 74709813ff942aca1e21aca2d1689ed2e11605a6 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 21 May 2025 16:57:41 +0000 Subject: [PATCH] Bug 39534: Hide reports subgroup filter if there are no subgroups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch updates the JavaScript which runs on the list of saved SQL reports, adding a check for report subgroups to the display of the report subgroups dropdown. The patch also hides the subgroups dropdown if there is no saved tab, in which case the tabsInit function doesn't run. To test you should have multiple reports organized in multiple groups and subgroups. See the test plan on Bug 39534. - Go to Reports -> Saved SQL reports. - If the page loads with the "All" tab active, there should be no subgroups dropdown. - If the page loads under a different tab, the subgroups dropdown should only show if that group has subgroups. - Switch between the various report group tabs to confirm that the subgroups dropdown is shown or hidden correctly based on the existence of subgroups. Sponsored-by: Athens County Public Libraries Signed-off-by: Anneli Österman Signed-off-by: Lisette Scheer --- .../modules/reports/guided_reports_start.tt | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 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 c61553b88b3..b954e48a9d2 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 @@ -1984,6 +1984,9 @@ $(document).ready(function(){ var activeTab = localStorage.getItem("sql_reports_activetab"); + if( activeTab == 0 ){ + $("#subgroup_filter_block").hide(); + } $("body").on('click',".fetch_chart_data",function(){ if( [% unlimited_total || 0 | $raw %] > 1000 ){ @@ -2492,13 +2495,17 @@ if (g_id && g_id.length > 0) { col4.search(g_id, {exact:true}).visible(false); - for(var i in group_subgroups[g_id]) { - $("#subgroup_filter").append( - '' - ); + if( group_subgroups[g_id] && group_subgroups[g_id].length > 0 ){ + for(var i in group_subgroups[g_id]) { + $("#subgroup_filter").append( + '' + ); + } + $("#subgroup_filter_block").show(); + } else { + $("#subgroup_filter_block").hide(); } - $("#subgroup_filter_block").show(); } else { $("#subgroup_filter_block").hide(); } -- 2.39.5