use MARC::File::XML; # marc2marcxml, marcxml2marc, changeEncoding
use Biblio::EndnoteStyle;
use Unicode::Normalize qw( NFC ); # _entity_encode
-use C4::Biblio qw( GetFrameworkCode GetMarcBiblio );
+use C4::Biblio qw( GetFrameworkCode );
use C4::Koha; #marc2csv
use C4::XSLT;
use YAML::XS; #marcrecords2csv
Convert MARC or MARCXML to Dublin Core metadata (XSLT Transformation),
optionally can get an XML directly from biblio_metadata
without item information. This method take into consideration the syspref
-'marcflavour' (UNIMARC, MARC21 and NORMARC).
+'marcflavour' (UNIMARC or MARC21).
Return an XML file with the format defined in C<$format>
C<$marc> - an ISO-2709 scalar or MARC::Record object
$marcxml = $xml;
}
- # only proceed if MARC21 or UNIMARC; else clause is executed if marcflavour set it to NORMARC
- # generate MARC::Record object to see if not a marcxml record
- unless ( C4::Context->preference('marcflavour') eq 'NORMARC' ) {
- eval { $record = MARC::Record->new_from_xml(
- $marcxml,
- 'UTF-8',
- C4::Context->preference('marcflavour')
- );
- };
- } else {
- eval { $record = MARC::Record->new_from_xml(
- $marcxml,
- 'UTF-8',
- 'MARC21'
- );
- };
- }
+ eval { $record = MARC::Record->new_from_xml(
+ $marcxml,
+ 'UTF-8',
+ C4::Context->preference('marcflavour')
+ );
+ };
# conversion to MARC::Record object failed
if ( $@ ) {
=cut
sub marcrecord2csv {
- my ($biblio, $id, $header, $csv, $fieldprocessing, $itemnumbers) = @_;
+ my ($biblionumber, $id, $header, $csv, $fieldprocessing, $itemnumbers) = @_;
my $output;
# Getting the record
- my $record = GetMarcBiblio({ biblionumber => $biblio });
+ my $biblio = Koha::Biblios->find($biblionumber);
+ return unless $biblio;
+ my $record = eval {
+ $biblio->metadata->record(
+ { embed_items => 1, itemnumbers => $itemnumbers } );
+ };
return unless $record;
- C4::Biblio::EmbedItemsInMarcBiblio({
- marc_record => $record,
- biblionumber => $biblio,
- item_numbers => $itemnumbers });
# Getting the framework
- my $frameworkcode = GetFrameworkCode($biblio);
+ my $frameworkcode = $biblio->frameworkcode;
# Getting information about the csv profile
my $profile = Koha::CsvProfiles->find($id);