From 4056371a9059dba45b575c47d10ca6b46ab41a4c Mon Sep 17 00:00:00 2001 From: Brendan Lawlor Date: Tue, 10 Sep 2024 19:30:52 +0000 Subject: [PATCH] Bug 37886: Make multiselect parameters optional in SQL reports This bug changes the default starting value for multiselects to be a newline separated list of all authorised values so the SQL in() function does not limit the results when no selections are made. To test: 1. Create an SQL report like select * from items where homebranch in <> and itype in <> 2. Run the report without selecting any parameters 3. Notice no results are returned 4. Click 'Show SQL code' 5. Notice '%' is used for the parameter incorrectly 6. Apply patch and repeat step 2 7. Notice results are returned 8. Click 'Show SQL code' 9. Notice the in() function correctly includes a comma separated list of all authorised values 10. Run the report again with single and multiple selections 11. Confirm the SQL code is generated as expected --- .../prog/en/modules/reports/guided_reports_start.tt | 7 ++----- 1 file changed, 2 insertions(+), 5 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 ed1e0cf7de..c767083d6f 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 %] @@ -1588,10 +1588,7 @@ $('#report_param_form').on('submit', function(e) { $('#report_param_form').find('select[multiple]').each( function (i) { - 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.2