3 #use warnings; FIXME - Bug 2505
15 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
({
16 template_name
=> "tools/export.tt",
20 flagsrequired
=> { catalogue
=> 1 },
24 my $op=$query->param("op");
25 my $format=$query->param("format");
27 if ($op eq "export") {
28 my $biblionumber = $query->param("bib");
31 my $marc = GetMarcBiblio
({
32 biblionumber
=> $biblionumber,
35 if ($format =~ /endnote/) {
36 $marc = marc2endnote
($marc);
39 elsif ($format =~ /marcxml/) {
40 $marc = marc2marcxml
($marc);
43 elsif ($format=~ /mods/) {
44 $marc = marc2modsxml
($marc);
47 elsif ($format =~ /ris/) {
48 $marc = marc2ris
($marc);
51 elsif ($format =~ /bibtex/) {
52 $marc = marc2bibtex
($marc);
55 elsif ($format =~ /dc$/) {
56 $marc = marc2dcxml
(undef, undef, $biblionumber, $format);
57 $format = "dublin-core.xml";
59 elsif ($format =~ /marc8/) {
60 $marc = changeEncoding
($marc,"MARC","MARC21","MARC-8");
61 $marc = $marc->as_usmarc();
64 elsif ($format =~ /utf8/) {
65 C4
::Charset
::SetUTF8Flag
($marc, 1);
66 $marc = $marc->as_usmarc();
69 elsif ($format =~ /marcstd/) {
70 C4
::Charset
::SetUTF8Flag
($marc,1);
71 ($error, $marc) = marc2marc
($marc, 'marcstd', C4
::Context
->preference('marcflavour'));
74 if ( $format =~ /utf8/ or $format =~ /marcstd/ ) {
75 binmode STDOUT
, ':encoding(UTF-8)';
78 -type
=> 'application/octet-stream',
79 -attachment
=>"bib-$biblionumber.$format");