From 8ddb242cc6b64120a396bc3d49ab51fa2579bed2 Mon Sep 17 00:00:00 2001 From: Brendan Lawlor Date: Tue, 10 Sep 2024 21:02:53 +0000 Subject: [PATCH] Bug 37050: (follow-up) Add select2 to SQL reports multiselect Rebase for changes made on bug 37077 This patch removes some javascript in favor of an update to the template. The default value for multi select parameter's is a newline separated list so that report results are not limited when no selections are made. Signed-off-by: Michaela Sieber --- .../en/modules/reports/guided_reports_start.tt | 18 ++---------------- 1 file changed, 2 insertions(+), 16 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 e1f070f844..fde986a36b 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 @@ -881,7 +881,7 @@ [% IF (sql_param.select_multiple) %] [% END %] @@ -1582,7 +1582,6 @@ // if the report param form has multiselects override default form submission if( $('#report_param_form').find('select[multiple]').length ) { $('#report_param_form').find('select[multiple]').each( function (i) { - $(this).prepend(''); $(this).on('change', function() { var $selected = $(this).val().join('\n'); $(this).find('option:first').val($selected); @@ -1591,20 +1590,7 @@ $('#report_param_form').on('submit', function(e) { $('#report_param_form').find('select[multiple]').each( function (i) { - if( $(this).find('option:selected').length ) { - var $selected = $('option:first', this).val(); - $(this).val($selected); - } - else { - let values = $.map( $(this).find('option'), function(o) { - return $(o).val(); - }).slice(1).join('\n'); - $(this).find('option:first').val(values).prop('selected', true); - } - if( $(this).find('option:selected').length === 0 ) { - $(this).val(['%']); - } - else if( $(this).find('option:selected').length > 1 ) { + if( $(this).find('option:selected').length != 1 ) { var $selected = $('option:first', this).val(); $(this).val($selected); } -- 2.39.5