From 055da6586b9453f8937e17b5b4a278860949bdbf Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sat, 23 Apr 2016 16:37:26 +0100 Subject: [PATCH] Bug 16274: Limit the patron self registration to some libraries Currently a patron can select a home library in the list of all libraries defined in the system. However some of these libraries might not accept self registration. This patch adds a new pref to display only the allowed libraries. Test plan: 0/ Apply the patch, do not fill the new pref 1/ Self register a new patron => All the libraries defined should be displayed in the "Home library" dropwdown list 2/ Fill the pref PatronSelfRegistrationLibraryList with some of the branchcode defined in the system => Self register a new patron and confirm that the dropdown list has been filtered. Sponsored-by: BULAC - http://www.bulac.fr/ --- opac/opac-memberentry.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 321d47c..dc84df0 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -63,12 +63,17 @@ if ( $action eq q{} ) { my $mandatory = GetMandatoryFields($action); +my $branches = GetBranchesLoop(); +if ( my @libraries_to_display = split '\|', C4::Context->preference('PatronSelfRegistrationLibraryList') ) { + $branches = [ map { my $b = $_; grep( /^$b->{branchcode}$/, @libraries_to_display ) ? $b : () } @$branches ]; +} + $template->param( action => $action, hidden => GetHiddenFields( $mandatory, 'registration' ), mandatory => $mandatory, member_titles => GetTitles() || undef, - branches => GetBranchesLoop(), + branches => $branches, OPACPatronDetails => C4::Context->preference('OPACPatronDetails'), ); -- 2.7.0