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

(-)a/C4/Biblio.pm (-3 lines)
Lines 93-99 use C4::Charset qw( Link Here
93
    nsb_clean
93
    nsb_clean
94
    SetMarcUnicodeFlag
94
    SetMarcUnicodeFlag
95
    SetUTF8Flag
95
    SetUTF8Flag
96
    StripNonXmlChars
97
);
96
);
98
use C4::Languages;
97
use C4::Languages;
99
use C4::Linker;
98
use C4::Linker;
Lines 2248-2254 sub TransformHtmlToMarc { Link Here
2248
                    ;
2247
                    ;
2249
                    # between 001 and 009 (included)
2248
                    # between 001 and 009 (included)
2250
                } elsif ( $fval ne '' ) {
2249
                } elsif ( $fval ne '' ) {
2251
                    $fval     = StripNonXmlChars($fval);    #Strip out any non-XML characters like control characters
2252
                    $newfield = MARC::Field->new( $tag, $fval, );
2250
                    $newfield = MARC::Field->new( $tag, $fval, );
2253
                }
2251
                }
2254
2252
Lines 2270-2276 sub TransformHtmlToMarc { Link Here
2270
                        $newfield->add_subfields( $fkey => $fval);
2268
                        $newfield->add_subfields( $fkey => $fval);
2271
                    }
2269
                    }
2272
                    elsif($fval ne '') {
2270
                    elsif($fval ne '') {
2273
                        $fval     = StripNonXmlChars($fval);   #Strip out any non-XML characters like control characters
2274
                        $newfield = MARC::Field->new( $tag, $ind1, $ind2, $fkey => $fval );
2271
                        $newfield = MARC::Field->new( $tag, $ind1, $ind2, $fkey => $fval );
2275
                    }
2272
                    }
2276
                    $j += 2;
2273
                    $j += 2;
(-)a/Koha/Biblio/Metadata.pm (-1 / +36 lines)
Lines 38-43 Koha::Metadata - Koha Metadata Object class Link Here
38
38
39
=cut
39
=cut
40
40
41
=head3 store
42
43
Metadata specific store method to catch errant characters prior 
44
to commiting to the database.
45
46
=cut
47
48
sub store {
49
    my $self = shift;
50
51
    # Check marcxml will roundtrip
52
    if ( $self->format eq 'marcxml' ) {
53
54
        my $marcxml = eval {
55
            MARC::Record::new_from_xml(
56
                $self->metadata, 'UTF-8',
57
                $self->schema
58
            );
59
        };
60
        my $marcxml_error = $@;
61
        chomp $marcxml_error;
62
        unless ($marcxml) {
63
            warn $marcxml_error;
64
            Koha::Exceptions::Metadata::Invalid->throw(
65
                id             => $self->id,
66
                biblionumber   => $self->biblionumber,
67
                format         => $self->format,
68
                schema         => $self->schema,
69
                decoding_error => $marcxml_error,
70
            );
71
        }
72
    }
73
74
    return $self->SUPER::store;
75
}
76
41
=head3 record
77
=head3 record
42
78
43
my $record = $metadata->record;
79
my $record = $metadata->record;
44
- 

Return to bug 35104