<<

NAME

C4::Record - MARC, MARCXML, DC, MODS, XML, etc. Record Management Functions and API

SYNOPSIS

New in Koha 3.x. This module handles all record-related management functions.

API (EXPORTED FUNCTIONS)

marc2marc - Convert from one flavour of ISO-2709 to another

  my ($error,$newmarc) = marc2marc($marc,$to_flavour,$from_flavour,$encoding);

Returns an ISO-2709 scalar

marc2marcxml - Convert from ISO-2709 to MARCXML

  my ($error,$marcxml) = marc2marcxml($marc,$encoding,$flavour);

Returns a MARCXML scalar

$marc - an ISO-2709 scalar or MARC::Record object

$encoding - UTF-8 or MARC-8 [UTF-8]

$flavour - MARC21 or UNIMARC

$dont_entity_encode - a flag that instructs marc2marcxml not to entity encode the xml before returning (optional)

marcxml2marc - Convert from MARCXML to ISO-2709

  my ($error,$marc) = marcxml2marc($marcxml,$encoding,$flavour);

Returns an ISO-2709 scalar

$marcxml - a MARCXML record

$encoding - UTF-8 or MARC-8 [UTF-8]

$flavour - MARC21 or UNIMARC

marc2dcxml - Convert from ISO-2709 to Dublin Core

    my dcxml = marc2dcxml ($marc, $xml, $biblionumber, $format);

EXAMPLE

    my dcxml = marc2dcxml (undef, undef, 1, "oaidc");

Convert MARC or MARCXML to Dublin Core metadata (XSLT Transformation), optionally can get an XML directly from database (biblioitems.marcxml) without item information. This method take into consideration the syspref 'marcflavour' (UNIMARC, MARC21 and NORMARC). Return an XML file with the format defined in $format

$marc - an ISO-2709 scalar or MARC::Record object

$xml - a MARCXML file

$biblionumber - obtain the record directly from database (biblioitems.marcxml)

$format - accept three type of DC formats (oaidc, srwdc, and rdfdc )

marc2modsxml - Convert from ISO-2709 to MODS

  my $modsxml = marc2modsxml($marc);

Returns a MODS scalar

marc2madsxml - Convert from ISO-2709 to MADS

  my $madsxml = marc2madsxml($marc);

Returns a MADS scalar

_transformWithStylesheet - Transform a MARC record with a stylesheet

    my $xml = _transformWithStylesheet($marc, $stylesheet)

Returns the XML scalar result of the transformation. $stylesheet should contain the path to a stylesheet under intrahtdocs.

marc2csv - Convert several records from UNIMARC to CSV

  my ($csv) = marc2csv($biblios, $csvprofileid, $itemnumbers);

Pre and postprocessing can be done through a YAML file

Returns a CSV scalar

$biblio - a list of biblionumbers

$csvprofileid - the id of the CSV profile to use for the export (see export_format.export_format_id)

$itemnumbers - a list of itemnumbers to export

marcrecord2csv - Convert a single record from UNIMARC to CSV

  my ($csv) = marcrecord2csv($biblio, $csvprofileid, $header);

Returns a CSV scalar

$biblio - a biblionumber

$csvprofileid - the id of the CSV profile to use for the export (see export_format.export_format_id)

$header - true if the headers are to be printed (typically at first pass)

$csv - an already initialised Text::CSV object

$fieldprocessing

$itemnumbers a list of itemnumbers to export

changeEncoding - Change the encoding of a record

  my ($error, $newrecord) = changeEncoding($record,$format,$flavour,$to_encoding,$from_encoding);

Changes the encoding of a record

$record - the record itself can be in ISO-2709, a MARC::Record object, or MARCXML for now (required)

$format - MARC or MARCXML (required)

$flavour - MARC21 or UNIMARC, if MARC21, it will change the leader (optional) [defaults to Koha system preference]

$to_encoding - the encoding you want the record to end up in (optional) [UTF-8]

$from_encoding - the encoding the record is currently in (optional, it will probably be able to tell unless there's a problem with the record)

FIXME: the from_encoding doesn't work yet

FIXME: better handling for UNIMARC, it should allow management of 100 field

FIXME: shouldn't have to convert to and from xml/marc just to change encoding someone needs to re-write MARC::Record's 'encoding' method to actually alter the encoding rather than just changing the leader

marc2bibtex - Convert from MARC21 and UNIMARC to BibTex

  my ($bibtex) = marc2bibtex($record, $id);

Returns a BibTex scalar

$record - a MARC::Record object

$id - an id for the BibTex record (might be the biblionumber)

INTERNAL FUNCTIONS

_entity_encode - Entity-encode an array of strings

  my ($entity_encoded_string) = _entity_encode($string);

or

  my (@entity_encoded_strings) = _entity_encode(@strings);

Entity-encode an array of strings

AUTHOR

Joshua Ferraro <jmf@liblime.com>

MODIFICATIONS

<<