Lines 35-49
my $op=$query->param("op");
Link Here
|
35 |
my $format=$query->param("format"); |
35 |
my $format=$query->param("format"); |
36 |
if ($op eq "export") { |
36 |
if ($op eq "export") { |
37 |
my $biblionumber = $query->param("bib"); |
37 |
my $biblionumber = $query->param("bib"); |
38 |
my $dbh=C4::Context->dbh; |
38 |
my $error; |
39 |
my $sth; |
39 |
|
40 |
if ($biblionumber) { |
40 |
if ($biblionumber){ |
41 |
$sth=$dbh->prepare("SELECT marc FROM biblioitems WHERE biblionumber =?"); |
41 |
|
42 |
$sth->execute($biblionumber); |
42 |
my $marc = GetMarcBiblio($biblionumber, 1); |
43 |
} |
|
|
44 |
my $error; |
45 |
while (my ($marc) = $sth->fetchrow) { |
46 |
if ($marc){ |
47 |
|
43 |
|
48 |
if ($format =~ /endnote/) { |
44 |
if ($format =~ /endnote/) { |
49 |
$marc = marc2endnote($marc); |
45 |
$marc = marc2endnote($marc); |
Lines 60-91
if ($op eq "export") {
Link Here
|
60 |
} |
56 |
} |
61 |
elsif ($format =~ /bibtex/) { |
57 |
elsif ($format =~ /bibtex/) { |
62 |
$marc = marc2bibtex(C4::Biblio::GetMarcBiblio($biblionumber),$biblionumber); |
58 |
$marc = marc2bibtex(C4::Biblio::GetMarcBiblio($biblionumber),$biblionumber); |
63 |
}elsif ($format =~ /dc/) { |
59 |
} |
64 |
($error,$marc) = marc2dcxml($marc,1); |
60 |
elsif ($format =~ /dc/) { |
|
|
61 |
($error,$marc) = marc2dcxml($marc,1); |
65 |
$format = "dublin-core.xml"; |
62 |
$format = "dublin-core.xml"; |
66 |
} |
63 |
} |
67 |
elsif ($format =~ /marc8/) { |
64 |
elsif ($format =~ /marc8/) { |
68 |
($error,$marc) = changeEncoding($marc,"MARC","MARC21","MARC-8"); |
65 |
($error,$marc) = changeEncoding($marc,"MARC","MARC21","MARC-8"); |
69 |
if (! $error){ |
66 |
if (! $error){ |
70 |
$marc = $marc->as_usmarc(); |
67 |
$marc = $marc->as_usmarc(); |
71 |
} |
68 |
} |
72 |
} |
69 |
} |
73 |
elsif ($format =~ /utf8/) { |
70 |
elsif ($format =~ /utf8/) { |
74 |
#default |
71 |
C4::Charset::SetUTF8Flag($marc,1); |
|
|
72 |
$marc = $marc->as_usmarc(); |
75 |
} |
73 |
} |
76 |
if ($error){ |
74 |
|
77 |
print $query->header(); |
75 |
if ($error){ |
78 |
print $query->start_html(); |
76 |
print $query->header(); |
79 |
print "<h1>An error occured </h1>"; |
77 |
print $query->start_html(); |
80 |
print $error; |
78 |
print "<h1>An error occured </h1>"; |
81 |
print $query->end_html(); |
79 |
print $error; |
82 |
} |
80 |
print $query->end_html(); |
83 |
else { |
81 |
} |
84 |
print $query->header( |
82 |
else { |
85 |
-type => 'application/octet-stream', |
83 |
print $query->header( |
86 |
-attachment=>"bib-$biblionumber.$format"); |
84 |
-type => 'application/octet-stream', |
87 |
print $marc; |
85 |
-attachment=>"bib-$biblionumber.$format"); |
88 |
} |
86 |
print $marc; |
89 |
} |
87 |
} |
90 |
} |
88 |
} |
91 |
} |
89 |
} |