Bug 11592: (QA followup) Add missing framework code to ViewPolicy filter calls
This patch adds the frameworkcode option param, using each record's frameworkcode as expected by the filter. Otherwise the ViewPolicy filter falls back to the default framework. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
ea27569334
commit
39487d634e
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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 ) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue