@@ -, +, @@ --------- -- this makes everything hidden everywhere. -- it is completely arbitrary, any value which hides in OPAC would suffice for this patch. system preference is 'default' or some custome template -- default was used for testing. -- my testing assumes 1 -- testing data set only had book with 'carbs' in title. -- because I only had 1 match it redirected to results. -- material type 'book' comes from LDR, which is not filtered. -- the items section is built and not part of the filter. -- should be painfully sparse -- all should be painfully sparse -- painfully sparse --- C4/Output.pm | 2 +- opac/opac-ISBDdetail.pl | 6 ++++-- opac/opac-MARCdetail.pl | 6 ++++-- opac/opac-detail.pl | 14 +++++++++----- 4 files changed, 18 insertions(+), 10 deletions(-) --- a/C4/Output.pm +++ a/C4/Output.pm @@ -311,7 +311,7 @@ sub parametrized_url { my $vars = shift || {}; # ie { LANG => en } my $ret = $url; while ( my ($key,$val) = each %$vars) { - my $val_url = URI::Escape::uri_escape_utf8($val); + my $val_url = defined($val) ? URI::Escape::uri_escape_utf8($val) : q{}; $ret =~ s/\{$key\}/$val_url/g; } $ret =~ s/\{[^\{]*\}//g; # remove not defined vars --- a/opac/opac-ISBDdetail.pl +++ a/opac/opac-ISBDdetail.pl @@ -191,8 +191,10 @@ my $marcissns = GetMarcISSN ( $record, $marcflavour ); my $issn = $marcissns->[0] || ''; if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ - $dat->{title} =~ s/\/+$//; # remove trailing slash - $dat->{title} =~ s/\s+$//; # remove trailing space + if (defined($dat->{title})) { + $dat->{title} =~ s/\/+$//; # remove trailing slash + $dat->{title} =~ s/\s+$//; # remove trailing space + } $search_for_title = parametrized_url( $search_for_title, { --- a/opac/opac-MARCdetail.pl +++ a/opac/opac-MARCdetail.pl @@ -325,8 +325,10 @@ my $marcissns = GetMarcISSN( $record, $marcflavour ); my $issn = $marcissns->[0] || ''; if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ - $dat->{title} =~ s/\/+$//; # remove trailing slash - $dat->{title} =~ s/\s+$//; # remove trailing space + if (defined($dat->{title})) { + $dat->{title} =~ s/\/+$//; # remove trailing slash + $dat->{title} =~ s/\s+$//; # remove trailing space + } $search_for_title = parametrized_url( $search_for_title, { --- a/opac/opac-detail.pl +++ a/opac/opac-detail.pl @@ -89,15 +89,21 @@ if ( ! $record ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early exit; } -my $framework = &GetFrameworkCode( $biblionumber ); + +my $dat = &GetBiblioData($biblionumber); my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy', options => { interface => 'opac', - frameworkcode => $framework + frameworkcode => $dat->{'frameworkcode'} } }); -$record_processor->process($record); + +# Only run filtering on record if not XSLT. +my $xslfile = C4::Context->preference('OPACXSLTDetailsDisplay'); +if (! $xslfile ) { + $record_processor->process($record); +} # redirect if opacsuppression is enabled and biblio is suppressed if (C4::Context->preference('OpacSuppression')) { @@ -149,7 +155,6 @@ my $marcflavour = C4::Context->preference("marcflavour"); my $ean = GetNormalizedEAN( $record, $marcflavour ); # XSLT processing of some stuff -my $xslfile = C4::Context->preference('OPACXSLTDetailsDisplay'); my $lang = $xslfile ? C4::Languages::getlanguage() : undef; my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef; @@ -530,7 +535,6 @@ if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) { } } -my $dat = &GetBiblioData($biblionumber); my $HideMARC = $record_processor->filters->[0]->should_hide_marc( { frameworkcode => $dat->{'frameworkcode'}, --