# IMO this subroutine is pretty messy still -- it's responsible for
# building the HTML output for the template
sub searchResults {
- my ( $search_context, $searchdesc, $hits, $results_per_page, $offset, $scan, $marcresults ) = @_;
+ my ( $search_context, $searchdesc, $hits, $results_per_page, $offset, $scan, $marcresults, $xslt_variables ) = @_;
my $dbh = C4::Context->dbh;
my @newresults;
# XSLT processing of some stuff
# we fetched the sysprefs already before the loop through all retrieved record!
if (!$scan && $xslfile) {
- $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, 1, \@hiddenitems, $sysxml, $xslfile, $lang);
+ $oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, 1, \@hiddenitems, $sysxml, $xslfile, $lang, $xslt_variables);
}
# if biblio level itypes are used and itemtype is notforloan, it can't be reserved either
my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
if ( $xslfile ) {
+
+ my $variables = {
+ anonymous_session => ($borrowernumber) ? 0 : 1
+ };
+
$template->param(
XSLTBloc => XSLTParse4Display(
- $biblionumber, $record, "OPACXSLTDetailsDisplay",
- 1, undef, $sysxml, $xslfile, $lang
- )
+ $biblionumber, $record, "OPACXSLTDetailsDisplay", 1, undef,
+ $sysxml, $xslfile, $lang, $variables
+ )
);
}
$search_context->{'category'} = $patron ? $patron->categorycode : q{};
}
+my $variables = { anonymous_session => ($borrowernumber) ? 0 : 1 };
+
for (my $i=0;$i<@servers;$i++) {
my $server = $servers[$i];
if ($server && $server =~/biblioserver/) { # this is the local bibliographic server
# 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( $search_context, $query_desc, $group->{'group_count'},$results_per_page, 0, $scan,
- $group->{"RECORDS"});
+ $group->{"RECORDS"}, $variables);
push @newresults, { group_label => $group->{'group_label'}, GROUP_RESULTS => \@group_results };
}
} else {
@newresults = searchResults( $search_context, $query_desc, $hits, $results_per_page, $offset, $scan,
- $results_hashref->{$server}->{"RECORDS"});
+ $results_hashref->{$server}->{"RECORDS"}, $variables);
}
$hits = 0 unless @newresults;
});
$record_processor->process($record);
- if ( $xslfile ) {
- $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "OPACXSLTListsDisplay",
- 1, undef, $sysxml, $xslfile, $lang);
+ if ($xslfile) {
+ my $variables = {
+ anonymous_session => ($loggedinuser) ? 0 : 1
+ };
+ $this_item->{XSLTBloc} = XSLTParse4Display(
+ $biblionumber, $record,
+ "OPACXSLTListsDisplay", 1,
+ undef, $sysxml,
+ $xslfile, $lang,
+ $variables
+ );
}
my $marcflavour = C4::Context->preference("marcflavour");
my $lang = $xslfile ? C4::Languages::getlanguage() : undef;
my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
- if ( $xslfile ) {
+ if ($xslfile) {
+ my $variables = {
+ anonymous_session => ($loggedinuser) ? 0 : 1
+ };
$tag->{XSLTBloc} = XSLTParse4Display(
- $tag->{ biblionumber }, $record, "OPACXSLTResultsDisplay",
- 1, $hidden_items, $sysxml, $xslfile, $lang
+ $tag->{biblionumber}, $record,
+ "OPACXSLTResultsDisplay", 1,
+ $hidden_items, $sysxml,
+ $xslfile, $lang,
+ $variables
);
}