|
Lines 40-45
Koha::Metadata - Koha Metadata Object class
Link Here
|
| 40 |
|
40 |
|
| 41 |
=cut |
41 |
=cut |
| 42 |
|
42 |
|
|
|
43 |
=head3 store |
| 44 |
|
| 45 |
Metadata specific store method to catch errant characters prior |
| 46 |
to committing to the database. |
| 47 |
|
| 48 |
=cut |
| 49 |
|
| 50 |
sub store { |
| 51 |
my $self = shift; |
| 52 |
|
| 53 |
# Check marcxml will roundtrip |
| 54 |
if ( $self->format eq 'marcxml' ) { |
| 55 |
|
| 56 |
my $marcxml = eval { |
| 57 |
MARC::Record::new_from_xml( |
| 58 |
$self->metadata, 'UTF-8', |
| 59 |
$self->schema |
| 60 |
); |
| 61 |
}; |
| 62 |
my $marcxml_error = $@; |
| 63 |
chomp $marcxml_error; |
| 64 |
unless ($marcxml) { |
| 65 |
warn $marcxml_error; |
| 66 |
Koha::Exceptions::Metadata::Invalid->throw( |
| 67 |
id => $self->id, |
| 68 |
biblionumber => $self->biblionumber, |
| 69 |
format => $self->format, |
| 70 |
schema => $self->schema, |
| 71 |
decoding_error => $marcxml_error, |
| 72 |
); |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
return $self->SUPER::store; |
| 77 |
} |
| 78 |
|
| 43 |
=head3 record |
79 |
=head3 record |
| 44 |
|
80 |
|
| 45 |
my $record = $metadata->record; |
81 |
my $record = $metadata->record; |
| 46 |
- |
|
|