Bug 25136: Make PatronSelfRegistrationLibraryList only effect new registration

This patch makes it so PatronSelfRegistrationLibraryList will only effect the registration from and not the modification form.
TO TEST:
1. Turn on self reg and add some libaries to PatronSelfRegistrationLibraryList.
2. Notice that the libaries that display in the borrower_branchcode dropdown are the ones you selected on both the new registration from and the modification form.
3. Apply patch.
4. Now only the new registration from should show libaries on PatronSelfRegistrationLibraryList.
5. The modifciation dropdown should still show all libraries.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Lucas Gass 2020-04-15 22:46:23 +00:00 committed by Martin Renvoize
parent 429c57d8d6
commit dbf604e141
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -76,11 +76,13 @@ 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 { $_ eq $branchcode } @libraries_to_display ) ? $b : ()
} @libraries;
if ( $action eq 'new' ) {
@libraries = map {
my $b = $_;
my $branchcode = $_->branchcode;
( grep { $_ eq $branchcode } @libraries_to_display ) ? $b : ()
} @libraries;
}
}
my ( $min, $max ) = C4::Members::get_cardnumber_length();
if ( defined $min ) {