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(
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 (