Browse Source

bug 4311: respect OPACXSLTResultsDisplay

Check OPACXSLTResultsDisplay instead of XSLTResultsDisplay when
determining whether to use the XSLT bib results stylesheet for
OPAC search results.

In the process, added a new $search_context parameter to
C4::Search::searchResults() to specify whether results
are to be served up for the staff interface or for the
OPAC.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
3.2.x
Galen Charlton 14 years ago
parent
commit
b1ed3af633
  1. 16
      C4/Search.pm
  2. 3
      catalogue/search.pl
  3. 2
      cataloguing/addbooks.pl
  4. 5
      opac/opac-search.pl

16
C4/Search.pm

@ -1345,6 +1345,10 @@ sub buildQuery {
=head2 searchResults
my @search_results = searchResults($search_context, $searchdesc, $hits,
$results_per_page, $offset, $scan,
@marcresults, $hidelostitems);
Format results in a form suitable for passing to the template
=cut
@ -1352,10 +1356,12 @@ Format results in a form suitable for passing to the template
# IMO this subroutine is pretty messy still -- it's responsible for
# building the HTML output for the template
sub searchResults {
my ( $searchdesc, $hits, $results_per_page, $offset, $scan, @marcresults, $hidelostitems ) = @_;
my ( $search_context, $searchdesc, $hits, $results_per_page, $offset, $scan, @marcresults, $hidelostitems ) = @_;
my $dbh = C4::Context->dbh;
my @newresults;
$search_context = 'opac' unless $search_context eq 'opac' or $search_context eq 'intranet';
#Build branchnames hash
#find branchname
#get branch information.....
@ -1664,9 +1670,11 @@ sub searchResults {
use C4::Charset;
SetUTF8Flag($marcrecord);
$debug && warn $marcrecord->as_formatted;
if (C4::Context->preference("XSLTResultsDisplay") && !$scan) {
$oldbiblio->{XSLTResultsRecord} = XSLTParse4Display(
$oldbiblio->{biblionumber}, $marcrecord, 'Results' );
if (!$scan && $search_context eq 'opac' && C4::Context->preference("OPACXSLTResultsDisplay")) {
# FIXME note that XSLTResultsDisplay (use of XSLT to format staff interface bib search results)
# is not implemented yet
$oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, 'Results',
$search_context);
}
# last check for norequest : if itemtype is notforloan, it can't be reserved either, whatever the items

3
catalogue/search.pl

@ -513,7 +513,8 @@ for (my $i=0;$i<@servers;$i++) {
if ($server =~/biblioserver/) { # this is the local bibliographic server
$hits = $results_hashref->{$server}->{"hits"};
my $page = $cgi->param('page') || 0;
my @newresults = searchResults( $query_desc,$hits,$results_per_page,$offset,$scan,@{$results_hashref->{$server}->{"RECORDS"}});
my @newresults = searchResults('intranet', $query_desc, $hits, $results_per_page, $offset, $scan,
@{$results_hashref->{$server}->{"RECORDS"}});
$total = $total + $results_hashref->{$server}->{"hits"};
## If there's just one result, redirect to the detail page
if ($total == 1) {

2
cataloguing/addbooks.pl

@ -86,7 +86,7 @@ if ($query) {
# format output
# SimpleSearch() give the results per page we want, so 0 offet here
my $total = scalar @$marcresults;
my @newresults = searchResults( $query, $total, $results_per_page, 0, 0, @$marcresults );
my @newresults = searchResults( 'intranet', $query, $total, $results_per_page, 0, 0, @$marcresults );
$template->param(
total => $total_hits,
query => $query,

5
opac/opac-search.pl

@ -442,12 +442,13 @@ for (my $i=0;$i<=@servers;$i++) {
# because pazGetRecords handles retieving only the records
# we want as specified by $offset and $results_per_page,
# we need to set the offset parameter of searchResults to 0
my @group_results = searchResults( $query_desc, $group->{'group_count'},$results_per_page, 0, $scan,
my @group_results = searchResults( 'opac', $query_desc, $group->{'group_count'},$results_per_page, 0, $scan,
@{ $group->{"RECORDS"} }, C4::Context->preference('hidelostitems'));
push @newresults, { group_label => $group->{'group_label'}, GROUP_RESULTS => \@group_results };
}
} else {
@newresults = searchResults( $query_desc,$hits,$results_per_page,$offset,$scan,@{$results_hashref->{$server}->{"RECORDS"}},, C4::Context->preference('hidelostitems'));
@newresults = searchResults('opac', $query_desc, $hits, $results_per_page, $offset, $scan,
@{$results_hashref->{$server}->{"RECORDS"}},, C4::Context->preference('hidelostitems'));
}
my $tag_quantity;
if (C4::Context->preference('TagsEnabled') and

Loading…
Cancel
Save