3 #use warnings; FIXME - Bug 2505
14 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
({
15 template_name
=> "tools/export.tt",
19 flagsrequired
=> { tools
=> 'export_catalog' },
23 my $op=$query->param("op");
24 my $format=$query->param("format");
26 if ($op eq "export") {
27 my $biblionumber = $query->param("bib");
30 my $marc = GetMarcBiblio
($biblionumber, 1);
32 if ($format =~ /endnote/) {
33 $marc = marc2endnote
($marc);
36 elsif ($format =~ /marcxml/) {
37 $marc = marc2marcxml
($marc);
39 elsif ($format=~ /mods/) {
40 $marc = marc2modsxml
($marc);
42 elsif ($format =~ /dc/) {
43 ($error,$marc) = marc2dcxml
($marc,1);
44 $format = "dublin-core.xml";
46 elsif ($format =~ /marc8/) {
47 $marc = changeEncoding
($marc,"MARC","MARC21","MARC-8");
48 $marc = $marc->as_usmarc();
50 elsif ($format =~ /utf8/) {
51 C4
::Charset
::SetUTF8Flag
($marc, 1);
52 $marc = $marc->as_usmarc();
54 elsif ($format =~ /marcstd/) {
55 C4
::Charset
::SetUTF8Flag
($marc,1);
56 ($error, $marc) = marc2marc
($marc, 'marcstd', C4
::Context
->preference('marcflavour'));
59 -type
=> 'application/octet-stream',
60 -attachment
=>"bib-$biblionumber.$format");