Bug 9218: fix intranet cart email for non english templates
[koha.git] / opac / opac-downloadcart.pl
index ff1b58f..12d6777 100755 (executable)
@@ -22,7 +22,6 @@ use warnings;
 
 use CGI;
 use Encode qw(encode);
-use Switch;
 
 use C4::Auth;
 use C4::Biblio;
@@ -61,19 +60,23 @@ if ($bib_list && $format) {
 
         $output = marc2csv(\@bibs, $format);
 
-    # Other formats
+        # Other formats
     } else {
-       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); }
-           }
-       }
+        foreach my $biblio (@bibs) {
+
+            my $record = GetMarcBiblio($biblio, 1);
+            next unless $record;
+
+            if ($format eq 'iso2709') {
+                $output .= $record->as_usmarc();
+            }
+            elsif ($format eq 'ris') {
+                $output .= marc2ris($record);
+            }
+            elsif ($format eq 'bibtex') {
+                $output .= marc2bibtex($record, $biblio);
+            }
+        }
     }
 
     # If it was a CSV export we change the format after the export so the file extension is fine
@@ -86,7 +89,7 @@ if ($bib_list && $format) {
     print $output;
 
 } else { 
-    $template->param(csv_profiles => GetCsvProfilesLoop());
+    $template->param(csv_profiles => GetCsvProfilesLoop('marc'));
     $template->param(bib_list => $bib_list); 
     output_html_with_http_headers $query, $cookie, $template->output;
 }