Bug 25136: Make PatronSelfRegistrationLibraryList only effect new registration
authorLucas Gass <lucas@bywatersolutions.com>
Wed, 15 Apr 2020 22:46:23 +0000 (22:46 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 16 Apr 2020 18:26:14 +0000 (19:26 +0100)
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>

opac/opac-memberentry.pl

index e954587..0524158 100755 (executable)
@@ -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 ) {