C4::Record - MARC, MARCXML, DC, MODS, XML, etc. Record Management Functions and API
New in Koha 3.x. This module handles all record-related management functions.
my ($error,$newmarc) = marc2marc($marc,$to_flavour,$from_flavour,$encoding);
Returns an ISO-2709 scalar
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)
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
my ($error,$dcxml) = marc2dcxml($marc,$qualified);
Returns a DublinCore::Record object, will eventually return a Dublin Core scalar
FIXME: should return actual XML, not just an object
$marc
- an ISO-2709 scalar or MARC::Record object
$qualified
- specify whether qualified Dublin Core should be used in the input or output [0]
my ($error,$modsxml) = marc2modsxml($marc);
Returns a MODS scalar
my ($csv) = marc2csv($biblios, $csvprofileid);
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 and the GetCsvProfiles function in C4::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 and the GetCsvProfiles function in C4::Csv)
$header
- true if the headers are to be printed (typically at first pass)
$csv
- an already initialised Text::CSV object
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
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)
my ($entity_encoded_string) = _entity_encode($string);
or
my (@entity_encoded_strings) = _entity_encode(@strings);
Entity-encode an array of strings
Joshua Ferraro <jmf@liblime.com>