From 00249f3c621e0a19fa86e0b1bb8d9694b7996ceb Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 31 Jan 2013 11:20:13 +1100 Subject: [PATCH] Bug 9516 - Item Availability/Data missing from OPAC tag search Currently, an OPAC search using the "tag" and "q" query strings will have results with no item data. Next to "Availability", it will say "No items available:" (N.B. without reference to why the items are unavailable, like Checked out, In transit, etc.). The reason is that the opac-search.pl script is just pulling the marc blob straight from the database without embedding any item data. I've used the GetMarcBiblio sub with the embed item data option, and then converted the resulting Marc object to us marc using the "as_usmarc" method. --- To test: (Before patch) 1) Click on Tag cloud 2) Click on any of the tags 3) Note that all results say "Availability: No items available:" 4) Click on any result and note the actual status of the items for that biblio record (Apply patch) 1) Click on Tag cloud 2) Click on any of the tags 3) Note that the results actually have the correct item availability next to the "Availability" label. --- opac/opac-search.pl | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 9708176..60e65a5 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -472,8 +472,11 @@ if ($tag) { $query_cgi = "tag=" .$tag . "&" . $query_cgi; my $taglist = get_tags({term=>$tag, approved=>1}); $results_hashref->{biblioserver}->{hits} = scalar (@$taglist); - my @biblist = (map {GetBiblioData($_->{biblionumber})} @$taglist); - my @marclist = (map {$_->{marc}} @biblist ); + my @marclist; + foreach my $record (@$taglist) { + my $marc = GetMarcBiblio($record->{biblionumber}, 1); + push @marclist, $marc->as_usmarc(); + } $DEBUG and printf STDERR "taglist (%s biblionumber)\nmarclist (%s records)\n", scalar(@$taglist), scalar(@marclist); $results_hashref->{biblioserver}->{RECORDS} = \@marclist; # FIXME: tag search and standard search should work together, not exclusively -- 1.7.7.4