X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=virtualshelves%2Fdownloadshelf.pl;h=1d3e87cd8b11c3fb49ddce1ce2e351aa1df2130e;hb=0268a58e16eace3c8721396e6dcf1147d4d71e88;hp=f75d2d46f5affb2e15070e5dedbc3ca8283e5b7d;hpb=b40d4052b9ebb6139d43c6155e13c4e6497cac5d;p=koha.git diff --git a/virtualshelves/downloadshelf.pl b/virtualshelves/downloadshelf.pl index f75d2d46f5..1d3e87cd8b 100755 --- a/virtualshelves/downloadshelf.pl +++ b/virtualshelves/downloadshelf.pl @@ -57,21 +57,27 @@ if ($shelfid && $format) { my $marcflavour = C4::Context->preference('marcflavour'); my $output; - # retrieve biblios from shelf - my $firstpass = 1; - foreach my $biblio (@$items) { - my $biblionumber = $biblio->{biblionumber}; + # CSV + if ($format =~ /^\d+$/) { + my @biblios; + foreach (@$items) { + push @biblios, $_->{biblionumber}; + } + $output = marc2csv(\@biblios, $format); + + # Other formats + } else { + foreach my $biblio (@$items) { + my $biblionumber = $biblio->{biblionumber}; - my $record = GetMarcBiblio($biblionumber); + my $record = GetMarcBiblio($biblionumber); - switch ($format) { - 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); } + switch ($format) { + case "iso2709" { $output .= $record->as_usmarc(); } + case "ris" { $output .= marc2ris($record); } + case "bibtex" { $output .= marc2bibtex($record, $biblionumber); } + } } - $firstpass = 0; } # If it was a CSV export we change the format after the export so the file extension is fine