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

(-)a/tools/export.pl (-7 / +14 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 $record_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 ($record_header_written) {
378
                    {
380
                        MARC::File::XML->default_record_format( ( $marcflavour eq 'UNIMARC' && $record_type eq 'auths' ) ? 'UNIMARCAUTH' : $marcflavour );
379
                        print $record->as_xml_record('UNIMARCAUTH');
381
                        print MARC::File::XML::header();
380
                    }
382
                        print "\n";
381
                    else {
383
                        $record_header_written = 1;
382
                        print $record->as_xml_record($marcflavour);
383
                    }
384
                    }
385
                    print MARC::File::XML::record( $record );
386
                    print "\n";
384
                }
387
                }
385
                else {
388
                else {
386
                    print $record->as_usmarc();
389
                    print $record->as_usmarc();
387
                }
390
                }
388
            }
391
            }
389
        }
392
        }
393
        if ($record_header_written) {
394
            print MARC::File::XML::footer();
395
            print "\n";
396
        }
397
        
390
        exit;
398
        exit;
391
    }
399
    }
392
    elsif ( $format eq "csv" ) {
400
    elsif ( $format eq "csv" ) {
393
- 

Return to bug 9415