Bug 10853: All existing routing to get a CSV should return a MARC csv
authorJonathan Druart <jonathan.druart@biblibre.com>
Mon, 23 Sep 2013 12:58:58 +0000 (14:58 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 11 Oct 2013 02:16:33 +0000 (02:16 +0000)
Test plan:
Verify that existing CSV lists list MARC CSV profiles and not SQL CSV
profiles.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Csv.pm
C4/VirtualShelves/Page.pm
basket/basket.pl
basket/downloadcart.pl
opac/opac-downloadcart.pl
opac/opac-downloadshelf.pl
virtualshelves/downloadshelf.pl

index 13ab1a4..511540c 100644 (file)
--- a/C4/Csv.pm
+++ b/C4/Csv.pm
@@ -98,12 +98,17 @@ sub GetMarcFieldsForCsv {
 
 # Returns informations aboout csv profiles suitable for html templates
 sub GetCsvProfilesLoop {
-   # List of existing profiles
+    my ( $type ) = @_;
+    # List of existing profiles
     my $dbh = C4::Context->dbh;
     my $sth;
     my $query = "SELECT export_format_id, profile FROM export_format";
+    if ( $type ) {
+        $query .= " WHERE type = ?";
+    }
+
     $sth = $dbh->prepare($query);
-    $sth->execute();
+    $sth->execute( $type ? $type : () );
     return $sth->fetchall_arrayref({});
 
 }
index 7756d92..259e12d 100644 (file)
@@ -458,7 +458,7 @@ sub shelfpage {
         shelvesloopall                                                     => [ ( @shelvesloop, @shelveslooppriv ) ],
         numberCanManage                                                    => $numberCanManage,
         "BiblioDefaultView" . C4::Context->preference("BiblioDefaultView") => 1,
-        csv_profiles                                                       => GetCsvProfilesLoop()
+        csv_profiles                                                       => GetCsvProfilesLoop('marc')
     );
     if (   $shelfnumber
         or $shelves
index d33216c..04f28de 100755 (executable)
@@ -121,7 +121,7 @@ my $resultsarray = \@results;
 
 $template->param(
     BIBLIO_RESULTS => $resultsarray,
-    csv_profiles => GetCsvProfilesLoop(),
+    csv_profiles => GetCsvProfilesLoop('marc'),
     bib_list => $bib_list,
 );
 
index 392a3e4..ca64c60 100755 (executable)
@@ -89,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;
 }
index 3a4cdc1..12d6777 100755 (executable)
@@ -89,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;
 }
index 662eb25..e94b76c 100755 (executable)
@@ -94,7 +94,7 @@ if ( ShelfPossibleAction( (defined($borrowernumber) ? $borrowernumber : -1), $sh
         print $output;
 
     } else {
-        $template->param(csv_profiles => GetCsvProfilesLoop());
+        $template->param(csv_profiles => GetCsvProfilesLoop('marc'));
         $template->param(shelfid => $shelfid); 
         output_html_with_http_headers $query, $cookie, $template->output;
     }
index 1f6ddd9..5c59f79 100755 (executable)
@@ -88,7 +88,7 @@ if ($shelfid && $format) {
     print $output;
 }
 else {
-    $template->param(csv_profiles => GetCsvProfilesLoop());
+    $template->param(csv_profiles => GetCsvProfilesLoop('marc'));
     $template->param(shelfid => $shelfid); 
     output_html_with_http_headers $query, $cookie, $template->output;
 }