From b54b0fddcddf63417be6f2480e45ac8ec516bba9 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Mon, 27 Feb 2023 23:45:12 +0000 Subject: [PATCH] Bug 33063: Make sure correct subgroup is pre-selected when duplicating reports When the 'Duplicate' option for reports was used, the all options would be copied correctly to the new report, but the report sub group. In this case the templates were created correctly, but the JavaScript to create the correct pull downs for each group, overwrote the the selection. To test: * Create a some reports with different groups and subgroups and without * 'Duplicate' your reports and verify that the sub group will always stay empty * Apply patch * Verify the correct sub group is now always selected * Edit/Add some reports to make sure the group/subgroup controls still work as expected Signed-off-by: Sally Signed-off-by: Lucas Gass Signed-off-by: Tomas Cohen Arazi (cherry picked from commit a651ff50a6819396cc24c5f6bc47110cdd001873) Signed-off-by: Matt Blenkinsop (cherry picked from commit 36df529064afedcf366b7dc0f0ca79382cb1420a) Signed-off-by: Lucas Gass --- .../prog/en/modules/reports/guided_reports_start.tt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 d16629a54a..8384309c44 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 @@ -1671,6 +1671,7 @@ function load_group_subgroups () { var group = $("#group_select").val(); + var subgroup = $("#subgroup_select").val(); var sg = $("#subgroup"); $(sg).find('option[value!=""]').each(function() { $(this).remove(); @@ -1679,7 +1680,11 @@ if (group) { var select = $(sg).find('select')[0]; $.each( group_subgroups[group], function(index, value) { - $('').appendTo(select); + if ( value[0] == subgroup ) { + $('').appendTo(select); + } else { + $('').appendTo(select); + } } ); $("#subgroup, #subgroup *").show(); } -- 2.20.1