Bugzilla – Attachment 29519 Details for
Bug 12151
remove remaining uses of the Perl smartmatch operator
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 12151: Remove uses of smartmatch operator in Search.pm and opac-search.pl
PASSED-QA-Bug-12151-Remove-uses-of-smartmatch-oper.patch (text/plain), 2.36 KB, created by
Katrin Fischer
on 2014-07-06 17:39:14 UTC
(
hide
)
Description:
[PASSED QA] Bug 12151: Remove uses of smartmatch operator in Search.pm and opac-search.pl
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2014-07-06 17:39:14 UTC
Size:
2.36 KB
patch
obsolete
>From c27fd810efe1d48374636cf46d8754742eeae0a9 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Fri, 30 May 2014 20:54:10 -0300 >Subject: [PATCH] [PASSED QA] Bug 12151: Remove uses of smartmatch operator in > Search.pm and opac-search.pl > >This patch removes the use of smartmatch operators in the search code. > >Regards >To+ > >Edit: this revision uses 'grep' instead of Lists::MoreUtils::any > >Sponsored-by: Universidad Nacional de Cordoba > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >Passes all tests and QA script. >Tested search, no problems found. >--- > C4/Search.pm | 2 +- > opac/opac-search.pl | 15 ++++++--------- > 2 files changed, 7 insertions(+), 10 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index 86f2c59..1b5c6fa 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -532,7 +532,7 @@ sub getRecords { > foreach my $field (@fields) { > my $data = $field->as_string( $subfield_letters, $facet->{sep} ); > >- unless ( $data ~~ @used_datas ) { >+ unless ( grep { /^$data$/ } @used_datas ) { > push @used_datas, $data; > $facets_counter->{ $facet->{idx} }->{$data}++; > } >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 990cbd0..cc6beb7 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -30,15 +30,12 @@ use Modern::Perl; > use C4::Context; > > my $searchengine = C4::Context->preference("SearchEngine"); >-for ( $searchengine ) { >- when ( /^Solr$/ ) { >- warn "We use Solr"; >- require 'opac/search.pl'; >- exit; >- } >- when ( /^Zebra$/ ) { >+if ( $searchengine =~ /^Solr$/ ) { >+ warn "We use Solr"; >+ require 'opac/search.pl'; >+ exit; >+} elsif ( $searchengine =~ /^Zebra$/ ) { > >- } > } > > use C4::Output; >@@ -360,7 +357,7 @@ my @allowed_sortby = qw /acqdate_asc acqdate_dsc author_az author_za call_number > @sort_by = $cgi->param('sort_by'); > $sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by); > foreach my $sort (@sort_by) { >- if ( $sort ~~ @allowed_sortby ) { >+ if ( grep { /^$sort$/ } @allowed_sortby ) { > $template->param($sort => 1); > } > } >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12151
:
28580
|
28581
|
28615
|
28616
|
29013
|
29014
|
29015
|
29016
|
29487
|
29488
|
29489
|
29490
| 29519 |
29520
|
29521
|
29522
|
29523