use C4::VirtualShelves;
use C4::Record;
use C4::Ris;
+use C4::Csv;
use utf8;
use open qw( :std :utf8);
my $query = new CGI;
my $output;
# retrieve biblios from shelf
+ my $firstpass = 1;
foreach my $biblio (@$items) {
my $biblionumber = $biblio->{biblionumber};
case "iso2709" { $output .= $record->as_usmarc(); }
case "ris" { $output .= marc2ris($record); }
case "bibtex" { $output .= marc2bibtex($record, $biblionumber); }
+ # We're in the case of a csv profile (firstpass is used for headers printing) :
+ case /^\d+$/ { $output .= marc2csv($biblionumber, $format, $firstpass); }
}
+ $firstpass = 0;
}
+ # If it was a CSV export we change the format after the export so the file extension is fine
+ $format = "csv" if ($format =~ m/^\d+$/);
+
print $query->header(
-type => 'application/octet-stream',
-'Content-Transfer-Encoding' => 'binary',
-attachment=>"shelf.$format");
print $output;
-} else {
+} else {
+ $template->param(csv_profiles => GetCsvProfilesLoop());
$template->param(shelfid => $shelfid);
output_html_with_http_headers $query, $cookie, $template->output;
}