Bugzilla – Attachment 169987 Details for
Bug 37077
SQL Reports - Picking only one option for each multiple selection results in wrong query
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37077: Fix report muti select for zero and single selections
Bug-37077-Fix-report-muti-select-for-zero-and-sing.patch (text/plain), 3.48 KB, created by
Marcel de Rooy
on 2024-08-02 07:23:09 UTC
(
hide
)
Description:
Bug 37077: Fix report muti select for zero and single selections
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-08-02 07:23:09 UTC
Size:
3.48 KB
patch
obsolete
>From 4b172f6da63f0afd092af1f7d6e28012b2ae62a4 Mon Sep 17 00:00:00 2001 >From: Brendan Lawlor <blawlor@clamsnet.org> >Date: Fri, 14 Jun 2024 19:11:56 +0000 >Subject: [PATCH] Bug 37077: Fix report muti select for zero and single > selections >Content-Type: text/plain; charset=utf-8 > >This patch updates the javascript overriding the form submission when reports have multi select parameters. > >When there are more than one multi selects, and the user selcts one value from each, it skips updating the value of the select, so it doens't send duplicate parameters anymore. > >If there are no selections made it will pass '%' for all values. This allows the multi select to be optional in the report. If no selections are made it is assumed that you are not using that parameter to limit the report. > >Test plan: >1. Go to Reports and create a report from SQL > select * > from items > where > homebranch in <<Libraries|branches:in>> > and > itype in <<Item type|itemtypes:in>> >3. Run the report but pick only 1 library and 1 item type >4. Click the "Show SQL code" >5. Notice that the two parameters were filled correctly >6. Run the report again with zero selections >7. Click the "Show SQL code" >8. Notice that the '%' is used for the parameter >9. Run the report again with combinations of single, multiple and zero selections >10. confirm the SQL code is generated as you would expect. > >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../prog/en/modules/reports/guided_reports_start.tt | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 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 e1db08685a..9dd38ba53b 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 >@@ -877,7 +877,7 @@ > <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label> > [% IF (sql_param.select_multiple) %] > <select name="[%- sql_param.input.name | html -%]" tabindex="1" id="[%- sql_param.input.id | html -%]" multiple> >- <option value="null" hidden></option> >+ <option value="%" hidden></option> > [% ELSE %] > <select name="[%- sql_param.input.name | html -%]" tabindex="1" id="[%- sql_param.input.id | html -%]"> > [% END %] >@@ -1584,8 +1584,13 @@ > > $('#report_param_form').on('submit', function(e) { > $('#report_param_form').find('select[multiple]').each( function (i) { >- var $selected = $('option:first', this).val(); >- $(this).val($selected); >+ if( $(this).find('option:selected').length === 0 ) { >+ $(this).val(['%']); >+ } >+ else if( $(this).find('option:selected').length > 1 ) { >+ var $selected = $('option:first', this).val(); >+ $(this).val($selected); >+ } > }); > }); > } >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37077
:
167762
|
167763
|
167765
|
167785
| 169987