X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=C4%2FSearch.pm;h=9bc0af2842abf02238435d2bc79e2ad04d158af5;hb=5531904dccd9d8a0c4c6eb68278213f011cdbf3c;hp=05a860c3229262b277ef2a55f8d03b70d709389c;hpb=aed0d8a63d5005e1c343def9a8ccbd9403ccd4aa;p=koha.git diff --git a/C4/Search.pm b/C4/Search.pm index 05a860c322..9bc0af2842 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -71,6 +71,7 @@ This module provides searching functions for Koha's bibliographic databases &AddSearchHistory &GetDistinctValues &enabled_staff_search_views + &SimpleSearch ); # make all your functions, whether exported or not; @@ -1296,7 +1297,7 @@ sub buildQuery { warn "QUERY BEFORE LIMITS: >$query<" if $DEBUG; # add limits - my $group_OR_limits; + my %group_OR_limits; my $availability_limit; foreach my $this_limit (@limits) { if ( $this_limit =~ /available/ ) { @@ -1313,17 +1314,16 @@ sub buildQuery { # group_OR_limits, prefixed by mc- # OR every member of the group elsif ( $this_limit =~ /mc/ ) { - - if ( $this_limit =~ /mc-ccode:/ ) { + my ($k,$v) = split(/:/, $this_limit,2); + if ( $k !~ /mc-i(tem)?type/ ) { # in case the mc-ccode value has complicating chars like ()'s inside it we wrap in quotes $this_limit =~ tr/"//d; - my ($k,$v) = split(/:/, $this_limit,2); $this_limit = $k.":\"".$v."\""; } - $group_OR_limits .= " or " if $group_OR_limits; - $limit_desc .= " or " if $group_OR_limits; - $group_OR_limits .= "$this_limit"; + $group_OR_limits{$k} .= " or " if $group_OR_limits{$k}; + $limit_desc .= " or " if $group_OR_limits{$k}; + $group_OR_limits{$k} .= "$this_limit"; $limit_cgi .= "&limit=$this_limit"; $limit_desc .= " $this_limit"; } @@ -1346,9 +1346,9 @@ sub buildQuery { } } } - if ($group_OR_limits) { + foreach my $k (keys (%group_OR_limits)) { $limit .= " and " if ( $query || $limit ); - $limit .= "($group_OR_limits)"; + $limit .= "($group_OR_limits{$k})"; } if ($availability_limit) { $limit .= " and " if ( $query || $limit ); @@ -1620,6 +1620,7 @@ sub searchResults { foreach my $code ( keys %subfieldstosearch ) { $item->{$code} = $field->subfield( $subfieldstosearch{$code} ); } + $item->{description} = $itemtypes{ $item->{itype} }{description}; # Hidden items if ($is_opac) { @@ -1650,6 +1651,7 @@ sub searchResults { $onloan_items->{$key}->{branchname} = $item->{branchname}; $onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} }; $onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber}; + $onloan_items->{$key}->{description} = $item->{description}; $onloan_items->{$key}->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} ); # if something's checked out and lost, mark it as 'long overdue' if ( $item->{itemlost} ) { @@ -1734,6 +1736,7 @@ sub searchResults { $other_items->{$key}->{notforloan} = GetAuthorisedValueDesc('','',$item->{notforloan},'','',$notforloan_authorised_value) if $notforloan_authorised_value; $other_items->{$key}->{count}++ if $item->{$hbranch}; $other_items->{$key}->{location} = $shelflocations->{ $item->{location} }; + $other_items->{$key}->{description} = $item->{description}; $other_items->{$key}->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} ); } # item is available @@ -1741,7 +1744,7 @@ sub searchResults { $can_place_holds = 1; $available_count++; $available_items->{$prefix}->{count}++ if $item->{$hbranch}; - foreach (qw(branchname itemcallnumber hideatopac)) { + foreach (qw(branchname itemcallnumber hideatopac description)) { $available_items->{$prefix}->{$_} = $item->{$_}; } $available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} };