Bug 39534: Hide reports subgroup filter if there are no subgroups

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 <anneli.osterman@koha-suomi.fi>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1e57f5c8d3)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(cherry picked from commit d7bf63a327)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Owen Leonard 2025-05-21 16:57:41 +00:00 committed by Fridolin Somers
parent 35dee71d00
commit 859bf3c69c
No known key found for this signature in database
GPG Key ID: 9A8E73E2A8B96537
1 changed files with 13 additions and 6 deletions

View File

@ -1844,6 +1844,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 ){
@ -2343,13 +2346,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(
'<option value="' + group_subgroups[g_id][i][0] + '">'
+ group_subgroups[g_id][i][1] + '</option>'
);
if( group_subgroups[g_id] && group_subgroups[g_id].length > 0 ){
for(var i in group_subgroups[g_id]) {
$("#subgroup_filter").append(
'<option value="' + group_subgroups[g_id][i][0] + '">'
+ group_subgroups[g_id][i][1] + '</option>'
);
}
$("#subgroup_filter_block").show();
} else {
$("#subgroup_filter_block").hide();
}
$("#subgroup_filter_block").show();
} else {
$("#subgroup_filter_block").hide();
}