@@ -, +, @@ --- C4/Csv.pm | 19 ------------------- basket/basket.pl | 8 ++++---- basket/downloadcart.pl | 8 +++++--- opac/opac-downloadcart.pl | 8 +++++--- opac/opac-downloadshelf.pl | 6 +++--- virtualshelves/downloadshelf.pl | 6 +++--- virtualshelves/shelves.pl | 4 +++- 7 files changed, 23 insertions(+), 36 deletions(-) --- a/C4/Csv.pm +++ a/C4/Csv.pm @@ -34,7 +34,6 @@ use vars qw(@ISA @EXPORT); &GetCsvProfiles &GetCsvProfile &GetCsvProfileId - &GetCsvProfilesLoop &GetMarcFieldsForCsv ); @@ -94,23 +93,5 @@ sub GetMarcFieldsForCsv { } -# Returns informations aboout csv profiles suitable for html templates -sub GetCsvProfilesLoop { - 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( $type ? $type : () ); - return $sth->fetchall_arrayref({}); - -} - - 1; --- a/basket/basket.pl +++ a/basket/basket.pl @@ -16,15 +16,15 @@ # along with Koha; if not, see . -use strict; -use warnings; +use Modern::Perl; use CGI qw ( -utf8 ); use C4::Koha; use C4::Biblio; use C4::Items; use C4::Auth; use C4::Output; -use C4::Csv; + +use Koha::CsvProfiles; my $query = new CGI; @@ -121,7 +121,7 @@ my $resultsarray = \@results; $template->param( BIBLIO_RESULTS => $resultsarray, - csv_profiles => GetCsvProfilesLoop('marc'), + csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ], bib_list => $bib_list, ); --- a/basket/downloadcart.pl +++ a/basket/downloadcart.pl @@ -17,8 +17,7 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -use warnings; +use Modern::Perl; use CGI qw ( -utf8 ); use Encode qw(encode); @@ -30,6 +29,9 @@ use C4::Output; use C4::Record; use C4::Ris; use C4::Csv; + +use Koha::CsvProfiles; + use utf8; my $query = new CGI; @@ -89,7 +91,7 @@ if ($bib_list && $format) { print $output; } else { - $template->param(csv_profiles => GetCsvProfilesLoop('marc')); + $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); $template->param(bib_list => $bib_list); output_html_with_http_headers $query, $cookie, $template->output; } --- a/opac/opac-downloadcart.pl +++ a/opac/opac-downloadcart.pl @@ -17,8 +17,7 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -use warnings; +use Modern::Perl; use CGI qw ( -utf8 ); use Encode qw(encode); @@ -30,6 +29,9 @@ use C4::Output; use C4::Record; use C4::Ris; use C4::Csv; + +use Koha::CsvProfiles; + use utf8; my $query = new CGI; @@ -95,7 +97,7 @@ if ($bib_list && $format) { print $output; } else { - $template->param(csv_profiles => GetCsvProfilesLoop('marc')); + $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); $template->param(bib_list => $bib_list); output_html_with_http_headers $query, $cookie, $template->output; } --- a/opac/opac-downloadshelf.pl +++ a/opac/opac-downloadshelf.pl @@ -17,8 +17,7 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -use warnings; +use Modern::Perl; use CGI qw ( -utf8 ); use Encode qw(encode); @@ -31,6 +30,7 @@ use C4::Record; use C4::Ris; use C4::Csv; +use Koha::CsvProfiles; use Koha::Virtualshelves; use utf8; @@ -118,7 +118,7 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { } else { $template->param(fullpage => 1); } - $template->param(csv_profiles => GetCsvProfilesLoop('marc')); + $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); $template->param( shelf => $shelf ); output_html_with_http_headers $query, $cookie, $template->output; } --- a/virtualshelves/downloadshelf.pl +++ a/virtualshelves/downloadshelf.pl @@ -17,8 +17,7 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -use warnings; +use Modern::Perl; use CGI qw ( -utf8 ); use Encode qw(encode); @@ -31,6 +30,7 @@ use C4::Record; use C4::Ris; use C4::Csv; +use Koha::CsvProfiles; use Koha::Virtualshelves; use utf8; @@ -101,7 +101,7 @@ if ($shelfid && $format) { $format = "csv" if ($format =~ m/^\d+$/); } else { - $template->param(csv_profiles => GetCsvProfilesLoop('marc')); + $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); $template->param(shelfid => $shelfid); } $template->param( messages => \@messages ); --- a/virtualshelves/shelves.pl +++ a/virtualshelves/shelves.pl @@ -27,6 +27,8 @@ use C4::Items; use C4::Members; use C4::Output; use C4::XSLT; + +use Koha::CsvProfiles; use Koha::Virtualshelves; my $query = new CGI; @@ -309,7 +311,7 @@ $template->param( messages => \@messages, category => $category, print => scalar $query->param('print') || 0, - csv_profiles => GetCsvProfilesLoop('marc'), + csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ], ); output_html_with_http_headers $query, $cookie, $template->output; --