From 6811f66f2835665f489100c8b58b7453ae10d611 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Thu, 16 Apr 2020 11:51:32 +0200
Subject: [PATCH] Bug 25136: join the 2 ifs

Highlight that we only need this for action="new"

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
---
 opac/opac-memberentry.pl | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl
index 05241589b6..f657b127a4 100755
--- a/opac/opac-memberentry.pl
+++ b/opac/opac-memberentry.pl
@@ -75,14 +75,14 @@ if ( $action eq q{} ) {
 my $mandatory = GetMandatoryFields($action);
 
 my @libraries = Koha::Libraries->search;
-if ( my @libraries_to_display = split '\|', C4::Context->preference('PatronSelfRegistrationLibraryList') ) {
-    if ( $action eq 'new' ) {
-        @libraries = map {
-            my $b          = $_;
-            my $branchcode = $_->branchcode;
-            ( grep { $_ eq $branchcode } @libraries_to_display ) ? $b : ()
-        } @libraries;
-    }
+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;
 }
 my ( $min, $max ) = C4::Members::get_cardnumber_length();
 if ( defined $min ) {
-- 
2.20.1