Owen Leonard
6d6c4cc12c
When viewing an authority record, you have the option to "Save" in several different formats. This operation is a GET operation and the script should not be looking for a "cud-" operation. To test you should have at least one authority record. - Apply the patch and go to Authorities. - Perform an authority search which will return one or more records. - View the details of an authority record. - From the toolbar, test the "Save" option* * Note: In my test the export choice "MADS (XML)" resulted in a zero-byte file but I'm assuming that is a separate issue. Sponsored-by: Athens County Public Libraries Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
49 lines
1.4 KiB
Perl
Executable file
49 lines
1.4 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
use Modern::Perl;
|
|
|
|
use C4::Record;
|
|
use C4::Auth qw( get_template_and_user );
|
|
use C4::Output;
|
|
use C4::AuthoritiesMarc qw( GetAuthority );
|
|
use CGI qw ( -utf8 );
|
|
|
|
my $query = CGI->new;
|
|
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|
{
|
|
template_name => "tools/export.tt",
|
|
query => $query,
|
|
type => "intranet",
|
|
flagsrequired => { catalogue => 1 },
|
|
}
|
|
);
|
|
|
|
my $op = $query->param("op");
|
|
my $format = $query->param("format");
|
|
my $error = '';
|
|
if ( $op eq "export" ) {
|
|
my $authid = $query->param("authid");
|
|
if ($authid) {
|
|
|
|
my $marc = GetAuthority($authid);
|
|
|
|
if ( $format =~ /marcxml/ ) {
|
|
$marc = marc2marcxml($marc, 'UTF-8', C4::Context->preference("marcflavour") eq 'UNIMARC' ? 'UNIMARCAUTH' : 'MARC21' );
|
|
}
|
|
elsif ($format=~ /mads/) {
|
|
$marc = marc2madsxml($marc);
|
|
}
|
|
elsif ( $format =~ /marc8/ ) {
|
|
$marc = changeEncoding( $marc, "MARC", "MARC21", "MARC-8" );
|
|
$marc = $marc->as_usmarc();
|
|
}
|
|
elsif ( $format =~ /utf8/ ) {
|
|
C4::Charset::SetUTF8Flag( $marc, 1 );
|
|
$marc = $marc->as_usmarc();
|
|
}
|
|
print $query->header(
|
|
-type => 'application/octet-stream',
|
|
-attachment => "auth-$authid.$format"
|
|
);
|
|
print $marc;
|
|
}
|
|
}
|