Bug 12600: remove duplicate use statement from code
[srvgit] / C4 / Search.pm
index c94d924..c704c63 100644 (file)
@@ -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 { /^\Q$data\E$/ } @used_datas ) {
                                         push @used_datas, $data;
                                         $facets_counter->{ $facet->{idx} }->{$data}++;
                                     }
@@ -1868,6 +1868,7 @@ sub searchResults {
         my $item_in_transit_count = 0;
         my $can_place_holds       = 0;
         my $item_onhold_count     = 0;
+        my $notforloan_count      = 0;
         my $items_count           = scalar(@fields);
         my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults');
         my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1;
@@ -1938,6 +1939,8 @@ sub searchResults {
                 # item is on order
                 if ( $item->{notforloan} < 0 ) {
                     $ordered_count++;
+                } elsif ( $item->{notforloan} > 0 ) {
+                    $notforloan_count++;
                 }
 
                 # is item in transit?
@@ -2044,13 +2047,12 @@ sub searchResults {
         }
 
         # XSLT processing of some stuff
-       use C4::Charset;
-       SetUTF8Flag($marcrecord);
+        SetUTF8Flag($marcrecord);
         warn $marcrecord->as_formatted if $DEBUG;
-       my $interface = $search_context eq 'opac' ? 'OPAC' : '';
-       if (!$scan && C4::Context->preference($interface . "XSLTResultsDisplay")) {
+        my $interface = $search_context eq 'opac' ? 'OPAC' : '';
+        if (!$scan && C4::Context->preference($interface . "XSLTResultsDisplay")) {
             $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $interface."XSLTResultsDisplay", 1, \@hiddenitems);
-           # the last parameter tells Koha to clean up the problematic ampersand entities that Zebra outputs
+        # the last parameter tells Koha to clean up the problematic ampersand entities that Zebra outputs
         }
 
         # if biblio level itypes are used and itemtype is notforloan, it can't be reserved either
@@ -2077,6 +2079,7 @@ sub searchResults {
         $oldbiblio->{intransitcount}       = $item_in_transit_count;
         $oldbiblio->{onholdcount}          = $item_onhold_count;
         $oldbiblio->{orderedcount}         = $ordered_count;
+        $oldbiblio->{notforloancount}      = $notforloan_count;
 
         if (C4::Context->preference("AlternateHoldingsField") && $items_count == 0) {
             my $fieldspec = C4::Context->preference("AlternateHoldingsField");