8 use C4::AuthoritiesMarc;
12 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
14 template_name => "tools/export.tt",
18 flagsrequired => { catalogue => 1 },
23 my $op = $query->param("op");
24 my $format = $query->param("format");
26 if ( $op eq "export" ) {
27 my $authid = $query->param("authid");
30 my $marc = GetAuthority($authid);
32 if ( $format =~ /marcxml/ ) {
33 $marc = marc2marcxml($marc, 'UTF-8', C4::Context->preference("marcflavour") eq 'UNIMARC' ? 'UNIMARCAUTH' : 'MARC21' );
35 elsif ($format=~ /mads/) {
36 $marc = marc2madsxml($marc);
38 elsif ( $format =~ /marc8/ ) {
39 $marc = changeEncoding( $marc, "MARC", "MARC21", "MARC-8" );
40 $marc = $marc->as_usmarc();
42 elsif ( $format =~ /utf8/ ) {
43 C4::Charset::SetUTF8Flag( $marc, 1 );
44 $marc = $marc->as_usmarc();
47 -type => 'application/octet-stream',
48 -attachment => "auth-$authid.$format"