=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
# 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.....
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
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) {
# 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,
# 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