Bug 15451: Koha::CsvProfiles - Remove GetCsvProfile
[koha.git] / C4 / Record.pm
index a3c1e8e..dbbde57 100644 (file)
@@ -37,6 +37,7 @@ use Template;
 use Text::CSV::Encoded; #marc2csv
 use Koha::SimpleMARC qw(read_field);
 use Koha::XSLT_Handler;
+use Koha::CsvProfiles;
 use Carp;
 
 use vars qw(@ISA @EXPORT);
@@ -475,14 +476,14 @@ sub marcrecord2csv {
     my $frameworkcode = GetFrameworkCode($biblio);
 
     # Getting information about the csv profile
-    my $profile = GetCsvProfile($id);
+    my $profile = Koha::CsvProfiles->find($id);
 
     # Getting output encoding
-    my $encoding          = $profile->{encoding} || 'utf8';
+    my $encoding          = $profile->encoding || 'utf8';
     # Getting separators
-    my $csvseparator      = $profile->{csv_separator}      || ',';
-    my $fieldseparator    = $profile->{field_separator}    || '#';
-    my $subfieldseparator = $profile->{subfield_separator} || '|';
+    my $csvseparator      = $profile->csv_separator      || ',';
+    my $fieldseparator    = $profile->field_separator    || '#';
+    my $subfieldseparator = $profile->subfield_separator || '|';
 
     # TODO: Be more generic (in case we have to handle other protected chars or more separators)
     if ($csvseparator eq '\t') { $csvseparator = "\t" }
@@ -496,7 +497,7 @@ sub marcrecord2csv {
     $csv->sep_char($csvseparator);
 
     # Getting the marcfields
-    my $marcfieldslist = $profile->{content};
+    my $marcfieldslist = $profile->content;
 
     # Getting the marcfields as an array
     my @marcfieldsarray = split('\|', $marcfieldslist);