Lines 36-41
use YAML; #marcrecords2csv
Link Here
|
36 |
use Template; |
36 |
use Template; |
37 |
use Text::CSV::Encoded; #marc2csv |
37 |
use Text::CSV::Encoded; #marc2csv |
38 |
use Koha::SimpleMARC qw(read_field); |
38 |
use Koha::SimpleMARC qw(read_field); |
|
|
39 |
use Koha::CsvProfiles; |
39 |
|
40 |
|
40 |
use vars qw($VERSION @ISA @EXPORT); |
41 |
use vars qw($VERSION @ISA @EXPORT); |
41 |
|
42 |
|
Lines 434-447
sub marcrecord2csv {
Link Here
|
434 |
my $frameworkcode = GetFrameworkCode($biblio); |
435 |
my $frameworkcode = GetFrameworkCode($biblio); |
435 |
|
436 |
|
436 |
# Getting information about the csv profile |
437 |
# Getting information about the csv profile |
437 |
my $profile = GetCsvProfile($id); |
438 |
my $profile = Koha::CsvProfiles->find($id); |
438 |
|
439 |
|
439 |
# Getting output encoding |
440 |
# Getting output encoding |
440 |
my $encoding = $profile->{encoding} || 'utf8'; |
441 |
my $encoding = $profile->encoding || 'utf8'; |
441 |
# Getting separators |
442 |
# Getting separators |
442 |
my $csvseparator = $profile->{csv_separator} || ','; |
443 |
my $csvseparator = $profile->csv_separator || ','; |
443 |
my $fieldseparator = $profile->{field_separator} || '#'; |
444 |
my $fieldseparator = $profile->field_separator || '#'; |
444 |
my $subfieldseparator = $profile->{subfield_separator} || '|'; |
445 |
my $subfieldseparator = $profile->subfield_separator || '|'; |
445 |
|
446 |
|
446 |
# TODO: Be more generic (in case we have to handle other protected chars or more separators) |
447 |
# TODO: Be more generic (in case we have to handle other protected chars or more separators) |
447 |
if ($csvseparator eq '\t') { $csvseparator = "\t" } |
448 |
if ($csvseparator eq '\t') { $csvseparator = "\t" } |
Lines 455-461
sub marcrecord2csv {
Link Here
|
455 |
$csv->sep_char($csvseparator); |
456 |
$csv->sep_char($csvseparator); |
456 |
|
457 |
|
457 |
# Getting the marcfields |
458 |
# Getting the marcfields |
458 |
my $marcfieldslist = $profile->{content}; |
459 |
my $marcfieldslist = $profile->content; |
459 |
|
460 |
|
460 |
# Getting the marcfields as an array |
461 |
# Getting the marcfields as an array |
461 |
my @marcfieldsarray = split('\|', $marcfieldslist); |
462 |
my @marcfieldsarray = split('\|', $marcfieldslist); |