7 use C4
::AuthoritiesMarc
;
11 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
13 template_name
=> "tools/export.tt",
17 flagsrequired
=> { catalogue
=> 1 },
22 my $op = $query->param("op");
23 my $format = $query->param("format");
25 if ( $op eq "export" ) {
26 my $authid = $query->param("authid");
29 my $marc = GetAuthority
($authid);
31 if ( $format =~ /marcxml/ ) {
32 $marc = marc2marcxml
($marc, 'UTF-8', C4
::Context
->preference("marcflavour") eq 'UNIMARC' ?
'UNIMARCAUTH' : 'MARC21' );
34 elsif ($format=~ /mads/) {
35 $marc = marc2madsxml
($marc);
37 elsif ( $format =~ /marc8/ ) {
38 $marc = changeEncoding
( $marc, "MARC", "MARC21", "MARC-8" );
39 $marc = $marc->as_usmarc();
41 elsif ( $format =~ /utf8/ ) {
42 C4
::Charset
::SetUTF8Flag
( $marc, 1 );
43 $marc = $marc->as_usmarc();
46 -type
=> 'application/octet-stream',
47 -attachment
=> "auth-$authid.$format"