Koha/Koha/MetadataRecord.pm
Jared Camins-Esakov 56ea0f7e0f Bug 9755 QA follow-up: move MARC-specific functionality to utility class
This follow-up moves all the MARC-specific functionality of Koha::Record
(now renamed to Koha::MetadataRecord) to a Koha::Util::MARC utility class.

To test, run relevant unit tests:
> prove t/Koha_MetadataRecord.t t/Koha_Util_MARC.t t/db_dependent/Koha_Authority.t
and optionally try to merge a record.

Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-23 23:10:21 +00:00

59 lines
1.5 KiB
Perl

package Koha::MetadataRecord;
# Copyright 2013 C & P Bibliography Services
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
=head1 NAME
Koha::MetadataRecord - base class for metadata records
=head1 SYNOPSIS
my $record = new Koha::MetadataRecord({ 'record' => $marcrecord });
=head1 DESCRIPTION
Object-oriented class that encapsulates all metadata (i.e. bibliographic
and authority) records in Koha.
=cut
use strict;
use warnings;
use C4::Context;
use Koha::Util::MARC;
use base qw(Class::Accessor);
__PACKAGE__->mk_accessors(qw( record schema ));
=head2 createMergeHash
Create a hash for use when merging records. At the moment the only
metadata schema supported is MARC.
=cut
sub createMergeHash {
my ($self, $tagslib) = @_;
if ($self->schema =~ m/marc/) {
return Koha::Util::MARC::createMergeHash($self->record, $tagslib);
}
}
1;