Bugzilla – Attachment 88680 Details for
Bug 21460
Filtering ILL requests on borrowernumber does not work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21460: (follow-up) Filter params in .pl
Bug-21460-follow-up-Filter-params-in-pl.patch (text/plain), 2.95 KB, created by
Josef Moravec
on 2019-04-25 05:59:43 UTC
(
hide
)
Description:
Bug 21460: (follow-up) Filter params in .pl
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-04-25 05:59:43 UTC
Size:
2.95 KB
patch
obsolete
>From 6d8e29416cd79691774eada7861ccb17fd9c1eb4 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Tue, 23 Apr 2019 10:18:31 +0100 >Subject: [PATCH] Bug 21460: (follow-up) Filter params in .pl > >This patch filters the passed parameters in the .pl, rather than doing >it in the template. As per comment 16 >(https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21460#c16) > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > ill/ill-requests.pl | 21 ++++++++++++++------- > .../prog/en/modules/ill/ill-requests.tt | 2 +- > 2 files changed, 15 insertions(+), 8 deletions(-) > >diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl >index 45f99c2ca3..57b0692dd4 100755 >--- a/ill/ill-requests.pl >+++ b/ill/ill-requests.pl >@@ -30,6 +30,7 @@ use Koha::Libraries; > use Koha::Token; > > use Try::Tiny; >+use URI::Escape; > > our $cgi = CGI->new; > my $illRequests = Koha::Illrequests->new; >@@ -270,18 +271,24 @@ if ( $backends_available ) { > > # If we receive a pre-filter, make it available to the template > my $possible_filters = ['borrowernumber']; >- my $active_filters = []; >+ my $active_filters = {}; > foreach my $filter(@{$possible_filters}) { > if ($params->{$filter}) { >- push @{$active_filters}, "$filter=$params->{$filter}"; >+ # We shouldn't need to escape $filter here since we're using >+ # a whitelist, but just to be sure... >+ $active_filters->{uri_escape_utf8($filter)} = >+ uri_escape_utf8(scalar $params->{$filter}); > } > } >- if (scalar @{$active_filters} > 0) { >- $template->param( >- prefilters => join(",", @{$active_filters}) >- ); >+ if (keys %{$active_filters}) { >+ my @tpl_arr; >+ foreach my $key (keys %{$active_filters}) { >+ push @tpl_arr, $key . "=" . $active_filters->{$key}; >+ } > } >- >+ $template->param( >+ prefilters => join("&", @tpl_arr) >+ ); > } elsif ( $op eq "save_comment" ) { > die "Wrong CSRF token" unless Koha::Token->new->check_csrf({ > session_id => scalar $cgi->cookie('CGISESSID'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >index ce73bacbbc..8feeccbc65 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >@@ -527,7 +527,7 @@ > [% INCLUDE 'calendar.inc' %] > [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] > <script> >- var prefilters = '[% prefilters | html %]'; >+ var prefilters = '[% prefilters %]'; > // Set column settings > var columns_settings = [% ColumnsSettings.GetColumns( 'illrequests', 'ill-requests', 'ill-requests', 'json' ) %]; > </script> >-- >2.11.0
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 21460
:
82858
|
83119
|
83184
|
83185
|
83272
|
83305
|
83435
|
83674
|
88444
|
88445
|
88626
|
88679
| 88680 |
88681