=head3 get_marc_notes
- $marcnotesarray = $biblio->get_marc_notes({ marcflavour => $marcflavour });
+ $marcnotesarray = $biblio->get_marc_notes({ opac => 1 });
Get all notes from the MARC record and returns them in an array.
The notes are stored in different fields depending on MARC flavour.
sub get_marc_notes {
my ( $self, $params ) = @_;
- my $marcflavour = $params->{marcflavour};
+ my $marcflavour = C4::Context->preference('marcflavour');
my $opac = $params->{opac};
my $scope = $marcflavour eq "UNIMARC"? '3..': '5..';
my $biblio = Koha::Biblios->find( $biblionumber ) or next;
my $dat = $biblio->unblessed;
my $record = &GetMarcBiblio({ biblionumber => $biblionumber });
- my $marcnotesarray = $biblio->get_marc_notes({ marcflavour => $marcflavour });
+ my $marcnotesarray = $biblio->get_marc_notes;
my $marcauthorsarray = $biblio->get_marc_authors;
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
my $marcseriesarray = GetMarcSeries ($record,$marcflavour);
);
$template->param(
- MARCNOTES => $marc_record ? $biblio->get_marc_notes({ marcflavour => $marcflavour }) : undef,
- itemdata_ccode => $itemfields{ccode},
- itemdata_enumchron => $itemfields{enumchron},
- itemdata_uri => $itemfields{uri},
- itemdata_copynumber => $itemfields{copynumber},
- itemdata_stocknumber => $itemfields{stocknumber},
- itemdata_publisheddate => $itemfields{publisheddate},
- volinfo => $itemfields{enumchron},
- itemdata_itemnotes => $itemfields{itemnotes},
- itemdata_nonpublicnotes => $itemfields{itemnotes_nonpublic},
- z3950_search_params => C4::Search::z3950_search_args($dat),
- hostrecords => $hostrecords,
- analytics_flag => $analytics_flag,
+ MARCNOTES => $marc_record ? $biblio->get_marc_notes() : undef,
+ itemdata_ccode => $itemfields{ccode},
+ itemdata_enumchron => $itemfields{enumchron},
+ itemdata_uri => $itemfields{uri},
+ itemdata_copynumber => $itemfields{copynumber},
+ itemdata_stocknumber => $itemfields{stocknumber},
+ itemdata_publisheddate => $itemfields{publisheddate},
+ volinfo => $itemfields{enumchron},
+ itemdata_itemnotes => $itemfields{itemnotes},
+ itemdata_nonpublicnotes => $itemfields{itemnotes_nonpublic},
+ z3950_search_params => C4::Search::z3950_search_args($dat),
+ hostrecords => $hostrecords,
+ analytics_flag => $analytics_flag,
C4::Search::enabled_staff_search_views,
- materials => $materials_flag,
+ materials => $materials_flag,
);
if (C4::Context->preference("AlternateHoldingsField") && scalar @items == 0) {
});
$record_processor->process($record);
next unless $record;
- my $marcnotesarray = $biblio->get_marc_notes({ marcflavour => $marcflavour, opac => 1 });
+ my $marcnotesarray = $biblio->get_marc_notes({ opac => 1 });
my $marcauthorsarray = $biblio->get_marc_authors;
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
my $marcseriesarray = GetMarcSeries ($record,$marcflavour);
}
}
-my $marcnotesarray = $biblio->get_marc_notes({ marcflavour => $marcflavour, opac => 1 });
+my $marcnotesarray = $biblio->get_marc_notes({ opac => 1 });
if( C4::Context->preference('ArticleRequests') ) {
my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef;
C4::Biblio::ModBiblio( $record, $biblio->biblionumber );
$biblio = Koha::Biblios->find( $biblio->biblionumber);
- my $notes = $biblio->get_marc_notes({ marcflavour => 'MARC21' });
+ my $notes = $biblio->get_marc_notes;
is( $notes->[0]->{marcnote}, 'Note1', 'First note' );
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
is( $notes->[4]->{marcnote}, 'Note5', 'Fifth note' );
is( $notes->[5]->{marcnote}, 'Description should show', 'Authorised value is correctly parsed to show description rather than code' );
is( @$notes, 6, 'No more notes' );
- $notes = $biblio->get_marc_notes({ marcflavour => 'MARC21', opac => 1 });
+ $notes = $biblio->get_marc_notes({ opac => 1 });
is( $notes->[0]->{marcnote}, 'Note1', 'First note' );
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
$schema->storage->txn_begin;
t::lib::Mocks::mock_preference( 'NotesToHide', '310' );
+ t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' );
my $biblio = $builder->build_sample_biblio;
my $record = $biblio->metadata->record;
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
is( @$notes, 2, 'No more notes' );
+ t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );
$schema->storage->txn_rollback;
};