View | Details | Raw Unified | Return to bug 24367
Collapse All | Expand All

(-)a/C4/Reserves.pm (-1 / +1 lines)
Lines 686-692 sub GetReserveStatus { Link Here
686
        return 'Finished' if $found eq 'F';
686
        return 'Finished' if $found eq 'F';
687
    }
687
    }
688
688
689
    return 'Reserved' if $priority > 0;
689
    return 'Reserved' if defined $priority && $priority > 0;
690
690
691
    return ''; # empty string here will remove need for checking undef, or less log lines
691
    return ''; # empty string here will remove need for checking undef, or less log lines
692
}
692
}
(-)a/C4/Search.pm (-18 / +25 lines)
Lines 624-630 sub getRecords { Link Here
624
        foreach my $f (@facets_loop) {
624
        foreach my $f (@facets_loop) {
625
            $f->{facets} = [ sort { uc($a->{facet_label_value}) cmp uc($b->{facet_label_value}) } @{ $f->{facets} } ];
625
            $f->{facets} = [ sort { uc($a->{facet_label_value}) cmp uc($b->{facet_label_value}) } @{ $f->{facets} } ];
626
        }
626
        }
627
        @facets_loop = sort {$a->{expand} cmp $b->{expand}} @facets_loop;
627
        @facets_loop = sort {defined $a->{expand} && defined $b->{expand} && $a->{expand} cmp $b->{expand}} @facets_loop;
628
    }
628
    }
629
629
630
    return ( undef, $results_hashref, \@facets_loop );
630
    return ( undef, $results_hashref, \@facets_loop );
Lines 1536-1542 sub buildQuery { Link Here
1536
                    $operands[$i] =~ s/\?/{?}/g; # need to escape question marks
1536
                    $operands[$i] =~ s/\?/{?}/g; # need to escape question marks
1537
                }
1537
                }
1538
                my $operand = $operands[$i];
1538
                my $operand = $operands[$i];
1539
                my $index   = $indexes[$i];
1539
                my $index   = $indexes[$i] || 'kw';
1540
1540
1541
                # Add index-specific attributes
1541
                # Add index-specific attributes
1542
1542
Lines 1573-1590 sub buildQuery { Link Here
1573
                        if ( C4::Context->preference("SearchWithISBNVariations") ) {
1573
                        if ( C4::Context->preference("SearchWithISBNVariations") ) {
1574
                            my @isbns = C4::Koha::GetVariationsOfISBN( $operand );
1574
                            my @isbns = C4::Koha::GetVariationsOfISBN( $operand );
1575
                            $operands[$i] = $operand =  '(nb=' . join(' OR nb=', @isbns) . ')';
1575
                            $operands[$i] = $operand =  '(nb=' . join(' OR nb=', @isbns) . ')';
1576
                            $indexes[$i] = $index = '';
1576
                            $indexes[$i] = $index = 'kw';
1577
                        }
1577
                        }
1578
                    }
1578
                    }
1579
                }
1579
                }
1580
1580
1581
                if(not $index){
1582
                    $index = 'kw';
1583
                }
1584
1585
                # Set default structure attribute (word list)
1581
                # Set default structure attribute (word list)
1586
                my $struct_attr = q{};
1582
                my $struct_attr = q{};
1587
                unless ( $indexes_set || !$index || $index =~ /,(st-|phr|ext|wrdl)/ || $index =~ /^(nb|ns)$/ ) {
1583
                unless ( $indexes_set || $index =~ /,(st-|phr|ext|wrdl)/ || $index =~ /^(nb|ns)$/ ) {
1588
                    $struct_attr = ",wrdl";
1584
                    $struct_attr = ",wrdl";
1589
                }
1585
                }
1590
1586
Lines 1750-1755 sub buildQuery { Link Here
1750
    $query =~ s/(?<=(st-numeric)):/=/g;
1746
    $query =~ s/(?<=(st-numeric)):/=/g;
1751
    $query =~ s/(?<=(st-year)):/=/g;
1747
    $query =~ s/(?<=(st-year)):/=/g;
1752
    $query =~ s/(?<=(st-date-normalized)):/=/g;
1748
    $query =~ s/(?<=(st-date-normalized)):/=/g;
1749
1750
    # Removing warnings for later substitutions
1751
    $query      //= q{};
1752
    $query_desc //= q{};
1753
    $query_cgi  //= q{};
1754
    $limit      //= q{};
1755
    $limit_desc //= q{};
1753
    $limit =~ s/:/=/g;
1756
    $limit =~ s/:/=/g;
1754
    for ( $query, $query_desc, $limit, $limit_desc ) {
1757
    for ( $query, $query_desc, $limit, $limit_desc ) {
1755
        s/  +/ /g;    # remove extra spaces
1758
        s/  +/ /g;    # remove extra spaces
Lines 1939-1947 sub searchResults { Link Here
1939
        my $oldbiblio = TransformMarcToKoha( $marcrecord, $fw );
1942
        my $oldbiblio = TransformMarcToKoha( $marcrecord, $fw );
1940
        $oldbiblio->{result_number} = $i + 1;
1943
        $oldbiblio->{result_number} = $i + 1;
1941
1944
1942
        # add imageurl to itemtype if there is one
1943
        $oldbiblio->{imageurl} = getitemtypeimagelocation( $search_context->{'interface'}, $itemtypes{ $oldbiblio->{itemtype} }->{imageurl} );
1944
1945
		$oldbiblio->{normalized_upc}  = GetNormalizedUPC(       $marcrecord,$marcflavour);
1945
		$oldbiblio->{normalized_upc}  = GetNormalizedUPC(       $marcrecord,$marcflavour);
1946
		$oldbiblio->{normalized_ean}  = GetNormalizedEAN(       $marcrecord,$marcflavour);
1946
		$oldbiblio->{normalized_ean}  = GetNormalizedEAN(       $marcrecord,$marcflavour);
1947
		$oldbiblio->{normalized_oclc} = GetNormalizedOCLCNumber($marcrecord,$marcflavour);
1947
		$oldbiblio->{normalized_oclc} = GetNormalizedOCLCNumber($marcrecord,$marcflavour);
Lines 1950-1960 sub searchResults { Link Here
1950
1950
1951
		# edition information, if any
1951
		# edition information, if any
1952
        $oldbiblio->{edition} = $oldbiblio->{editionstatement};
1952
        $oldbiblio->{edition} = $oldbiblio->{editionstatement};
1953
        $oldbiblio->{description} = $itemtypes{ $oldbiblio->{itemtype} }->{translated_description};
1953
1954
 # Build summary if there is one (the summary is defined in the itemtypes table)
1954
        my $itemtype = $oldbiblio->{itemtype} ? $itemtypes{$oldbiblio->{itemtype}} : undef;
1955
        # add imageurl to itemtype if there is one
1956
        $oldbiblio->{imageurl} = $itemtype ? getitemtypeimagelocation( $search_context->{'interface'}, $itemtype->{imageurl} ) : q{};
1957
        # Build summary if there is one (the summary is defined in the itemtypes table)
1958
        $oldbiblio->{description} = $itemtype ? $itemtype->{translated_description} : q{};
1955
1959
1956
        # FIXME: this is only used in the deprecated non-XLST opac results
1960
        # FIXME: this is only used in the deprecated non-XLST opac results
1957
        if ( !$xslfile && $is_opac && $itemtypes{ $oldbiblio->{itemtype} }->{summary} ) {
1961
        if ( !$xslfile && $is_opac && $itemtype && $itemtype->{summary} ) {
1958
            my $summary = $itemtypes{ $oldbiblio->{itemtype} }->{summary};
1962
            my $summary = $itemtypes{ $oldbiblio->{itemtype} }->{summary};
1959
            my @fields  = $marcrecord->fields();
1963
            my @fields  = $marcrecord->fields();
1960
1964
Lines 2096-2102 sub searchResults { Link Here
2096
                $item->{'branchname'} = $branches{$item->{$otherbranch}};
2100
                $item->{'branchname'} = $branches{$item->{$otherbranch}};
2097
            }
2101
            }
2098
2102
2099
			my $prefix = $item->{$hbranch} . '--' . $item->{location} . $item->{itype} . $item->{itemcallnumber};
2103
            my $prefix =
2104
                ( $item->{$hbranch} ? $item->{$hbranch} . '--' : q{} )
2105
              . ( $item->{location} ? $item->{location} : q{} )
2106
              . ( $item->{itype}    ? $item->{itype}    : q{} )
2107
              . ( $item->{itemcallnumber} ? $item->{itemcallnumber} : q{} );
2100
# For each grouping of items (onloan, available, unavailable), we build a key to store relevant info about that item
2108
# For each grouping of items (onloan, available, unavailable), we build a key to store relevant info about that item
2101
            if ( $item->{onloan}
2109
            if ( $item->{onloan}
2102
                and $logged_in_user
2110
                and $logged_in_user
Lines 2171-2177 sub searchResults { Link Here
2171
                    || $item->{damaged}
2179
                    || $item->{damaged}
2172
                    || $item->{notforloan}
2180
                    || $item->{notforloan}
2173
                    || $reservestatus eq 'Waiting'
2181
                    || $reservestatus eq 'Waiting'
2174
                    || ($transfertwhen ne ''))
2182
                    || ($transfertwhen && $transfertwhen ne ''))
2175
                {
2183
                {
2176
                    $withdrawn_count++        if $item->{withdrawn};
2184
                    $withdrawn_count++        if $item->{withdrawn};
2177
                    $itemlost_count++        if $item->{itemlost};
2185
                    $itemlost_count++        if $item->{itemlost};
Lines 2247-2253 sub searchResults { Link Here
2247
2255
2248
        # if biblio level itypes are used and itemtype is notforloan, it can't be reserved either
2256
        # if biblio level itypes are used and itemtype is notforloan, it can't be reserved either
2249
        if (!C4::Context->preference("item-level_itypes")) {
2257
        if (!C4::Context->preference("item-level_itypes")) {
2250
            if ($itemtypes{ $oldbiblio->{itemtype} }->{notforloan}) {
2258
            if ($itemtype && $itemtype->{notforloan}) {
2251
                $can_place_holds = 0;
2259
                $can_place_holds = 0;
2252
            }
2260
            }
2253
        }
2261
        }
2254
- 

Return to bug 24367