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/
Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Home library:</label>
<select id="borrower_branchcode" name="borrower_branchcode">
- [% PROCESS options_for_libraries libraries => Branches.all( selected => borrower.branchcode ) %]
+ [% FOREACH l IN libraries %]
+ [% IF l.branchcode == borrower.branchcode %]
+ <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname %]</option>
+ [% ELSE %]
+ <option value="[% l.branchcode | html %]">[% l.branchname %]</option>
+ [% END %]
+ [% END %]
</select>
</li>
[% END %]
use C4::Scrubber;
use Email::Valid;
use Koha::DateUtils;
+use Koha::Libraries;
use Koha::Patron::Images;
use Koha::Token;
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;
+}
+
$template->param(
action => $action,
hidden => GetHiddenFields( $mandatory, 'registration' ),
mandatory => $mandatory,
+ libraries => \@libraries,
OPACPatronDetails => C4::Context->preference('OPACPatronDetails'),
);