Merge branch 'bug_9415' into 3.12-master

This commit is contained in:
Jared Camins-Esakov 2013-03-19 22:07:33 -04:00
commit 055a783fbc
1 changed files with 19 additions and 6 deletions

View File

@ -17,6 +17,7 @@
# Suite 330, Boston, MA 02111-1307 USA
use Modern::Perl;
use MARC::File::XML;
use List::MoreUtils qw(uniq);
use Getopt::Long;
use CGI;
@ -309,6 +310,7 @@ if ( $op eq "export" ) {
} @{ $sth->fetchall_arrayref };
}
my $xml_header_written = 0;
for my $recordid ( uniq @recordids ) {
if ($deleted_barcodes) {
my $q = "
@ -374,19 +376,30 @@ if ( $op eq "export" ) {
}
RemoveAllNsb($record) if ($clean);
if ( $output_format eq "xml" ) {
if ( $marcflavour eq 'UNIMARC' && $record_type eq 'auths' )
{
print $record->as_xml_record('UNIMARCAUTH');
}
else {
print $record->as_xml_record($marcflavour);
unless ($xml_header_written) {
MARC::File::XML->default_record_format(
(
$marcflavour eq 'UNIMARC'
&& $record_type eq 'auths'
) ? 'UNIMARCAUTH' : $marcflavour
);
print MARC::File::XML::header();
print "\n";
$xml_header_written = 1;
}
print MARC::File::XML::record($record);
print "\n";
}
else {
print $record->as_usmarc();
}
}
}
if ($xml_header_written) {
print MARC::File::XML::footer();
print "\n";
}
exit;
}
elsif ( $format eq "csv" ) {