From ed7b4b174afb28bbfac2f37dbcff549df8d2b68f Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Tue, 14 Apr 2020 12:00:01 +0200
Subject: [PATCH] Bug 25137: (bug 23084 follow-up) Fix incorrect grep ternary
condition
The lack of parenthesis makes the condition evaluated wrong.
Test plan:
- confirm you have a branch with code X
- enter X in PatronSelfRegistrationLibraryList
- go to cgi-bin/koha/opac-memberentry.pl (either as a logged in patron or as a self-reg patron)
- confirm branch dropdown is not empty and contain X
- empty out PatronSelfRegistrationLibraryList
- reload cgi-bin/koha/opac-memberentry.pl and confirm branches show
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
---
opac/opac-memberentry.pl | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl
index 3f6d8a8735..e954587d81 100755
--- a/opac/opac-memberentry.pl
+++ b/opac/opac-memberentry.pl
@@ -76,7 +76,11 @@ 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;
+ @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.17.1