@@ -, +, @@ ViewPolicy filter calls --- catalogue/ISBDdetail.pl | 16 +++++++++------- opac/opac-ISBDdetail.pl | 10 ++++++++-- opac/opac-MARCdetail.pl | 31 +++++++++++++++++++------------ opac/opac-basket.pl | 8 +++++++- opac/opac-detail.pl | 9 ++++++++- opac/opac-downloadcart.pl | 5 +++++ opac/opac-downloadshelf.pl | 7 +++++-- opac/opac-export.pl | 11 ++++++++--- opac/opac-shelves.pl | 5 +++++ opac/opac-showmarc.pl | 7 +++++-- 10 files changed, 79 insertions(+), 30 deletions(-) --- a/catalogue/ISBDdetail.pl +++ a/catalogue/ISBDdetail.pl @@ -77,13 +77,6 @@ if ( not defined $biblionumber ) { } my $record = GetMarcBiblio($biblionumber,1); -my $record_processor = Koha::RecordProcessor->new({ - filters => 'ViewPolicy', - options => { - interface => 'intranet', - }, -}); -$record_processor->process($record); if ( not defined $record ) { # biblionumber invalid -> report and exit @@ -95,6 +88,15 @@ if ( not defined $record ) { } my $framework = GetFrameworkCode( $biblionumber ); +my $record_processor = Koha::RecordProcessor->new({ + filters => 'ViewPolicy', + options => { + interface => 'intranet', + frameworkcode => $framework + }, +}); +$record_processor->process($record); + my $res = GetISBDView({ 'record' => $record, 'template' => 'intranet', --- a/opac/opac-ISBDdetail.pl +++ a/opac/opac-ISBDdetail.pl @@ -97,7 +97,14 @@ if ( ! $record ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); exit; } -my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' }); +my $framework = GetFrameworkCode( $biblionumber ); +my $record_processor = Koha::RecordProcessor->new({ + filters => 'ViewPolicy', + options => { + interface => 'opac', + frameworkcode => $framework + } +}); $record_processor->process($record); # some useful variables for enhanced content; @@ -149,7 +156,6 @@ $template->param( my $norequests = 1; my $allow_onshelf_holds; -my $framework = GetFrameworkCode( $biblionumber ); my $res = GetISBDView({ 'record' => $record, 'template' => 'opac', --- a/opac/opac-MARCdetail.pl +++ a/opac/opac-MARCdetail.pl @@ -69,6 +69,12 @@ if ( ! $biblionumber ) { exit; } +my $record = GetMarcBiblio($biblionumber, 1); +if ( ! $record ) { + print $query->redirect("/cgi-bin/koha/errors/404.pl"); + exit; +} + my @all_items = GetItemsInfo($biblionumber); my @items2hide; if (scalar @all_items >= 1) { @@ -80,17 +86,18 @@ if (scalar @all_items >= 1) { } } -my $itemtype = &GetFrameworkCode($biblionumber); -my $tagslib = &GetMarcStructure( 0, $itemtype ); -my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField('items.itemnumber',$itemtype); +my $framework = &GetFrameworkCode( $biblionumber ); +my $tagslib = &GetMarcStructure( 0, $framework ); +my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField('items.itemnumber',$framework); my $biblio = GetBiblioData($biblionumber); -$biblionumber = $biblio->{biblionumber}; -my $record = GetMarcBiblio($biblionumber, 1); -if ( ! $record ) { - print $query->redirect("/cgi-bin/koha/errors/404.pl"); - exit; -} -my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' }); + +my $record_processor = Koha::RecordProcessor->new({ + filters => 'ViewPolicy', + options => { + interface => 'opac', + frameworkcode => $framework + } +}); $record_processor->process($record); # open template @@ -104,7 +111,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -my ($bt_tag,$bt_subtag) = GetMarcFromKohaField('biblio.title',$itemtype); +my ($bt_tag,$bt_subtag) = GetMarcFromKohaField('biblio.title',$framework); $template->param( bibliotitle => $biblio->{title}, ) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible. @@ -291,7 +298,7 @@ foreach my $field (@fields) { push @item_loop, $item if $item; } my ( $holdingbrtagf, $holdingbrtagsubf ) = - &GetMarcFromKohaField( "items.holdingbranch", $itemtype ); + &GetMarcFromKohaField( "items.holdingbranch", $framework ); @item_loop = sort { ($a->{$holdingbrtagsubf}||'') cmp ($b->{$holdingbrtagsubf}||'') } @item_loop; --- a/opac/opac-basket.pl +++ a/opac/opac-basket.pl @@ -63,7 +63,13 @@ foreach my $biblionumber ( @bibs ) { my $dat = &GetBiblioData($biblionumber); next unless $dat; - my $record = &GetMarcBiblio($biblionumber); + + my $record = &GetMarcBiblio( $biblionumber ); + my $framework = &GetFrameworkCode( $biblionumber ); + $record_processor->options({ + interface => 'opac', + frameworkcode => $framework + }); $record_processor->process($record); next unless $record; my $marcnotesarray = GetMarcNotes( $record, $marcflavour ); --- a/opac/opac-detail.pl +++ a/opac/opac-detail.pl @@ -89,7 +89,14 @@ if ( ! $record ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early exit; } -my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' }); +my $framework = &GetFrameworkCode( $biblionumber ); +my $record_processor = Koha::RecordProcessor->new({ + filters => 'ViewPolicy', + options => { + interface => 'opac', + frameworkcode => $framework + } +}); $record_processor->process($record); # redirect if opacsuppression is enabled and biblio is suppressed --- a/opac/opac-downloadcart.pl +++ a/opac/opac-downloadcart.pl @@ -69,6 +69,11 @@ if ($bib_list && $format) { foreach my $biblio (@bibs) { my $record = GetMarcBiblio($biblio, 1); + my $framework = &GetFrameworkCode( $biblio ); + $record_processor->options({ + interface => 'opac', + frameworkcode => $framework + }); $record_processor->process($record); next unless $record; --- a/opac/opac-downloadshelf.pl +++ a/opac/opac-downloadshelf.pl @@ -53,7 +53,6 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( my $shelfnumber = $query->param('shelfnumber'); my $format = $query->param('format'); my $context = $query->param('context'); -my $dbh = C4::Context->dbh; my $shelf = Koha::Virtualshelves->find( $shelfnumber ); if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { @@ -83,6 +82,11 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { my $biblionumber = $content->biblionumber->biblionumber; my $record = GetMarcBiblio($biblionumber, 1); + my $framework = &GetFrameworkCode( $biblionumber ); + $record_processor->options({ + interface => 'opac', + frameworkcode => $framework + }); $record_processor->process($record); next unless $record; @@ -96,7 +100,6 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { $output .= marc2bibtex($record, $biblionumber); } elsif ( $format eq 'isbd' ) { - my $framework = GetFrameworkCode( $biblionumber ); $output .= GetISBDView({ 'record' => $record, 'template' => 'opac', --- a/opac/opac-export.pl +++ a/opac/opac-export.pl @@ -45,8 +45,14 @@ if(!$marc) { } # ASSERT: There is a biblionumber, because GetMarcBiblio returned something. - -my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' }); +my $framework = GetFrameworkCode( $biblionumber ); +my $record_processor = Koha::RecordProcessor->new({ + filters => 'ViewPolicy', + options => { + interface => 'opac', + frameworkcode => $framework + } +}); $record_processor->process($marc); if ($format =~ /endnote/) { @@ -90,7 +96,6 @@ elsif ($format =~ /marcstd/) { $format = 'marcstd'; } elsif ( $format =~ /isbd/ ) { - my $framework = GetFrameworkCode( $biblionumber ); $marc = GetISBDView({ 'record' => $marc, 'template' => 'opac', --- a/opac/opac-shelves.pl +++ a/opac/opac-shelves.pl @@ -261,6 +261,11 @@ if ( $op eq 'view' ) { my $biblionumber = $content->biblionumber->biblionumber; my $this_item = GetBiblioData($biblionumber); my $record = GetMarcBiblio($biblionumber); + my $framework = GetFrameworkCode( $biblionumber ); + $record_processor->options({ + interface => 'opac', + frameworkcode => $framework + }); $record_processor->process($record); if ( $xslfile ) { --- a/opac/opac-showmarc.pl +++ a/opac/opac-showmarc.pl @@ -48,8 +48,11 @@ if ($importid) { } else { $record = GetMarcBiblio($biblionumber); - my $frameworkcode = GetFrameworkCode($biblionumber); - $record_processor->options({ frameworkcode => $frameworkcode}); + my $framework = GetFrameworkCode($biblionumber); + $record_processor->options({ + interface => 'opac', + frameworkcode => $framework + }); } if(!ref $record) { --