Bugzilla – Attachment 97096 Details for
Bug 24367
With strict enabled, Search.t is too verbose
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24367: Remove warning from Search.t
Bug-24367-Remove-warning-from-Searcht.patch (text/plain), 6.39 KB, created by
Jonathan Druart
on 2020-01-09 14:54:03 UTC
(
hide
)
Description:
Bug 24367: Remove warning from Search.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-01-09 14:54:03 UTC
Size:
6.39 KB
patch
obsolete
>From a467b983e03b2687a141672f3986ab6de2c0fbac Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 7 Jan 2020 16:53:50 +0100 >Subject: [PATCH] Bug 24367: Remove warning from Search.t > >Not done yet. >--- > C4/Reserves.pm | 2 +- > C4/Search.pm | 42 +++++++++++++++++++++++++----------------- > 2 files changed, 26 insertions(+), 18 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 503771e914..e1f89212b6 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -686,7 +686,7 @@ sub GetReserveStatus { > return 'Finished' if $found eq 'F'; > } > >- return 'Reserved' if $priority > 0; >+ return 'Reserved' if defined $priority && $priority > 0; > > return ''; # empty string here will remove need for checking undef, or less log lines > } >diff --git a/C4/Search.pm b/C4/Search.pm >index 5d68165574..77bda3064f 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -624,7 +624,7 @@ sub getRecords { > foreach my $f (@facets_loop) { > $f->{facets} = [ sort { uc($a->{facet_label_value}) cmp uc($b->{facet_label_value}) } @{ $f->{facets} } ]; > } >- @facets_loop = sort {$a->{expand} cmp $b->{expand}} @facets_loop; >+ @facets_loop = sort {defined $a->{expand} && defined $b->{expand} && $a->{expand} cmp $b->{expand}} @facets_loop; > } > > return ( undef, $results_hashref, \@facets_loop ); >@@ -1536,7 +1536,7 @@ sub buildQuery { > $operands[$i] =~ s/\?/{?}/g; # need to escape question marks > } > my $operand = $operands[$i]; >- my $index = $indexes[$i]; >+ my $index = $indexes[$i] || 'kw'; > > # Add index-specific attributes > >@@ -1573,18 +1573,14 @@ sub buildQuery { > if ( C4::Context->preference("SearchWithISBNVariations") ) { > my @isbns = C4::Koha::GetVariationsOfISBN( $operand ); > $operands[$i] = $operand = '(nb=' . join(' OR nb=', @isbns) . ')'; >- $indexes[$i] = $index = ''; >+ $indexes[$i] = $index = 'kw'; > } > } > } > >- if(not $index){ >- $index = 'kw'; >- } >- > # Set default structure attribute (word list) > my $struct_attr = q{}; >- unless ( $indexes_set || !$index || $index =~ /,(st-|phr|ext|wrdl)/ || $index =~ /^(nb|ns)$/ ) { >+ unless ( $indexes_set || $index =~ /,(st-|phr|ext|wrdl)/ || $index =~ /^(nb|ns)$/ ) { > $struct_attr = ",wrdl"; > } > >@@ -1750,6 +1746,13 @@ sub buildQuery { > $query =~ s/(?<=(st-numeric)):/=/g; > $query =~ s/(?<=(st-year)):/=/g; > $query =~ s/(?<=(st-date-normalized)):/=/g; >+ >+ # Removing warnings for later substitutions >+ $query //= q{}; >+ $query_desc //= q{}; >+ $query_cgi //= q{}; >+ $limit //= q{}; >+ $limit_desc //= q{}; > $limit =~ s/:/=/g; > for ( $query, $query_desc, $limit, $limit_desc ) { > s/ +/ /g; # remove extra spaces >@@ -1939,9 +1942,6 @@ sub searchResults { > my $oldbiblio = TransformMarcToKoha( $marcrecord, $fw ); > $oldbiblio->{result_number} = $i + 1; > >- # add imageurl to itemtype if there is one >- $oldbiblio->{imageurl} = getitemtypeimagelocation( $search_context->{'interface'}, $itemtypes{ $oldbiblio->{itemtype} }->{imageurl} ); >- > $oldbiblio->{normalized_upc} = GetNormalizedUPC( $marcrecord,$marcflavour); > $oldbiblio->{normalized_ean} = GetNormalizedEAN( $marcrecord,$marcflavour); > $oldbiblio->{normalized_oclc} = GetNormalizedOCLCNumber($marcrecord,$marcflavour); >@@ -1950,11 +1950,15 @@ sub searchResults { > > # edition information, if any > $oldbiblio->{edition} = $oldbiblio->{editionstatement}; >- $oldbiblio->{description} = $itemtypes{ $oldbiblio->{itemtype} }->{translated_description}; >- # Build summary if there is one (the summary is defined in the itemtypes table) >+ >+ my $itemtype = $oldbiblio->{itemtype} ? $itemtypes{$oldbiblio->{itemtype}} : undef; >+ # add imageurl to itemtype if there is one >+ $oldbiblio->{imageurl} = $itemtype ? getitemtypeimagelocation( $search_context->{'interface'}, $itemtype->{imageurl} ) : q{}; >+ # Build summary if there is one (the summary is defined in the itemtypes table) >+ $oldbiblio->{description} = $itemtype ? $itemtype->{translated_description} : q{}; > > # FIXME: this is only used in the deprecated non-XLST opac results >- if ( !$xslfile && $is_opac && $itemtypes{ $oldbiblio->{itemtype} }->{summary} ) { >+ if ( !$xslfile && $is_opac && $itemtype && $itemtype->{summary} ) { > my $summary = $itemtypes{ $oldbiblio->{itemtype} }->{summary}; > my @fields = $marcrecord->fields(); > >@@ -2096,7 +2100,11 @@ sub searchResults { > $item->{'branchname'} = $branches{$item->{$otherbranch}}; > } > >- my $prefix = $item->{$hbranch} . '--' . $item->{location} . $item->{itype} . $item->{itemcallnumber}; >+ my $prefix = >+ ( $item->{$hbranch} ? $item->{$hbranch} . '--' : q{} ) >+ . ( $item->{location} ? $item->{location} : q{} ) >+ . ( $item->{itype} ? $item->{itype} : q{} ) >+ . ( $item->{itemcallnumber} ? $item->{itemcallnumber} : q{} ); > # For each grouping of items (onloan, available, unavailable), we build a key to store relevant info about that item > if ( $item->{onloan} > and $logged_in_user >@@ -2171,7 +2179,7 @@ sub searchResults { > || $item->{damaged} > || $item->{notforloan} > || $reservestatus eq 'Waiting' >- || ($transfertwhen ne '')) >+ || ($transfertwhen && $transfertwhen ne '')) > { > $withdrawn_count++ if $item->{withdrawn}; > $itemlost_count++ if $item->{itemlost}; >@@ -2247,7 +2255,7 @@ sub searchResults { > > # if biblio level itypes are used and itemtype is notforloan, it can't be reserved either > if (!C4::Context->preference("item-level_itypes")) { >- if ($itemtypes{ $oldbiblio->{itemtype} }->{notforloan}) { >+ if ($itemtype && $itemtype->{notforloan}) { > $can_place_holds = 0; > } > } >-- >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 24367
:
96911
| 97096 |
97097
|
97157
|
97158
|
97159
|
97163
|
99113