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

(-)a/C4/Biblio.pm (-3 lines)
Lines 92-98 use C4::Charset qw( Link Here
92
    nsb_clean
92
    nsb_clean
93
    SetMarcUnicodeFlag
93
    SetMarcUnicodeFlag
94
    SetUTF8Flag
94
    SetUTF8Flag
95
    StripNonXmlChars
96
);
95
);
97
use C4::Languages;
96
use C4::Languages;
98
use C4::Linker;
97
use C4::Linker;
Lines 2261-2267 sub TransformHtmlToMarc { Link Here
2261
                    ;
2260
                    ;
2262
                    # between 001 and 009 (included)
2261
                    # between 001 and 009 (included)
2263
                } elsif ( $fval ne '' ) {
2262
                } elsif ( $fval ne '' ) {
2264
                    $fval     = StripNonXmlChars($fval);    #Strip out any non-XML characters like control characters
2265
                    $newfield = MARC::Field->new( $tag, $fval, );
2263
                    $newfield = MARC::Field->new( $tag, $fval, );
2266
                }
2264
                }
2267
2265
Lines 2283-2289 sub TransformHtmlToMarc { Link Here
2283
                        $newfield->add_subfields( $fkey => $fval);
2281
                        $newfield->add_subfields( $fkey => $fval);
2284
                    }
2282
                    }
2285
                    elsif($fval ne '') {
2283
                    elsif($fval ne '') {
2286
                        $fval     = StripNonXmlChars($fval);   #Strip out any non-XML characters like control characters
2287
                        $newfield = MARC::Field->new( $tag, $ind1, $ind2, $fkey => $fval );
2284
                        $newfield = MARC::Field->new( $tag, $ind1, $ind2, $fkey => $fval );
2288
                    }
2285
                    }
2289
                    $j += 2;
2286
                    $j += 2;
(-)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 commiting 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