@@ -, +, @@ session anonymous_session => 1|0 or without an active session --- C4/Search.pm | 4 ++-- opac/opac-detail.pl | 11 ++++++++--- opac/opac-search.pl | 6 ++++-- opac/opac-shelves.pl | 14 +++++++++++--- opac/opac-tags.pl | 12 +++++++++--- 5 files changed, 34 insertions(+), 13 deletions(-) --- a/C4/Search.pm +++ a/C4/Search.pm @@ -1677,7 +1677,7 @@ 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 ( $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; @@ -2087,7 +2087,7 @@ sub searchResults { # 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 --- a/opac/opac-detail.pl +++ a/opac/opac-detail.pl @@ -170,11 +170,16 @@ my $lang = $xslfile ? C4::Languages::getlanguage() : undef; 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 + ) ); } --- a/opac/opac-search.pl +++ a/opac/opac-search.pl @@ -650,6 +650,8 @@ if (C4::Context->preference('OpacHiddenItemsExceptions')){ $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 @@ -662,12 +664,12 @@ for (my $i=0;$i<@servers;$i++) { # 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; --- a/opac/opac-shelves.pl +++ a/opac/opac-shelves.pl @@ -316,9 +316,17 @@ if ( $op eq 'view' ) { }); $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"); --- a/opac/opac-tags.pl +++ a/opac/opac-tags.pl @@ -284,10 +284,16 @@ if ($loggedinuser) { 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 ); } --