Lines 1-5
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
use HTML::Template::Pro; |
2 |
|
|
|
3 |
# Parts Copyright Catalyst IT 2011 |
4 |
# |
5 |
# This file is part of Koha. |
6 |
# |
7 |
# Koha is free software; you can redistribute it and/or modify it under the |
8 |
# terms of the GNU General Public License as published by the Free Software |
9 |
# Foundation; either version 2 of the License, or (at your option) any later |
10 |
# version. |
11 |
# |
12 |
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
13 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
14 |
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
15 |
# |
16 |
# You should have received a copy of the GNU General Public License along with |
17 |
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, |
18 |
# Suite 330, Boston, MA 02111-1307 USA |
19 |
# |
20 |
|
21 |
|
3 |
use strict; |
22 |
use strict; |
4 |
use warnings; |
23 |
use warnings; |
5 |
|
24 |
|
Lines 22-27
if ($op eq "export") {
Link Here
|
22 |
$sth=$dbh->prepare("SELECT marc FROM biblioitems WHERE biblionumber =?"); |
41 |
$sth=$dbh->prepare("SELECT marc FROM biblioitems WHERE biblionumber =?"); |
23 |
$sth->execute($biblionumber); |
42 |
$sth->execute($biblionumber); |
24 |
} |
43 |
} |
|
|
44 |
my $error; |
25 |
while (my ($marc) = $sth->fetchrow) { |
45 |
while (my ($marc) = $sth->fetchrow) { |
26 |
if ($marc){ |
46 |
if ($marc){ |
27 |
|
47 |
|
Lines 41-61
if ($op eq "export") {
Link Here
|
41 |
elsif ($format =~ /bibtex/) { |
61 |
elsif ($format =~ /bibtex/) { |
42 |
$marc = marc2bibtex(C4::Biblio::GetMarcBiblio($biblionumber),$biblionumber); |
62 |
$marc = marc2bibtex(C4::Biblio::GetMarcBiblio($biblionumber),$biblionumber); |
43 |
}elsif ($format =~ /dc/) { |
63 |
}elsif ($format =~ /dc/) { |
44 |
my $error; |
64 |
($error,$marc) = marc2dcxml($marc,1); |
45 |
($error,$marc) = marc2dcxml($marc,1); |
|
|
46 |
$format = "dublin-core.xml"; |
65 |
$format = "dublin-core.xml"; |
47 |
} |
66 |
} |
48 |
elsif ($format =~ /marc8/) { |
67 |
elsif ($format =~ /marc8/) { |
49 |
$marc = changeEncoding($marc,"MARC","MARC21","MARC-8"); |
68 |
($error,$marc) = changeEncoding($marc,"MARC","MARC21","MARC-8"); |
50 |
$marc = $marc->as_usmarc(); |
69 |
if (! $error){ |
|
|
70 |
$marc = $marc->as_usmarc(); |
71 |
} |
51 |
} |
72 |
} |
52 |
elsif ($format =~ /utf8/) { |
73 |
elsif ($format =~ /utf8/) { |
53 |
#default |
74 |
#default |
54 |
} |
75 |
} |
55 |
print $query->header( |
76 |
if ($error){ |
|
|
77 |
print $query->header(); |
78 |
print $query->start_html(); |
79 |
print "<h1>An error occured </h1>"; |
80 |
print $error; |
81 |
print $query->end_html(); |
82 |
} |
83 |
else { |
84 |
print $query->header( |
56 |
-type => 'application/octet-stream', |
85 |
-type => 'application/octet-stream', |
57 |
-attachment=>"bib-$biblionumber.$format"); |
86 |
-attachment=>"bib-$biblionumber.$format"); |
58 |
print $marc; |
87 |
print $marc; |
|
|
88 |
} |
59 |
} |
89 |
} |
60 |
} |
90 |
} |
61 |
} |
91 |
} |
62 |
- |
|
|