- foreach my $biblio (@bibs) {
-
- my $record = GetMarcBiblio($biblio);
- next unless $record;
-
- switch ($format) {
- case "iso2709" { $output .= $record->as_usmarc(); }
- case "ris" { $output .= marc2ris($record); }
- case "bibtex" { $output .= marc2bibtex($record, $biblio); }
- }
- }
+ my $record_processor = Koha::RecordProcessor->new({
+ filters => 'ViewPolicy'
+ });
+ foreach my $biblio (@bibs) {
+
+ my $record = GetMarcBiblio({
+ biblionumber => $biblio,
+ embed_items => 1,
+ opac => 1,
+ borcat => $borcat });
+ my $framework = &GetFrameworkCode( $biblio );
+ $record_processor->options({
+ interface => 'opac',
+ frameworkcode => $framework
+ });
+ $record_processor->process($record);
+
+ next unless $record;
+
+ if ($format eq 'iso2709') {
+ #NOTE: If we don't explicitly UTF-8 encode the output,
+ #the browser will guess the encoding, and it won't always choose UTF-8.
+ $output .= encode("UTF-8", $record->as_usmarc()) // q{};
+ }
+ elsif ($format eq 'ris') {
+ $output .= marc2ris($record);
+ }
+ elsif ($format eq 'bibtex') {
+ $output .= marc2bibtex($record, $biblio);
+ }
+ elsif ( $format eq 'isbd' ) {
+ my $framework = GetFrameworkCode( $biblio );
+ $output .= GetISBDView({
+ 'record' => $record,
+ 'template' => 'opac',
+ 'framework' => $framework,
+ });
+ $extension = "txt";
+ $type = "text/plain";
+ }
+ }