@@ -, +, @@ used --- opac/opac-memberentry.pl | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) --- a/opac/opac-memberentry.pl +++ a/opac/opac-memberentry.pl @@ -76,15 +76,18 @@ if ( $action eq q{} ) { my $mandatory = GetMandatoryFields($action); my @libraries = Koha::Libraries->search; -if ( $action eq 'new' - && ( my @libraries_to_display = split '\|', C4::Context->preference('PatronSelfRegistrationLibraryList') ) -) { - @libraries = map { - my $b = $_; - my $branchcode = $_->branchcode; - ( grep { $_ eq $branchcode } @libraries_to_display ) ? $b : () - } @libraries; +if ( $action eq 'create' || $action eq 'new' ) { + my @PatronSelfRegistrationLibraryList = split '\|', C4::Context->preference('PatronSelfRegistrationLibraryList'); + if (@PatronSelfRegistrationLibraryList) { + @libraries = map { + my $l = $_; + ( grep { $l->branchcode eq $_ } @PatronSelfRegistrationLibraryList ) + ? $l + : () + } @libraries; + } } + my ( $min, $max ) = C4::Members::get_cardnumber_length(); if ( defined $min ) { $template->param( @@ -159,6 +162,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 ( --