View | Details | Raw Unified | Return to bug 35104
Collapse All | Expand All

(-)a/C4/Biblio.pm (-2 lines)
Lines 88-94 use C4::Charset qw( Link Here
88
    nsb_clean
88
    nsb_clean
89
    SetMarcUnicodeFlag
89
    SetMarcUnicodeFlag
90
    SetUTF8Flag
90
    SetUTF8Flag
91
    StripNonXmlChars
92
);
91
);
93
use C4::Languages;
92
use C4::Languages;
94
use C4::Linker;
93
use C4::Linker;
Lines 2315-2321 sub TransformHtmlToMarc { Link Here
2315
2314
2316
                    # between 001 and 009 (included)
2315
                    # between 001 and 009 (included)
2317
                } elsif ( $fval ne '' ) {
2316
                } elsif ( $fval ne '' ) {
2318
                    $fval     = StripNonXmlChars($fval);    #Strip out any non-XML characters like control characters
2319
                    $newfield = MARC::Field->new( $tag, $fval, );
2317
                    $newfield = MARC::Field->new( $tag, $fval, );
2320
                }
2318
                }
2321
2319
(-)a/Koha/Biblio/Metadata.pm (-1 / +36 lines)
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
- 

Return to bug 35104