From 8c084783098e1ba49efd7c158bc598361267c104 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Fri, 13 Mar 2026 14:53:58 +0100 Subject: [PATCH] Bug 42092: Remove space in use of 'qw/' Use syntax 'qw(' instead of 'qw /'. Also use one value per line, makes code reading and versionning easier. This is not enforced by Perl Tidy. Just a syntax change so no test plan. Just run unit tests : t/db_dependent/Koha.t t/Koha/SearchEngine/Elasticsearch/QueryBuilder.t --- C4/Koha.pm | 38 ++++++++--------- .../Elasticsearch/QueryBuilder.pm | 9 +++- cataloguing/z3950_auth_search.pl | 2 +- opac/opac-search.pl | 18 +++++++- tools/inventory.pl | 42 +++++++++++++++---- 5 files changed, 76 insertions(+), 33 deletions(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index 0776ebcbc4..aa147e1f2b 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -343,36 +343,36 @@ sub getFacets { { idx => 'su-to', label => 'Topics', - tags => [qw/ 600ab 601ab 602a 604at 605a 606ax 610a /], + tags => [qw( 600ab 601ab 602a 604at 605a 606ax 610a )], sep => ' - ', }, { idx => 'su-geo', label => 'Places', - tags => [qw/ 607a /], + tags => [qw( 607a )], sep => ' - ', }, { idx => 'au', label => 'Authors', - tags => [qw/ 700ab 701ab 702ab /], + tags => [qw( 700ab 701ab 702ab )], sep => C4::Context->preference("UNIMARCAuthorsFacetsSeparator"), }, { idx => 'se', label => 'Series', - tags => [qw/ 225a /], + tags => [qw( 225a )], sep => ', ', }, { idx => 'location', label => 'Location', - tags => [qw/ 995e /], + tags => [qw( 995e )], }, { idx => 'ccode', label => 'Collections', - tags => [qw / 099t 955h /], + tags => [qw( 099t 955h )], } ]; @@ -386,7 +386,7 @@ sub getFacets { { idx => 'holdingbranch', label => 'Holding libraries', - tags => [qw / 995c /], + tags => [qw( 995c )], } ); } @@ -399,7 +399,7 @@ sub getFacets { { idx => 'homebranch', label => 'Home libraries', - tags => [qw / 995b /], + tags => [qw( 995b )], } ); } @@ -409,55 +409,55 @@ sub getFacets { { idx => 'su-to', label => 'Topics', - tags => [qw/ 650a /], + tags => [qw( 650a )], sep => '--', }, # { # idx => 'su-na', # label => 'People and Organizations', - # tags => [ qw/ 600a 610a 611a / ], + # tags => [qw( 600a 610a 611a )], # sep => 'a', # }, { idx => 'su-geo', label => 'Places', - tags => [qw/ 651a /], + tags => [qw( 651a )], sep => '--', }, { idx => 'su-ut', label => 'Titles', - tags => [qw/ 630a /], + tags => [qw( 630a )], sep => '--', }, { idx => 'au', label => 'Authors', - tags => [qw/ 100a 110a 700a /], + tags => [qw( 100a 110a 700a )], sep => ', ', }, { idx => 'se', label => 'Series', - tags => [qw/ 440a 490a /], + tags => [qw( 440a 490a )], sep => ', ', }, { idx => 'itype', label => 'Item types', - tags => [qw/ 952y 942c /], + tags => [qw( 952y 942c )], sep => ', ', }, { idx => 'location', label => 'Location', - tags => [qw / 952c /], + tags => [qw( 952c )], }, { idx => 'ccode', label => 'Collections', - tags => [qw / 9528 /], + tags => [qw( 9528 )], } ]; @@ -471,7 +471,7 @@ sub getFacets { { idx => 'holdingbranch', label => 'Holding libraries', - tags => [qw / 952b /], + tags => [qw( 952b )], } ); } @@ -484,7 +484,7 @@ sub getFacets { { idx => 'homebranch', label => 'Home libraries', - tags => [qw / 952a /], + tags => [qw( 952a )], } ); } diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index ad339ae7e4..579cc259b4 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -1449,8 +1449,13 @@ sub _is_safe_to_auto_truncate { my $do_not_autotruncate_fields_ref = $cache->get_from_cache( $cache_key, { unsafe => 1 } ); %do_not_autotruncate_fields = %$do_not_autotruncate_fields_ref if $do_not_autotruncate_fields_ref; if ( !scalar( keys %do_not_autotruncate_fields ) ) { - %do_not_autotruncate_fields = - map { $_ => 1 } qw / biblioitemnumber host-item-number itemnumber koha-auth-number local-number /; + %do_not_autotruncate_fields = map { $_ => 1 } qw( + biblioitemnumber + host-item-number + itemnumber + koha-auth-number + local-number + ); # In addition, under no circumstances should non-text fields # be auto truncated. diff --git a/cataloguing/z3950_auth_search.pl b/cataloguing/z3950_auth_search.pl index 2bd0e2fbec..dfe98d3155 100755 --- a/cataloguing/z3950_auth_search.pl +++ b/cataloguing/z3950_auth_search.pl @@ -18,7 +18,7 @@ use Modern::Perl; -use CGI qw / -utf8 /; +use CGI qw( -utf8 ); use C4::Auth qw( get_template_and_user ); use C4::Output qw( output_html_with_http_headers ); diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 2dcb218dc7..cfb51900cb 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -402,10 +402,24 @@ for ( keys %$params ) { # sort by is used to sort the query # in theory can have more than one but generally there's just one my @sort_by; -my @allowed_sortby = - qw /acqdate_asc acqdate_dsc author_az author_za call_number_asc call_number_dsc popularity_asc popularity_dsc pubdate_asc pubdate_dsc relevance title_az title_za/; +my @allowed_sortby = qw( + acqdate_asc + acqdate_dsc + author_az + author_za + call_number_asc + call_number_dsc + popularity_asc + popularity_dsc + pubdate_asc + pubdate_dsc + relevance + title_az + title_za +); @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 { $_ eq $sort } @allowed_sortby ) { $template->param( $sort => 1 ); diff --git a/tools/inventory.pl b/tools/inventory.pl index 99ff1d2b4a..19c0cadc9a 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -440,13 +440,22 @@ if ( defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on' ) my $columns = Koha::Database::Columns->columns; my @translated_keys; for my $key ( - qw / biblio.title biblio.author - items.barcode items.itemnumber - items.homebranch items.location items.ccode - items.itemcallnumber items.enumchron items.notforloan - items.itemlost items.damaged - items.withdrawn items.stocknumber - / + qw( + biblio.title + biblio.author + items.barcode + items.itemnumber + items.homebranch + items.location + items.ccode + items.itemcallnumber + items.enumchron + items.notforloan + items.itemlost + items.damaged + items.withdrawn + items.stocknumber + ) ) { my ( $table, $column ) = split '\.', $key; @@ -457,8 +466,23 @@ if ( defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on' ) $csv->combine(@translated_keys); print $csv->string, "\n"; - my @keys = - qw/ title author barcode itemnumber homebranch location ccode itemcallnumber enumchron notforloan itemlost damaged withdrawn stocknumber /; + my @keys = qw( + title + author + barcode + itemnumber + homebranch + location + ccode + itemcallnumber + enumchron + notforloan + itemlost + damaged + withdrawn + stocknumber + ); + for my $item (@$loop) { my @line; for my $key (@keys) { -- 2.43.0