From 0a99f466a9f2f573f356e1a452328fb9b9df0f5f Mon Sep 17 00:00:00 2001
From: Josef Moravec <josef.moravec@gmail.com>
Date: Wed, 12 Oct 2016 08:36:22 +0200
Subject: [PATCH] Bug 8612 - Followup - use Koha::CsvProfile[s] module (see bug
 15451)

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
---
 C4/Acquisition.pm | 9 +++++----
 acqui/basket.pl   | 4 ++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
index aec8425..0ed9b54 100644
--- a/C4/Acquisition.pm
+++ b/C4/Acquisition.pm
@@ -32,6 +32,7 @@ use Koha::Acquisition::Order;
 use Koha::Acquisition::Bookseller;
 use Koha::Number::Price;
 use Koha::Libraries;
+use Koha::CsvProfiles;
 
 use C4::Koha;
 
@@ -286,11 +287,11 @@ sub GetBasketAsCSV {
     my $template = C4::Templates::gettemplate("acqui/csv/basket.tt", "intranet", $cgi);
     my @rows;
     if ($csv_profile_id) {
-        my $csv_profile = C4::Csv::GetCsvProfile( $csv_profile_id );
+        my $csv_profile = Koha::CsvProfiles->find( $csv_profile_id );
         die "There is no valid csv profile given" unless $csv_profile;
 
-        my $csv = Text::CSV_XS->new({'quote_char'=>'"','escape_char'=>'"','sep_char'=>$csv_profile->{csv_separator},'binary'=>1});
-        my $csv_profile_content = $csv_profile->{content};
+        my $csv = Text::CSV_XS->new({'quote_char'=>'"','escape_char'=>'"','sep_char'=>$csv_profile->csv_separator,'binary'=>1});
+        my $csv_profile_content = $csv_profile->content;
         my ( @headers, @fields );
         while ( $csv_profile_content =~ /
             ([^=]+) # header
@@ -321,7 +322,7 @@ sub GetBasketAsCSV {
             }
             push @rows, \@row;
         }
-        my $content = join( $csv_profile->{csv_separator}, @headers ) . "\n";
+        my $content = join( $csv_profile->csv_separator, @headers ) . "\n";
         for my $row ( @rows ) {
             $csv->combine(@$row);
             my $string = $csv->string;
diff --git a/acqui/basket.pl b/acqui/basket.pl
index f5739e2..2bbf42d 100755
--- a/acqui/basket.pl
+++ b/acqui/basket.pl
@@ -33,12 +33,12 @@ use C4::Biblio;
 use C4::Members qw/GetMember/;  #needed for permissions checking for changing basketgroup of a basket
 use C4::Items;
 use C4::Suggestions;
-use C4::Csv;
 use Koha::Libraries;
 use C4::Letters qw/SendAlerts/;
 use Date::Calc qw/Add_Delta_Days/;
 use Koha::Database;
 use Koha::EDI qw( create_edi_order get_edifact_ean );
+use Koha::CsvProfiles;
 
 =head1 NAME
 
@@ -424,7 +424,7 @@ if ( $op eq 'list' ) {
         unclosable           => @orders ? $basket->{is_standing} : 1,
         has_budgets          => $has_budgets,
         duplinbatch          => $duplinbatch,
-        csv_profiles         => C4::Csv::GetCsvProfiles( "sql" ),
+        csv_profiles         => [ Koha::CsvProfiles->search({ type => 'sql' }) ],
     );
 }
 
-- 
2.1.4