Bugzilla – Attachment 160995 Details for
Bug 35746
Multiple selections for parameters used in the IN function
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35746: add multiselect to reports dropdowns
Bug-35746-add-multiselect-to-reports-dropdowns.patch (text/plain), 4.62 KB, created by
Brendan Lawlor
on 2024-01-12 20:33:39 UTC
(
hide
)
Description:
Bug 35746: add multiselect to reports dropdowns
Filename:
MIME Type:
Creator:
Brendan Lawlor
Created:
2024-01-12 20:33:39 UTC
Size:
4.62 KB
patch
obsolete
>From 599f28332b1101978870193238ed5546449907f4 Mon Sep 17 00:00:00 2001 >From: Brendan Lawlor <blawlor@clamsnet.org> >Date: Fri, 12 Jan 2024 19:55:21 +0000 >Subject: [PATCH] Bug 35746: add multiselect to reports dropdowns > >This is a work in progress patch to add multiselect to report dropdowns. > >Test Plan: >1. Create an SQL report with with new syntax for multi select > SELECT * > FROM branches > WHERE branchcode in (<<Select branches|branches:in>>) >2. Save the report >3. Note that you get the error > The authorized value category (branches:in) you selected does not exist. >4. Apply patch and repeat steps 1 and 2 >5. Note the report saves successfully >6. Run the report >7. Note the select dropdown is now a multiselect >8. Run the report with multiple selections >9. Note that the multiselect choices are in the url like: > guided_reports.pl?reports=2&phase=Run+this+report¶m_name=Select+branches%7Cbranches%3Ain&sql_params=CPL&sql_params=FFL&sql_params=FPL >10. Click show SQL and note that only the first parameter gets inserted intot he query like: >WHERE branchcode in ('CPL') > >TODO: Format the multiselected parameterss as a comma separated list to generate valid SQL like: > WHERE branch in ('CPL', 'FFL', 'FPL') >--- > C4/Reports/Guided.pm | 2 +- > .../prog/en/modules/reports/guided_reports_start.tt | 2 +- > reports/guided_reports.pl | 11 +++++++++-- > 3 files changed, 11 insertions(+), 4 deletions(-) > >diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm >index a55cd17743..1d8b195b3c 100644 >--- a/C4/Reports/Guided.pm >+++ b/C4/Reports/Guided.pm >@@ -974,7 +974,7 @@ sub GetParametersFromSQL { > > for ( my $i = 0; $i < ($#split/2) ; $i++ ) { > my ($name,$authval) = split(/\|/,$split[$i*2+1]); >- $authval =~ s/\:all$// if $authval; >+ $authval =~ s/\:all$|\:in$// if $authval; > push @sql_parameters, { 'name' => $name, 'authval' => $authval }; > } > >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 74d9315a4e..dc187e8acf 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 >@@ -883,7 +883,7 @@ > [% ELSE %] > <li> > <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label> >- <select name="[%- sql_param.input.name | html -%]" tabindex="1" id="[%- sql_param.input.id | html -%]"> >+ <select name="[%- sql_param.input.name | html -%]" tabindex="1" id="[%- sql_param.input.id | html -%]" [%- sql_param.select_multiple | html -%]> > [% IF (sql_param.include_all) %] > <option value="%">All</option> > [% END %] >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index 85b42c4efb..a04489e3ea 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -710,7 +710,14 @@ elsif ($phase eq 'Run this report'){ > if( defined $uniq_params{$text.$sep.$authorised_value_all} ){ > next; > } else { $uniq_params{$text.$sep.$authorised_value_all} = "$i"; } >- my ($authorised_value, $all) = split /:/, $authorised_value_all; >+ my ($authorised_value, $param_options) = split /:/, $authorised_value_all; >+ my $all; >+ my $multiple; >+ if ($param_options eq "all") { >+ $all = "all"; >+ } elsif ($param_options eq "in") { >+ $multiple = "multiple"; >+ } > my $input; > my $labelid; > if ( not defined $authorised_value ) { >@@ -829,7 +836,7 @@ elsif ($phase eq 'Run this report'){ > }; > } > >- push @tmpl_parameters, {'entry' => $text, 'input' => $input, 'labelid' => $labelid, 'name' => $text.$sep.$authorised_value_all, 'include_all' => $all }; >+ push @tmpl_parameters, {'entry' => $text, 'input' => $input, 'labelid' => $labelid, 'name' => $text.$sep.$authorised_value_all, 'include_all' => $all, 'select_multiple' => $multiple}; > } > $template->param('sql' => $sql, > 'name' => $name, >-- >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 35746
:
160880
|
160995
|
161224
|
161247
|
161248
|
162300
|
162303
|
163875
|
163920
|
163921
|
165276
|
165333
|
165334
|
165345
|
165659
|
165660