X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=opac%2Fopac-export.pl;h=e8f7ededc643ad10ff6535a737dc321ddc7057c2;hb=b4d6ad26dc40b2f10c8cdd9d546f60cebfbd4b22;hp=f9d3c253d39b658be7716430bb21dc664278ac14;hpb=8307a1f79d8143e05c734cc750bb420c1ff41e1c;p=srvgit diff --git a/opac/opac-export.pl b/opac/opac-export.pl index f9d3c253d3..e8f7ededc6 100755 --- a/opac/opac-export.pl +++ b/opac/opac-export.pl @@ -35,15 +35,11 @@ my $op=$query->param("op"); my $format=$query->param("format"); if ($op eq "export") { my $biblionumber = $query->param("bib"); - my $dbh=C4::Context->dbh; - my $sth; - if ($biblionumber) { - $sth=$dbh->prepare("SELECT marc FROM biblioitems WHERE biblionumber =?"); - $sth->execute($biblionumber); - } - my $error; - while (my ($marc) = $sth->fetchrow) { - if ($marc){ + my $error; + + if ($biblionumber){ + + my $marc = GetMarcBiblio($biblionumber, 1); if ($format =~ /endnote/) { $marc = marc2endnote($marc); @@ -60,32 +56,34 @@ if ($op eq "export") { } elsif ($format =~ /bibtex/) { $marc = marc2bibtex(C4::Biblio::GetMarcBiblio($biblionumber),$biblionumber); - }elsif ($format =~ /dc/) { - ($error,$marc) = marc2dcxml($marc,1); + } + elsif ($format =~ /dc/) { + ($error,$marc) = marc2dcxml($marc,1); $format = "dublin-core.xml"; } elsif ($format =~ /marc8/) { ($error,$marc) = changeEncoding($marc,"MARC","MARC21","MARC-8"); - if (! $error){ - $marc = $marc->as_usmarc(); - } + if (! $error){ + $marc = $marc->as_usmarc(); + } } elsif ($format =~ /utf8/) { - #default + C4::Charset::SetUTF8Flag($marc,1); + $marc = $marc->as_usmarc(); } - if ($error){ - print $query->header(); - print $query->start_html(); - print "

An error occured

"; - print $error; - print $query->end_html(); - } - else { - print $query->header( - -type => 'application/octet-stream', - -attachment=>"bib-$biblionumber.$format"); - print $marc; - } + + if ($error){ + print $query->header(); + print $query->start_html(); + print "

An error occured

"; + print $error; + print $query->end_html(); + } + else { + print $query->header( + -type => 'application/octet-stream', + -attachment=>"bib-$biblionumber.$format"); + print $marc; } - } + } }