Bugzilla – Attachment 117020 Details for
Bug 27604
PatronSelfRegistrationLibraryList can be bypassed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27604: [19.11] Make sure PatronSelfRegistrationLibraryList is used
Bug-27604-1911-Make-sure-PatronSelfRegistrationLib.patch (text/plain), 2.71 KB, created by
Jonathan Druart
on 2021-02-19 07:37:34 UTC
(
hide
)
Description:
Bug 27604: [19.11] Make sure PatronSelfRegistrationLibraryList is used
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-02-19 07:37:34 UTC
Size:
2.71 KB
patch
obsolete
>From 77817f1ec8489fa1339a0c223368753bc06e6cbd Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 3 Feb 2021 16:14:12 +0100 >Subject: [PATCH] Bug 27604: [19.11] Make sure > PatronSelfRegistrationLibraryList is used > >The value of PatronSelfRegistrationLibraryList is used to display the dropdown >list of the libraries, but not after the form is submitted. > >Test plan: >1. Empty PatronSelfRegistrationLibraryList >2. Self register a new patron >=> Confirm the dropdown list with the libraries contain all the >libraries >3. Fill in PatronSelfRegistrationLibraryList with branchcodes (eg. "CPL|MPL") >4. Self register a new patron >5. Edit the HTML form and replace the option's value with another >branchcode (FPL) >6. Save >=> Without this patch the branchcode FPL is used >=> With this patch applied an ugly 500 is returned > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> > >https://bugs.koha-community.org/show_bug.cgi?id=11983 > >Bug 27604: (QA follow-up) Limit the libraries during the query > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> > >https://bugs.koha-community.org/show_bug.cgi?id=11983 > >Bug 27604: Init to {} > >Bug 27604: Deal with empty pref >--- > opac/opac-memberentry.pl | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index 8d541a456c..1af3d47b27 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -75,10 +75,14 @@ if ( $action eq q{} ) { > > my $mandatory = GetMandatoryFields($action); > >-my @libraries = Koha::Libraries->search; >-if ( my @libraries_to_display = split '\|', C4::Context->preference('PatronSelfRegistrationLibraryList') ) { >- @libraries = map { my $b = $_; my $branchcode = $_->branchcode; grep( /^$branchcode$/, @libraries_to_display ) ? $b : () } @libraries; >+my $params = {}; >+if ( $action eq 'create' || $action eq 'new' ) { >+ my @PatronSelfRegistrationLibraryList = split '\|', C4::Context->preference('PatronSelfRegistrationLibraryList'); >+ $params = { branchcode => { -in => \@PatronSelfRegistrationLibraryList } } >+ if @PatronSelfRegistrationLibraryList; > } >+my @libraries = Koha::Libraries->search($params); >+ > my ( $min, $max ) = C4::Members::get_cardnumber_length(); > if ( defined $min ) { > $template->param( >@@ -148,6 +152,8 @@ if ( $action eq 'create' ) { > borrower => \%borrower > ); > $template->param( patron_attribute_classes => GeneratePatronAttributesForm( undef, $attributes ) ); >+ } elsif ( ! grep { $borrower{branchcode} eq $_->branchcode } @libraries ) { >+ die "Branchcode not allowed"; # They hack the form > } > else { > if ( >-- >2.20.1
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 27604
:
116271
|
116286
|
116424
|
116425
|
116497
|
116907
| 117020