Final batch of POD cleanups.
[koha.git] / opac / opac-export.pl
blob4c53aff006eadcc0fe0362c89877235ce4a14932
1 #!/usr/bin/perl
2 use HTML::Template::Pro;
3 use strict;
4 use warnings;
6 use C4::Record;
7 use C4::Auth;
8 use C4::Output;
9 use C4::Biblio;
10 use CGI;
11 use C4::Auth;
12 use C4::Ris;
14 my $query = new CGI;
15 my $op=$query->param("op");
16 my $format=$query->param("format");
17 if ($op eq "export") {
18 my $biblionumber = $query->param("bib");
19 my $dbh=C4::Context->dbh;
20 my $sth;
21 if ($biblionumber) {
22 $sth=$dbh->prepare("SELECT marc FROM biblioitems WHERE biblionumber =?");
23 $sth->execute($biblionumber);
25 while (my ($marc) = $sth->fetchrow) {
26 if ($marc){
28 if ($format =~ /endnote/) {
29 $marc = marc2endnote($marc);
30 $format = 'endnote';
32 elsif ($format =~ /marcxml/) {
33 $marc = marc2marcxml($marc);
35 elsif ($format=~ /mods/) {
36 $marc = marc2modsxml($marc);
38 elsif ($format =~ /ris/) {
39 $marc = marc2ris(MARC::Record->new_from_usmarc($marc));
41 elsif ($format =~ /bibtex/) {
42 $marc = marc2bibtex(C4::Biblio::GetMarcBiblio($biblionumber),$biblionumber);
43 }elsif ($format =~ /dc/) {
44 my $error;
45 ($error,$marc) = marc2dcxml($marc,1);
46 $format = "dublin-core.xml";
48 elsif ($format =~ /marc8/) {
49 $marc = changeEncoding($marc,"MARC","MARC21","MARC-8");
50 $marc = $marc->as_usmarc();
52 elsif ($format =~ /utf8/) {
53 #default
55 print $query->header(
56 -type => 'application/octet-stream',
57 -attachment=>"bib-$biblionumber.$format");
58 print $marc;