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

(-)a/Koha/Exporter/Record.pm (-5 / +12 lines)
Lines 257-266 sub export { Link Here
257
        if ( $format eq 'iso2709' ) {
257
        if ( $format eq 'iso2709' ) {
258
            my $encoding_validator = sub {
258
            my $encoding_validator = sub {
259
                my ( $record, $record_type ) = @_;
259
                my ( $record, $record_type ) = @_;
260
                my $errorcount_on_decode =
260
                my @decoding_warnings =
261
                    eval { scalar( MARC::File::USMARC->decode( $record->as_usmarc )->warnings() ) };
261
                    eval { MARC::File::USMARC->decode( $record->as_usmarc )->warnings() };
262
                if ( $errorcount_on_decode || $@ ) {
262
                my $error = $@;
263
                    my $msg = "$record_type could not be USMARC decoded/encoded. " . ( $@ // '' );
263
                if ( $error || @decoding_warnings ) {
264
                    my ( $id_tag, $id_code ) = GetMarcFromKohaField( 'biblio.biblionumber', '' );
265
                    my $field = $record->field($id_tag);
266
                    my $msg = "$record_type";
267
                    if ($field) {
268
                        $msg .= " " . $field->is_control_field ? $field->data : $field->subfield($id_code);
269
                    }
270
                    my $warnings = join(', ', @decoding_warnings);
271
                    $msg .= " could not be USMARC decoded/encoded. " . ( $error // $warnings );
264
                    chomp $msg;
272
                    chomp $msg;
265
                    Koha::Logger->get->warn($msg);
273
                    Koha::Logger->get->warn($msg);
266
                    return 0;
274
                    return 0;
267
- 

Return to bug 20551