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
($biblionumber, 1);
33 if ($format =~ /endnote/) {
34 $marc = marc2endnote
($marc);
37 elsif ($format =~ /marcxml/) {
38 $marc = marc2marcxml
($marc);
41 elsif ($format=~ /mods/) {
42 $marc = marc2modsxml
($marc);
45 elsif ($format =~ /ris/) {
46 $marc = marc2ris
($marc);
49 elsif ($format =~ /bibtex/) {
50 $marc = marc2bibtex
($marc);
53 elsif ($format =~ /dc/) {
54 ($error,$marc) = marc2dcxml
($marc,1);
55 $format = "dublin-core.xml";
57 elsif ($format =~ /marc8/) {
58 $marc = changeEncoding
($marc,"MARC","MARC21","MARC-8");
59 $marc = $marc->as_usmarc();
62 elsif ($format =~ /utf8/) {
63 C4
::Charset
::SetUTF8Flag
($marc, 1);
64 $marc = $marc->as_usmarc();
67 elsif ($format =~ /marcstd/) {
68 C4
::Charset
::SetUTF8Flag
($marc,1);
69 ($error, $marc) = marc2marc
($marc, 'marcstd', C4
::Context
->preference('marcflavour'));
73 -type
=> 'application/octet-stream',
74 -attachment
=>"bib-$biblionumber.$format");