View | Details | Raw Unified | Return to bug 12404
Collapse All | Expand All

(-)a/C4/Record.pm (-2 / +2 lines)
Lines 461-467 sub marcrecord2csv { Link Here
461
   # Separating the marcfields from the user-supplied headers
461
   # Separating the marcfields from the user-supplied headers
462
    my @csv_structures;
462
    my @csv_structures;
463
    foreach (@marcfieldsarray) {
463
    foreach (@marcfieldsarray) {
464
        my @result = split('=', $_);
464
        my @result = split('=', $_, 2);
465
        my $content = ( @result == 2 )
465
        my $content = ( @result == 2 )
466
            ? $result[1]
466
            ? $result[1]
467
            : $result[0];
467
            : $result[0];
Lines 515-521 sub marcrecord2csv { Link Here
515
                my $tag = $tags->[0];
515
                my $tag = $tags->[0];
516
                if ( $tag->{subfieldtag} ) {
516
                if ( $tag->{subfieldtag} ) {
517
                    my $query = "SELECT liblibrarian FROM marc_subfield_structure WHERE tagfield=? AND tagsubfield=?";
517
                    my $query = "SELECT liblibrarian FROM marc_subfield_structure WHERE tagfield=? AND tagsubfield=?";
518
                    my @results = $dbh->selectrow_array( $query, {}, $tag->{subfieldtag} );
518
                    my @results = $dbh->selectrow_array( $query, {}, $tag->{fieldtag}, $tag->{subfieldtag} );
519
                    push @marcfieldsheaders, $results[0];
519
                    push @marcfieldsheaders, $results[0];
520
                } else {
520
                } else {
521
                    my $query = "SELECT liblibrarian FROM marc_tag_structure WHERE tagfield=?";
521
                    my $query = "SELECT liblibrarian FROM marc_tag_structure WHERE tagfield=?";
(-)a/t/db_dependent/Record/marcrecord2csv.t (-2 / +10 lines)
Lines 1-7 Link Here
1
#!/usr/bin/perl;
1
#!/usr/bin/perl;
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use Test::More tests => 8;
4
use Test::More tests => 9;
5
use Test::MockModule;
5
use Test::MockModule;
6
use MARC::Record;
6
use MARC::Record;
7
use MARC::Field;
7
use MARC::Field;
Lines 79-84 is( $csv_output, q[Title Link Here
79
"The art of computer programming"
79
"The art of computer programming"
80
], q|TT way: display first subfield a for first field 245 if indicator 1 for field 100 is set| );
80
], q|TT way: display first subfield a for first field 245 if indicator 1 for field 100 is set| );
81
81
82
$csv_content = q|Title=[% IF fields.100.0.indicator.1 == 1 %][% fields.245.0.a.0 %][% END %]|;
83
my $csv_profile_id_7 = insert_csv_profile({ csv_content => $csv_content });
84
85
$csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_7, 1, $csv );
86
is( $csv_output, q[Title
87
"The art of computer programming"
88
], q|TT way: display first subfield a for first field 245 if indicator 1 == 1 for field 100 is set| );
89
90
82
sub insert_csv_profile {
91
sub insert_csv_profile {
83
    my ( $params ) = @_;
92
    my ( $params ) = @_;
84
    my $csv_content = $params->{csv_content};
93
    my $csv_content = $params->{csv_content};
85
- 

Return to bug 12404