Bugzilla – Attachment 90825 Details for
Bug 23166
Simplify code related to orders in catalogue/*detail.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23084: Replace grep {^$var$} with grep {$_ eq $var}
Bug-23084-Replace-grep-var-with-grep--eq-var.patch (text/plain), 37.12 KB, created by
Jonathan Druart
on 2019-06-20 02:36:53 UTC
(
hide
)
Description:
Bug 23084: Replace grep {^$var$} with grep {$_ eq $var}
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-06-20 02:36:53 UTC
Size:
37.12 KB
patch
obsolete
>From 24f041ea66fa8f38b0a54050bf0264d096090220 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 19 Jun 2019 20:54:40 -0500 >Subject: [PATCH] Bug 23084: Replace grep {^$var$} with grep {$_ eq $var} > >We certainly faced 3 similar bugs due to this syntax: bug 23006, bug >22941 and bug 17526. > >To prevent other issues related to this syntax this patch suggests to >replace them all in one go. > >Test plan: >Confirm that the 2 syntaxes are similar >Eyeball the patch and confirm that there is no typo! > >https://bugs.koha-community.org/show_bug.cgi?id=23166 >--- > C4/Acquisition.pm | 8 ++++---- > C4/ImportBatch.pm | 2 +- > C4/Installer/PerlModules.pm | 2 +- > C4/Items.pm | 8 ++++---- > C4/Members/Statistics.pm | 2 +- > C4/OAI/Sets.pm | 4 ++-- > C4/Overdues.pm | 2 +- > C4/Search.pm | 6 +++--- > C4/Serials.pm | 2 +- > C4/Stats.pm | 2 +- > C4/Tags.pm | 6 +++--- > C4/Utils/DataTables/Members.pm | 2 +- > Koha/Object.pm | 6 +++--- > Koha/Objects.pm | 2 +- > acqui/duplicate_orders.pl | 4 ++-- > admin/preferences.pl | 2 +- > admin/searchengine/elasticsearch/mappings.pl | 4 ++-- > catalogue/ISBDdetail.pl | 4 ++-- > catalogue/MARCdetail.pl | 4 ++-- > catalogue/detail.pl | 4 ++-- > catalogue/imageviewer.pl | 4 ++-- > catalogue/itemsearch.pl | 2 +- > catalogue/labeledMARCdetail.pl | 4 ++-- > catalogue/moredetail.pl | 4 ++-- > circ/circulation.pl | 2 +- > clubs/templates-add-modify.pl | 4 ++-- > misc/cronjobs/gather_print_notices.pl | 2 +- > misc/cronjobs/longoverdue.pl | 8 ++++---- > misc/migration_tools/rebuild_zebra.pl | 4 ++-- > misc/translator/LangInstaller.pm | 2 +- > opac/opac-detail.pl | 2 +- > opac/opac-memberentry.pl | 2 +- > opac/opac-reserve.pl | 2 +- > opac/opac-search-history.pl | 2 +- > opac/opac-search.pl | 2 +- > opac/opac-shelves.pl | 2 +- > reports/borrowers_stats.pl | 8 ++++---- > tools/export.pl | 2 +- > tools/letter.pl | 2 +- > tools/modborrowers.pl | 4 ++-- > virtualshelves/shelves.pl | 4 ++-- > 41 files changed, 72 insertions(+), 72 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 38bb24186b..d366a17c6c 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1347,7 +1347,7 @@ sub ModOrder { > foreach my $orderinfokey (grep(!/ordernumber/, keys %$orderinfo)){ > # ... and skip hash entries that are not in the aqorders table > # FIXME : probably not the best way to do it (would be better to have a correct hash) >- next unless grep(/^$orderinfokey$/, @$colnames); >+ next unless grep { $_ eq $orderinfokey } @$colnames; > $query .= "$orderinfokey=?, "; > push(@params, $orderinfo->{$orderinfokey}); > } >@@ -2682,7 +2682,7 @@ sub GetInvoices { > > if($args{order_by}) { > my ($column, $direction) = split / /, $args{order_by}; >- if(grep /^$column$/, @columns) { >+ if(grep { $_ eq $column } @columns) { > $direction ||= 'ASC'; > $query .= " ORDER BY $column $direction"; > } >@@ -2806,7 +2806,7 @@ sub AddInvoice { > my @set_strs; > my @set_args; > foreach my $key (keys %invoice) { >- if(0 < grep(/^$key$/, @columns)) { >+ if(0 < grep { $_ eq $key } @columns) { > push @set_strs, "$key = ?"; > push @set_args, ($invoice{$key} || undef); > } >@@ -2856,7 +2856,7 @@ sub ModInvoice { > my @set_strs; > my @set_args; > foreach my $key (keys %invoice) { >- if(0 < grep(/^$key$/, @columns)) { >+ if(0 < grep { $_ eq $key } @columns) { > push @set_strs, "$key = ?"; > push @set_args, ($invoice{$key} || undef); > } >diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm >index bb3393cbc2..17e2d80c71 100644 >--- a/C4/ImportBatch.pm >+++ b/C4/ImportBatch.pm >@@ -1114,7 +1114,7 @@ sub GetImportRecordsRange { > my $dbh = C4::Context->dbh; > > my $order_by = $parameters->{order_by} || 'import_record_id'; >- ( $order_by ) = grep( /^$order_by$/, qw( import_record_id title status overlay_status ) ) ? $order_by : 'import_record_id'; >+ ( $order_by ) = grep( { $_ eq $order_by } qw( import_record_id title status overlay_status ) ) ? $order_by : 'import_record_id'; > > my $order_by_direction = > uc( $parameters->{order_by_direction} // 'ASC' ) eq 'DESC' ? 'DESC' : 'ASC'; >diff --git a/C4/Installer/PerlModules.pm b/C4/Installer/PerlModules.pm >index affcd78365..b5cdc9dfd7 100644 >--- a/C4/Installer/PerlModules.pm >+++ b/C4/Installer/PerlModules.pm >@@ -76,7 +76,7 @@ sub version_info { > no warnings > ; # perl throws warns for invalid $VERSION numbers which some modules use > my ( $self, $module ) = @_; >- return -1 unless grep { /^$module$/ } keys(%$PERL_DEPS); >+ return -1 unless grep { $_ eq $module } keys(%$PERL_DEPS); > > $Readonly::XS::MAGIC_COOKIE="Do NOT use or require Readonly::XS unless you're me."; > eval "require $module"; >diff --git a/C4/Items.pm b/C4/Items.pm >index 15b61f0005..d2833b3d36 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -2101,11 +2101,11 @@ sub _SearchItems_build_where_fragment { > push @columns, Koha::Database->new()->schema()->resultset('Biblioitem')->result_source->columns; > my @operators = qw(= != > < >= <= like); > my $field = $filter->{field}; >- if ( (0 < grep /^$field$/, @columns) or (substr($field, 0, 5) eq 'marc:') ) { >+ if ( (0 < grep { $_ eq $field } @columns) or (substr($field, 0, 5) eq 'marc:') ) { > my $op = $filter->{operator}; > my $query = $filter->{query}; > >- if (!$op or (0 == grep /^$op$/, @operators)) { >+ if (!$op or (0 == grep { $_ eq $op } @operators)) { > $op = '='; # default operator > } > >@@ -2601,8 +2601,8 @@ sub ToggleNewStatus { > |; > for my $condition ( @$conditions ) { > if ( >- grep {/^$condition->{field}$/} @item_columns >- or grep {/^$condition->{field}$/} @biblioitem_columns >+ grep { $_ eq $condition->{field} } @item_columns >+ or grep { $_ eq $condition->{field} } @biblioitem_columns > ) { > if ( $condition->{value} =~ /\|/ ) { > my @values = split /\|/, $condition->{value}; >diff --git a/C4/Members/Statistics.pm b/C4/Members/Statistics.pm >index 23771c16d4..4f640bad20 100644 >--- a/C4/Members/Statistics.pm >+++ b/C4/Members/Statistics.pm >@@ -59,7 +59,7 @@ sub get_fields { > my @columns = $schema->source('Item')->columns; > > foreach my $fn ( @spfields ) { >- push ( @ret, $fn ) if ( grep(/^$fn$/, @columns) ); >+ push ( @ret, $fn ) if ( grep { $_ eq $fn } @columns ); > } > $ret = join( '|', @ret); > } >diff --git a/C4/OAI/Sets.pm b/C4/OAI/Sets.pm >index 62c98d8801..585837e55e 100644 >--- a/C4/OAI/Sets.pm >+++ b/C4/OAI/Sets.pm >@@ -500,13 +500,13 @@ sub CalcOAISetsBiblio { > my $value = $mapping->{'marcvalue'}; > my @subfield_values = $record->subfield($field, $subfield); > if ($operator eq 'notequal') { >- if(0 == grep /^$value$/, @subfield_values) { >+ if(0 == grep { $_ eq $value } @subfield_values) { > push @biblio_sets, $set_id; > last; > } > } > else { >- if(0 < grep /^$value$/, @subfield_values) { >+ if(0 < grep { $_ eq $value } @subfield_values) { > push @biblio_sets, $set_id; > last; > } >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 78ec2e57fa..c57c43ce2e 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -766,7 +766,7 @@ sub GetOverdueMessageTransportTypes { > # Put 'print' in first if exists > # It avoid to sent a print notice with an email or sms template is no email or sms is defined > @mtts = uniq( 'print', @mtts ) >- if grep {/^print$/} @mtts; >+ if grep { $_ eq 'print' } @mtts; > > return \@mtts; > } >diff --git a/C4/Search.pm b/C4/Search.pm >index 4191cbc2de..9381e6bfbd 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -731,7 +731,7 @@ sub _get_facets_data_from_record { > > my $data = $field->as_string( $subfield_letters, $facet->{ sep } ); > >- unless ( grep { /^\Q$data\E$/ } @used_datas ) { >+ unless ( grep { $_ eq $data } @used_datas ) { > push @used_datas, $data; > $facets_counter->{ $facet->{ idx } }->{ $data }++; > } >@@ -1490,12 +1490,12 @@ sub buildQuery { > # this happens when selecting a subject on the opac-detail page > @limits = grep {!/^$/} @limits; > my $original_q = $q; # without available part >- unless ( grep { /^available$/ } @limits ) { >+ unless ( grep { $_ eq 'available' } @limits ) { > $q =~ s| and \( \( allrecords,AlwaysMatches:'' not onloan,AlwaysMatches:''\) and \(lost,st-numeric=0\) \)||; > $original_q = $q; > } > if ( @limits ) { >- if ( grep { /^available$/ } @limits ) { >+ if ( grep { $_ eq 'available' } @limits ) { > $q .= q| and ( ( allrecords,AlwaysMatches:'' not onloan,AlwaysMatches:'') and (lost,st-numeric=0) )|; > delete $limits['available']; > } >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 44c3cb958e..a2df9eb7dc 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -1579,7 +1579,7 @@ sub NewIssue { > ### Would use substr and index But be careful to previous presence of () > $recievedlist .= "; $serialseq" unless ( index( $recievedlist, $serialseq ) > 0 ); > } >- if ( grep { /^$status$/ } (MISSING_STATUSES) ) { >+ if ( grep { $_ eq $status } (MISSING_STATUSES) ) { > $missinglist .= "; $serialseq" unless ( index( $missinglist, $serialseq ) > 0 ); > } > >diff --git a/C4/Stats.pm b/C4/Stats.pm >index 8a8835c346..effcc0376c 100644 >--- a/C4/Stats.pm >+++ b/C4/Stats.pm >@@ -108,7 +108,7 @@ sub UpdateStats { > } > my @invalid_params = (); > for my $myparam (keys %$params ) { >- push @invalid_params, $myparam unless grep (/^$myparam$/, @allowed_keys); >+ push @invalid_params, $myparam unless grep { $_ eq $myparam } @allowed_keys; > } > if (scalar @invalid_params > 0 ) { > croak ("UpdateStats received invalid param(s): ".join (", ",@invalid_params )); >diff --git a/C4/Tags.pm b/C4/Tags.pm >index 1db7accc06..a337a7ac20 100644 >--- a/C4/Tags.pm >+++ b/C4/Tags.pm >@@ -192,7 +192,7 @@ sub get_tag_rows { > carp "Empty argument key to get_tag_rows: ignoring!"; > next; > } >- unless (1 == scalar grep {/^ $key $/x} @ok_fields) { >+ unless (1 == scalar grep { $_ eq $key } @ok_fields) { > carp "get_tag_rows received unreconized argument key '$key'."; > next; > } >@@ -233,7 +233,7 @@ sub get_tags { # i.e., from tags_index > carp "Empty argument key to get_tags: ignoring!"; > next; > } >- unless (1 == scalar grep {/^ $key $/x} @ok_fields) { >+ unless (1 == scalar grep { $_ eq $key } @ok_fields) { > carp "get_tags received unreconized argument key '$key'."; > next; > } >@@ -302,7 +302,7 @@ sub get_approval_rows { # i.e., from tags_approval > carp "Empty argument key to get_approval_rows: ignoring!"; > next; > } >- unless (1 == scalar grep {/^ $key $/x} @ok_fields) { >+ unless (1 == scalar grep { $_ eq $key } @ok_fields) { > carp "get_approval_rows received unreconized argument key '$key'."; > next; > } >diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm >index 9fb539e4f1..4504bd3047 100644 >--- a/C4/Utils/DataTables/Members.pm >+++ b/C4/Utils/DataTables/Members.pm >@@ -38,7 +38,7 @@ sub search { > # Do that after iTotalQuery! > if ( defined $branchcode and $branchcode ) { > @restricted_branchcodes = @restricted_branchcodes >- ? grep { /^$branchcode$/ } @restricted_branchcodes >+ ? grep { $_ eq $branchcode } @restricted_branchcodes > ? ($branchcode) > : (undef) # Do not return any results > : ($branchcode); >diff --git a/Koha/Object.pm b/Koha/Object.pm >index 1c382f26d3..9b197a6bd9 100644 >--- a/Koha/Object.pm >+++ b/Koha/Object.pm >@@ -236,7 +236,7 @@ sub set { > my @columns = @{$self->_columns()}; > > foreach my $p ( keys %$properties ) { >- unless ( grep {/^$p$/} @columns ) { >+ unless ( grep { $_ eq $p } @columns ) { > Koha::Exceptions::Object::PropertyNotFound->throw( "No property $p for " . ref($self) ); > } > } >@@ -442,7 +442,7 @@ sub AUTOLOAD { > > my @columns = @{$self->_columns()}; > # Using direct setter/getter like $item->barcode() or $item->barcode($barcode); >- if ( grep {/^$method$/} @columns ) { >+ if ( grep { $_ eq $method } @columns ) { > if ( @_ ) { > $self->_result()->set_column( $method, @_ ); > return $self; >@@ -457,7 +457,7 @@ sub AUTOLOAD { > Koha::Exceptions::Object::MethodNotCoveredByTests->throw( > error => sprintf("The method %s->%s is not covered by tests!", ref($self), $method), > show_trace => 1 >- ) unless grep { /^$method$/ } @known_methods; >+ ) unless grep { $_ eq $method } @known_methods; > > > my $r = eval { $self->_result->$method(@_) }; >diff --git a/Koha/Objects.pm b/Koha/Objects.pm >index da43003c88..08dd2ccf18 100644 >--- a/Koha/Objects.pm >+++ b/Koha/Objects.pm >@@ -384,7 +384,7 @@ sub AUTOLOAD { > $method =~ s/.*:://; > > >- unless ( grep { /^$method$/ } @known_methods ) { >+ unless ( grep { $_ eq $method } @known_methods ) { > my $class = ref($self) ? ref($self) : $self; > Koha::Exceptions::Object::MethodNotCoveredByTests->throw( > error => sprintf("The method %s->%s is not covered by tests!", $class, $method), >diff --git a/acqui/duplicate_orders.pl b/acqui/duplicate_orders.pl >index 549c8b495a..c528305efc 100755 >--- a/acqui/duplicate_orders.pl >+++ b/acqui/duplicate_orders.pl >@@ -86,7 +86,7 @@ my @ordernumbers = split ',', scalar $input->param('ordernumbers') || ''; > if ( $op eq 'select' ) { > @result_order_loop = map { > my $order = $_; >- ( grep { /^$order->{ordernumber}$/ } @ordernumbers ) ? () : $order >+ ( grep {$_ eq $order->{ordernumber}} @ordernumbers ) ? () : $order > } @{ C4::Acquisition::GetHistory(%$filters) }; > > @selected_order_loop = >@@ -132,7 +132,7 @@ elsif ( $op eq 'do_duplicate' ) { > for my $field ( > qw(currency budget_id order_internalnote order_vendornote sort1 sort2 )) > { >- next if grep { /^$field$/ } @fields_to_copy; >+ next if grep { $_ eq $field } @fields_to_copy; > $default_values->{$field} = $input->param("all_$field"); > } > >diff --git a/admin/preferences.pl b/admin/preferences.pl >index 92c5bbee72..5a422f58c3 100755 >--- a/admin/preferences.pl >+++ b/admin/preferences.pl >@@ -117,7 +117,7 @@ sub _get_chunk { > { > text => $options{multiple}->{$option_value}, > value => $option_value, >- selected => (grep /^$option_value$/, @values) ? 1 : 0, >+ selected => (grep { $_ eq $option_value } @values) ? 1 : 0, > } > } > keys %{ $options{multiple} } >diff --git a/admin/searchengine/elasticsearch/mappings.pl b/admin/searchengine/elasticsearch/mappings.pl >index f91399aa9d..2eecf9c3ca 100755 >--- a/admin/searchengine/elasticsearch/mappings.pl >+++ b/admin/searchengine/elasticsearch/mappings.pl >@@ -124,7 +124,7 @@ if ( $op eq 'edit' ) { > my $mapping_suggestible = $mapping_suggestible[$i]; > my $mapping_sort = $mapping_sort[$i]; > $mapping_sort = undef if $mapping_sort eq 'undef'; >- $mapping_facet = ( grep {/^$search_field_name$/} @facetable_field_names ) ? $mapping_facet : 0; >+ $mapping_facet = ( grep { $_ eq $search_field_name } @facetable_field_names ) ? $mapping_facet : 0; > > my $search_field = Koha::SearchFields->find({ name => $search_field_name }, { key => 'name' }); > # TODO Check mapping format >@@ -200,7 +200,7 @@ for my $index_name (@index_names) { > sort => $s->get_column('sort') // 'undef', # To avoid warnings "Use of uninitialized value in lc" > suggestible => $s->get_column('suggestible'), > facet => $s->get_column('facet'), >- is_facetable => ( grep {/^$name$/} @facetable_field_names ) ? 1 : 0, >+ is_facetable => ( grep { $_ eq $name } @facetable_field_names ) ? 1 : 0, > }; > } > >diff --git a/catalogue/ISBDdetail.pl b/catalogue/ISBDdetail.pl >index 81995a7dc0..79a173f1f9 100755 >--- a/catalogue/ISBDdetail.pl >+++ b/catalogue/ISBDdetail.pl >@@ -152,13 +152,13 @@ foreach my $myorder (@allorders_using_biblio) { > my $basket = $myorder->{'basketno'}; > if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){ > push @deletedorders_using_biblio, $myorder; >- unless (grep(/^$basket$/, @baskets_deletedorders)){ >+ unless (grep{ $_ eq $basket } @baskets_deletedorders){ > push @baskets_deletedorders,$myorder->{'basketno'}; > } > } > else { > push @orders_using_biblio, $myorder; >- unless (grep(/^$basket$/, @baskets_orders)){ >+ unless (grep{ $_ eq $basket } @baskets_orders){ > push @baskets_orders,$myorder->{'basketno'}; > } > } >diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl >index 2a93c2bb6c..b01c8ac4e6 100755 >--- a/catalogue/MARCdetail.pl >+++ b/catalogue/MARCdetail.pl >@@ -328,13 +328,13 @@ foreach my $myorder (@allorders_using_biblio) { > my $basket = $myorder->{'basketno'}; > if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){ > push @deletedorders_using_biblio, $myorder; >- unless (grep(/^$basket$/, @baskets_deletedorders)){ >+ unless (grep{ $_ eq $basket } @baskets_deletedorders){ > push @baskets_deletedorders,$myorder->{'basketno'}; > } > } > else { > push @orders_using_biblio, $myorder; >- unless (grep(/^$basket$/, @baskets_orders)){ >+ unless (grep { $_ eq $basket } @baskets_orders){ > push @baskets_orders,$myorder->{'basketno'}; > } > } >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 027ca5253a..b5f95a7350 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -522,13 +522,13 @@ foreach my $myorder (@allorders_using_biblio) { > my $basket = $myorder->{'basketno'}; > if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){ > push @deletedorders_using_biblio, $myorder; >- unless (grep(/^$basket$/, @baskets_deletedorders)){ >+ unless (grep{ $_ eq $basket } @baskets_deletedorders){ > push @baskets_deletedorders,$myorder->{'basketno'}; > } > } > else { > push @orders_using_biblio, $myorder; >- unless (grep(/^$basket$/, @baskets_orders)){ >+ unless (grep{ $_ eq $basket } @baskets_orders){ > push @baskets_orders,$myorder->{'basketno'}; > } > } >diff --git a/catalogue/imageviewer.pl b/catalogue/imageviewer.pl >index 009b82ecf1..1716c0f3ea 100755 >--- a/catalogue/imageviewer.pl >+++ b/catalogue/imageviewer.pl >@@ -89,13 +89,13 @@ foreach my $myorder (@allorders_using_biblio) { > my $basket = $myorder->{'basketno'}; > if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){ > push @deletedorders_using_biblio, $myorder; >- unless (grep(/^$basket$/, @baskets_deletedorders)){ >+ unless (grep{ $_ eq $basket } @baskets_deletedorders){ > push @baskets_deletedorders,$myorder->{'basketno'}; > } > } > else { > push @orders_using_biblio, $myorder; >- unless (grep(/^$basket$/, @baskets_orders)){ >+ unless (grep{ $_ eq $basket } @baskets_orders){ > push @baskets_orders,$myorder->{'basketno'}; > } > } >diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl >index 36e22b67f5..0f7cbdc92e 100755 >--- a/catalogue/itemsearch.pl >+++ b/catalogue/itemsearch.pl >@@ -63,7 +63,7 @@ if (defined $format and $format eq 'json') { > push @f, $columns[$i]; > push @c, 'and'; > >- if ( grep /^$columns[$i]$/, qw( ccode homebranch holdingbranch location itype notforloan itemlost ) ) { >+ if ( grep { $_ eq $columns[$i] } qw( ccode homebranch holdingbranch location itype notforloan itemlost ) ) { > push @q, "$word"; > push @op, '='; > } else { >diff --git a/catalogue/labeledMARCdetail.pl b/catalogue/labeledMARCdetail.pl >index 7c3b77bc9a..65c9ac280f 100755 >--- a/catalogue/labeledMARCdetail.pl >+++ b/catalogue/labeledMARCdetail.pl >@@ -135,13 +135,13 @@ foreach my $myorder (@allorders_using_biblio) { > my $basket = $myorder->{'basketno'}; > if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){ > push @deletedorders_using_biblio, $myorder; >- unless (grep(/^$basket$/, @baskets_deletedorders)){ >+ unless (grep { $_ eq $basket } @baskets_deletedorders){ > push @baskets_deletedorders,$myorder->{'basketno'}; > } > } > else { > push @orders_using_biblio, $myorder; >- unless (grep(/^$basket$/, @baskets_orders)){ >+ unless (grep{ $_ eq $basket } @baskets_orders){ > push @baskets_orders,$myorder->{'basketno'}; > } > } >diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl >index e8736ff398..b9520c0419 100755 >--- a/catalogue/moredetail.pl >+++ b/catalogue/moredetail.pl >@@ -235,13 +235,13 @@ foreach my $myorder (@allorders_using_biblio) { > my $basket = $myorder->{'basketno'}; > if ((defined $myorder->{'datecancellationprinted'}) and ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){ > push @deletedorders_using_biblio, $myorder; >- unless (grep(/^$basket$/, @baskets_deletedorders)){ >+ unless (grep{ $_ eq $basket } @baskets_deletedorders){ > push @baskets_deletedorders,$myorder->{'basketno'}; > } > } > else { > push @orders_using_biblio, $myorder; >- unless (grep(/^$basket$/, @baskets_orders)){ >+ unless (grep { $_ eq $basket } @baskets_orders){ > push @baskets_orders,$myorder->{'basketno'}; > } > } >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 72a38465ad..da25f229fa 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -126,7 +126,7 @@ if ( $batch && C4::Context->preference('BatchCheckouts') ) { > $template_name = q|circ/circulation_batch_checkouts.tt|; > my @batch_category_codes = split '\|', C4::Context->preference('BatchCheckoutsValidCategories'); > my $categorycode = $patron->categorycode; >- if ( $categorycode && grep {/^$categorycode$/} @batch_category_codes ) { >+ if ( $categorycode && grep { $_ eq $categorycode } @batch_category_codes ) { > $batch_allowed = 1; > } else { > $barcodes = []; >diff --git a/clubs/templates-add-modify.pl b/clubs/templates-add-modify.pl >index 254a99e219..11f4606fb9 100755 >--- a/clubs/templates-add-modify.pl >+++ b/clubs/templates-add-modify.pl >@@ -92,7 +92,7 @@ if ( $cgi->param('name') ) { # Update or create club > ? Koha::Club::Template::Fields->find($field_id) > : Koha::Club::Template::Field->new(); > >- if ( grep( /^$field_id$/, @field_delete ) ) { >+ if ( grep { $_ eq $field_id } @field_delete ) { > $field->delete(); > } > else { >@@ -126,7 +126,7 @@ if ( $cgi->param('name') ) { # Update or create club > ? Koha::Club::Template::EnrollmentFields->find($field_id) > : Koha::Club::Template::EnrollmentField->new(); > >- if ( grep( /^$field_id$/, @field_delete ) ) { >+ if ( grep { $_ eq $field_id } @field_delete ) { > $field->delete(); > } > else { >diff --git a/misc/cronjobs/gather_print_notices.pl b/misc/cronjobs/gather_print_notices.pl >index 6b64a76f90..51ef7cd352 100755 >--- a/misc/cronjobs/gather_print_notices.pl >+++ b/misc/cronjobs/gather_print_notices.pl >@@ -91,7 +91,7 @@ my @all_messages = @{ GetPrintMessages() }; > @all_messages = map { > my $letter_code = $_->{letter_code}; > ( >- grep { /^$letter_code$/ } @letter_codes >+ grep { $_ eq $letter_code } @letter_codes > ) ? $_ : () > } @all_messages if @letter_codes; > exit unless @all_messages; >diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl >index 754cb62698..17961f98f2 100755 >--- a/misc/cronjobs/longoverdue.pl >+++ b/misc/cronjobs/longoverdue.pl >@@ -301,7 +301,7 @@ $borrower_category = [ map { uc $_ } @$borrower_category ]; > $skip_borrower_category = [ map { uc $_} @$skip_borrower_category ]; > my %category_to_process; > for my $cat ( @$borrower_category ) { >- unless ( grep { /^$cat$/ } @available_categories ) { >+ unless ( grep { $_ eq $cat } @available_categories ) { > pod2usage( > '-exitval' => 1, > '-message' => "The category $cat does not exist in the database", >@@ -311,7 +311,7 @@ for my $cat ( @$borrower_category ) { > } > if ( @$skip_borrower_category ) { > for my $cat ( @$skip_borrower_category ) { >- unless ( grep { /^$cat$/ } @available_categories ) { >+ unless ( grep { $_ eq $cat } @available_categories ) { > pod2usage( > '-exitval' => 1, > '-message' => "The category $cat does not exist in the database", >@@ -329,7 +329,7 @@ $itemtype = [ map { uc $_ } @$itemtype ]; > $skip_itemtype = [ map { uc $_} @$skip_itemtype ]; > my %itemtype_to_process; > for my $it ( @$itemtype ) { >- unless ( grep { /^$it$/ } @available_itemtypes ) { >+ unless ( grep { $_ eq $it } @available_itemtypes ) { > pod2usage( > '-exitval' => 1, > '-message' => "The itemtype $it does not exist in the database", >@@ -339,7 +339,7 @@ for my $it ( @$itemtype ) { > } > if ( @$skip_itemtype ) { > for my $it ( @$skip_itemtype ) { >- unless ( grep { /^$it$/ } @available_itemtypes ) { >+ unless ( grep { $_ eq $it } @available_itemtypes ) { > pod2usage( > '-exitval' => 1, > '-message' => "The itemtype $it does not exist in the database", >diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl >index 65ccff51b6..a881575772 100755 >--- a/misc/migration_tools/rebuild_zebra.pl >+++ b/misc/migration_tools/rebuild_zebra.pl >@@ -146,7 +146,7 @@ if (not $biblios and not $authorities) { > } > > our @tables_allowed_for_select = ( 'biblioitems', 'items', 'biblio', 'biblio_metadata' ); >-unless ( grep { /^$table$/ } @tables_allowed_for_select ) { >+unless ( grep { $_ eq $table } @tables_allowed_for_select ) { > die "Cannot specify -t|--table with value '$table'. Only " > . ( join ', ', @tables_allowed_for_select ) > . " are allowed."; >@@ -476,7 +476,7 @@ sub select_all_authorities { > > sub select_all_biblios { > $table = 'biblioitems' >- unless grep { /^$table$/ } @tables_allowed_for_select; >+ unless grep { $_ eq $table } @tables_allowed_for_select; > my $strsth = qq{ SELECT DISTINCT biblionumber FROM $table }; > $strsth.=qq{ WHERE $where } if ($where); > $strsth.=qq{ LIMIT $length } if ($length && !$offset); >diff --git a/misc/translator/LangInstaller.pm b/misc/translator/LangInstaller.pm >index 55003af92e..2918933b35 100644 >--- a/misc/translator/LangInstaller.pm >+++ b/misc/translator/LangInstaller.pm >@@ -634,7 +634,7 @@ sub extract_messages { > next if $entry =~ /^\./; > my $relentry = File::Spec->catfile($dir, $entry); > my $abspath = File::Spec->catfile($basedir, $relentry); >- if (-d $abspath and not grep /^$relentry$/, @blacklist) { >+ if (-d $abspath and not grep { $_ eq $relentry } @blacklist) { > push @directories_to_scan, $relentry; > } elsif (-f $abspath and $relentry =~ /\.(pl|pm)$/) { > push @files_to_scan, $relentry; >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index c859771590..eff70707bf 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -720,7 +720,7 @@ if ( not $viewallitems and @items > $max_items_to_display ) { > > if ( C4::Context->preference('OPACAcquisitionDetails') ) { > $itm->{on_order} = 1 >- if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order; >+ if grep { $_ eq $itm->{itemnumber} } @itemnumbers_on_order; > } > > my $itembranch = $itm->{$separatebranch}; >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index 7fc9226c29..ac880ea5eb 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -77,7 +77,7 @@ 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( /^$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 ) { >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 472d0f5519..7df7727d59 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -78,7 +78,7 @@ unless ( $can_place_hold_if_available_at_pickup ) { > my @patron_categories = split '\|', C4::Context->preference('OPACHoldsIfAvailableAtPickupExceptions'); > if ( @patron_categories ) { > my $categorycode = $patron->categorycode; >- $can_place_hold_if_available_at_pickup = grep /^$categorycode$/, @patron_categories; >+ $can_place_hold_if_available_at_pickup = grep { $_ eq $categorycode } @patron_categories; > } > } > >diff --git a/opac/opac-search-history.pl b/opac/opac-search-history.pl >index 3ae4aadd2b..b058949984 100755 >--- a/opac/opac-search-history.pl >+++ b/opac/opac-search-history.pl >@@ -70,7 +70,7 @@ unless ( $loggedinuser ) { > @searches = map { $_->{type} ne $type ? $_ : () } @searches; > } > if ( @id ) { >- @searches = map { my $search = $_; ( grep {/^$search->{id}$/} @id ) ? () : $_ } @searches; >+ @searches = map { my $search = $_; ( grep { $_ eq $search->{id} } @id ) ? () : $_ } @searches; > } > } > C4::Search::History::set_to_session({ cgi => $cgi, search_history => \@searches }); >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index c39ad59b68..21f9020549 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -431,7 +431,7 @@ my @allowed_sortby = qw /acqdate_asc acqdate_dsc author_az author_za call_number > @sort_by = $cgi->multi_param('sort_by'); > $sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by); > foreach my $sort (@sort_by) { >- if ( grep { /^$sort$/ } @allowed_sortby ) { >+ if ( grep { $_ eq $sort } @allowed_sortby ) { > $template->param($sort => 1); > } > } >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index cca12f2bb2..69ca764723 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -114,7 +114,7 @@ if ( $op eq 'add_form' ) { > if ( $shelf ) { > $op = $referer; > my $sortfield = $query->param('sortfield'); >- $sortfield = 'title' unless grep {/^$sortfield$/}qw( title author copyrightdate itemcallnumber dateadded ); >+ $sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded ); > if ( $shelf->can_be_managed( $loggedinuser ) ) { > $shelf->shelfname( scalar $query->param('shelfname') ); > $shelf->sortfield( $sortfield ); >diff --git a/reports/borrowers_stats.pl b/reports/borrowers_stats.pl >index 73c655cb6e..27782c5920 100755 >--- a/reports/borrowers_stats.pl >+++ b/reports/borrowers_stats.pl >@@ -162,17 +162,17 @@ sub calculate { > my $attribute_type = $1; > return unless (grep {$attribute_type eq $_->{code}} @attribute_types); > } else { >- return unless (grep /^$line$/, @valid_names); >+ return unless (grep { $_ eq $line } @valid_names); > } > if ($column =~ /^patron_attr\.(.*)/) { > my $attribute_type = $1; > return unless (grep {$attribute_type eq $_->{code}} @attribute_types); > } else { >- return unless (grep /^$column$/, @valid_names); >+ return unless (grep { $_ eq $column } @valid_names); > } > return if ($digits and $digits !~ /^\d+$/); >- return if ($status and (grep /^$status$/, qw(debarred gonenoaddress lost)) == 0); >- return if ($activity and (grep /^$activity$/, qw(active nonactive)) == 0); >+ return if ($status and (grep { $_ eq $status } qw(debarred gonenoaddress lost)) == 0); >+ return if ($activity and (grep { $_ eq $activity } qw(active nonactive)) == 0); > > # Filters > my $linefilter; >diff --git a/tools/export.pl b/tools/export.pl >index 0704b57d6d..e2d75d377f 100755 >--- a/tools/export.pl >+++ b/tools/export.pl >@@ -75,7 +75,7 @@ if ( $op eq 'export' ) { > if ( $filename ) { > my $mimetype = $query->uploadInfo($filename)->{'Content-Type'}; > my @valid_mimetypes = qw( application/octet-stream text/csv text/plain application/vnd.ms-excel ); >- unless ( grep { /^$mimetype$/ } @valid_mimetypes ) { >+ unless ( grep { $_ eq $mimetype } @valid_mimetypes ) { > push @messages, { type => 'alert', code => 'invalid_mimetype' }; > $op = ''; > } >diff --git a/tools/letter.pl b/tools/letter.pl >index f1a234bf40..4ab17be785 100755 >--- a/tools/letter.pl >+++ b/tools/letter.pl >@@ -263,7 +263,7 @@ sub add_form { > my $preview_is_available = 0; > > if ($code) { >- $preview_is_available = grep {/^$code$/} qw( CHECKIN CHECKOUT HOLD_SLIP ); >+ $preview_is_available = grep {$_ eq $code } qw( CHECKIN CHECKOUT HOLD_SLIP ); > } > > $template->param( >diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl >index fb672a631d..88419e404d 100755 >--- a/tools/modborrowers.pl >+++ b/tools/modborrowers.pl >@@ -278,7 +278,7 @@ if ( $op eq 'do' ) { > for my $field ( qw/surname firstname branchcode categorycode city state zipcode country sort1 sort2 dateenrolled dateexpiry borrowernotes opacnote/ ) { > my $value = $input->param($field); > $infos->{$field} = $value if $value; >- $infos->{$field} = "" if grep { /^$field$/ } @disabled; >+ $infos->{$field} = "" if grep { $_ eq $field } @disabled; > } > > for my $field ( qw( dateenrolled dateexpiry ) ) { >@@ -313,7 +313,7 @@ if ( $op eq 'do' ) { > # If this borrower is not in the category of this attribute, we don't want to modify this attribute > ++$i and next if $attr_type->{category_code} and $attr_type->{category_code} ne $borrower_categorycode; > my $valuename = "attr" . $i . "_value"; >- if ( grep { /^$valuename$/ } @disabled ) { >+ if ( grep { $_ eq $valuename } @disabled ) { > # The attribute is disabled, we remove it for this borrower ! > eval { > C4::Members::Attributes::DeleteBorrowerAttribute( $borrowernumber, $attribute ); >diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl >index 5fddf374a4..adacddeb1c 100755 >--- a/virtualshelves/shelves.pl >+++ b/virtualshelves/shelves.pl >@@ -102,7 +102,7 @@ if ( $op eq 'add_form' ) { > if ( $shelf ) { > $op = $referer; > my $sortfield = $query->param('sortfield'); >- $sortfield = 'title' unless grep {/^$sortfield$/}qw( title author copyrightdate itemcallnumber dateadded ); >+ $sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded ); > if ( $shelf->can_be_managed( $loggedinuser ) ) { > $shelf->shelfname( scalar $query->param('shelfname') ); > $shelf->sortfield( $sortfield ); >@@ -234,7 +234,7 @@ if ( $op eq 'view' ) { > if ( $shelf ) { > if ( $shelf->can_be_viewed( $loggedinuser ) ) { > my $sortfield = $query->param('sortfield') || $shelf->sortfield || 'title'; # Passed in sorting overrides default sorting >- $sortfield = 'title' unless grep $_ eq $sortfield, qw( title author copyrightdate itemcallnumber dateadded ); >+ $sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded ); > my $direction = $query->param('direction') || 'asc'; > $direction = 'asc' if $direction ne 'asc' and $direction ne 'desc'; > my ( $rows, $page ); >-- >2.11.0
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 23166
:
90824
|
90825
|
90826
|
90827
|
90828
|
104365
|
104366
|
104367
|
104368
|
104369
|
104370
|
108991
|
108992
|
108993
|
108994
|
108995
|
108996
|
108997
|
108998
|
108999
|
109000
|
109001
|
109002
|
109019
|
109020
|
109021
|
109022
|
109023
|
109024
|
109025
|
109026
|
109037
|
109038
|
109039
|
109040
|
109041
|
109042
|
109043
|
109044
|
109045
|
109046
|
109047
|
109048
|
109049
|
109050
|
109058
|
109059