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

(-)a/tools/export.pl (-7 / +19 lines)
Lines 17-22 Link Here
17
# Suite 330, Boston, MA  02111-1307 USA
17
# Suite 330, Boston, MA  02111-1307 USA
18
18
19
use Modern::Perl;
19
use Modern::Perl;
20
use MARC::File::XML;
20
use List::MoreUtils qw(uniq);
21
use List::MoreUtils qw(uniq);
21
use Getopt::Long;
22
use Getopt::Long;
22
use CGI;
23
use CGI;
Lines 309-314 if ( $op eq "export" ) { Link Here
309
            } @{ $sth->fetchall_arrayref };
310
            } @{ $sth->fetchall_arrayref };
310
        }
311
        }
311
312
313
        my $xml_header_written = 0;
312
        for my $recordid ( uniq @recordids ) {
314
        for my $recordid ( uniq @recordids ) {
313
            if ($deleted_barcodes) {
315
            if ($deleted_barcodes) {
314
                my $q = "
316
                my $q = "
Lines 374-392 if ( $op eq "export" ) { Link Here
374
                }
376
                }
375
                RemoveAllNsb($record) if ($clean);
377
                RemoveAllNsb($record) if ($clean);
376
                if ( $output_format eq "xml" ) {
378
                if ( $output_format eq "xml" ) {
377
                    if ( $marcflavour eq 'UNIMARC' && $record_type eq 'auths' )
379
                    unless ($xml_header_written) {
378
                    {
380
                        MARC::File::XML->default_record_format(
379
                        print $record->as_xml_record('UNIMARCAUTH');
381
                            (
380
                    }
382
                                     $marcflavour eq 'UNIMARC'
381
                    else {
383
                                  && $record_type eq 'auths'
382
                        print $record->as_xml_record($marcflavour);
384
                            ) ? 'UNIMARCAUTH' : $marcflavour
385
                        );
386
                        print MARC::File::XML::header();
387
                        print "\n";
388
                        $xml_header_written = 1;
383
                    }
389
                    }
390
                    print MARC::File::XML::record($record);
391
                    print "\n";
384
                }
392
                }
385
                else {
393
                else {
386
                    print $record->as_usmarc();
394
                    print $record->as_usmarc();
387
                }
395
                }
388
            }
396
            }
389
        }
397
        }
398
        if ($xml_header_written) {
399
            print MARC::File::XML::footer();
400
            print "\n";
401
        }
402
390
        exit;
403
        exit;
391
    }
404
    }
392
    elsif ( $format eq "csv" ) {
405
    elsif ( $format eq "csv" ) {
393
- 

Return to bug 9415