The description of this changes is on the regression tests commit message. To test: - Run $ prove t/Koha_MetadataRecord.t => FAIL: Tests fail because changes are not implemented - Apply this patch - Run $ prove t/Koha_MetadataRecord.t => SUCCESS: tests pass - Run $ prove t/Koha_Util_MARC.t => SUCCESS: it still passes - Sign off :-D --- Koha/MetadataRecord.pm | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/Koha/MetadataRecord.pm b/Koha/MetadataRecord.pm index 865dc0d..1a00c9d 100644 --- a/Koha/MetadataRecord.pm +++ b/Koha/MetadataRecord.pm @@ -32,15 +32,39 @@ and authority) records in Koha. =cut -use strict; -use warnings; -use C4::Context; +use Modern::Perl; + +use Carp; use Koha::Util::MARC; use base qw(Class::Accessor); -__PACKAGE__->mk_accessors(qw( record schema )); +__PACKAGE__->mk_accessors(qw( record schema format )); + + +sub new { + my $class = shift; + my $params = shift; + + if (!defined $params->{ record }) { + carp 'No record passed'; + return; + } + + my $record = $params->{ record }; + my $schema = $params->{ schema } // 'marc21'; + my $format = $params->{ format } // 'usmarc'; + + my $self = $class->SUPER::new({ + record => $record, + schema => $schema, + format => $format + }); + + bless $self, $class; + return $self; +} =head2 createMergeHash -- 2.5.0 _______________________________________________ Koha-patches mailing list Koha-patches@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/