From 15e46b6842e3526d622c7785c8e2b7746793954d Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 9 May 2023 13:51:59 +0000 Subject: [PATCH] Bug 33277: (follow-up) Don't use regex, tidy Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 09c92afd25f3fd58a159b0252dd73172e8fea1a3) Signed-off-by: Matt Blenkinsop --- C4/Heading.pm | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/C4/Heading.pm b/C4/Heading.pm index b408622038..ca77c02262 100644 --- a/C4/Heading.pm +++ b/C4/Heading.pm @@ -22,7 +22,7 @@ use Modern::Perl; use MARC::Field; use C4::Context; use Module::Load qw( load ); - +use List::Util qw( none ); =head1 NAME @@ -239,15 +239,24 @@ sub _search { my ( $matched_auths, $total ) = $searcher->search_auth_compat( $search_query, 0, 20, $skipmetadata ); # Some auth records may not contain the 040$f to specify their source # This is legal, so we do a fallback search - if( !$total && $thesaurus && !( grep /$thesaurus/,('lcsh','lcac','mesh','nal','notspecified','cash','rvm','sears','aat') ) ){ + if ( + !$total + && $thesaurus + && none { $_ eq $thesaurus } ( + 'lcsh', 'lcac', 'mesh', 'nal', + 'notspecified', 'cash', 'rvm', 'sears', + 'aat' + ) + ) + { pop @value; push @value, 'notdefined'; - $search_query = $builder->build_authorities_query_compat( - \@marclist, \@and_or, \@excluding, \@operator, - \@value, $self->{'auth_type'}, - 'AuthidAsc' - ); - ( $matched_auths, $total ) = $searcher->search_auth_compat( $search_query, 0, 20, $skipmetadata ); + $search_query = + $builder->build_authorities_query_compat( \@marclist, \@and_or, + \@excluding, \@operator, \@value, $self->{'auth_type'}, + 'AuthidAsc' ); + ( $matched_auths, $total ) = + $searcher->search_auth_compat( $search_query, 0, 20, $skipmetadata ); } return ( $matched_auths, $total ); -- 2.39.5