Lines 126-159
is( $csv_output, q[Title|AVs
Link Here
|
126 |
], q|TT way: display first subfield a for first field 245 if indicator 1 == 1 for field 100 is set| |
126 |
], q|TT way: display first subfield a for first field 245 if indicator 1 == 1 for field 100 is set| |
127 |
); |
127 |
); |
128 |
|
128 |
|
129 |
|
129 |
subtest 'Test for subfields 0' => sub { |
130 |
|
130 |
plan tests => 1; |
131 |
# Bug 26414 - Unable to export Withdrawn status using CSV profile |
131 |
|
132 |
# Test that subfieldtag '0' works in the fieldtag '952' |
132 |
my $record2 = new_record(); |
133 |
my $record2 = new_record(); |
133 |
my $frameworkcode2 = q||; |
134 |
my $frameworkcode2 = q||; |
134 |
|
135 |
# We change the barcode of the second item record to prevent an error "duplicate entry" |
135 |
# We change the barcode of the second item record to prevent an error "duplicate entry" |
136 |
my $field = $record->field('952'); |
136 |
my $field = $record->field('952'); |
137 |
my $new_field = new MARC::Field('952', ' ', ' ', |
137 |
my $new_field = new MARC::Field( |
138 |
0 => '1', |
138 |
'952', ' ', ' ', |
139 |
p => '3010023918', |
139 |
0 => '1', |
140 |
); |
140 |
p => '3010023918', |
141 |
$field->replace_with($new_field); |
141 |
); |
142 |
# We create another record |
142 |
$field->replace_with($new_field); |
143 |
my ( $biblionumber2, $biblioitemnumber2 ) = AddBiblio( $record2, $frameworkcode2 ); |
143 |
|
144 |
# We add two item to two record to test fieldtag 952 and subfieldtag 9520 |
144 |
# We create another record |
145 |
my (undef, undef, $itemnumber2) = AddItemFromMarc($record2, $biblionumber); |
145 |
my ( $biblionumber2, $biblioitemnumber2 ) = AddBiblio( $record2, $frameworkcode2 ); |
146 |
my (undef, undef, $itemnumber) = AddItemFromMarc($record, $biblionumber); |
146 |
|
147 |
$csv_content = q(Titre=245a|Nom de personne=100a|Statut « Élagué »=9520); |
147 |
# We add two item to two record to test fieldtag 952 and subfieldtag 9520 |
148 |
my $csv_profile_id_10 = insert_csv_profile( {csv_content => $csv_content } ); |
148 |
my ( undef, undef, $itemnumber2 ) = AddItemFromMarc( $record2, $biblionumber ); |
149 |
$csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_10, 1, $csv); |
149 |
my ( undef, undef, $itemnumber ) = AddItemFromMarc( $record, $biblionumber ); |
150 |
is($csv_output, q[Titre|"Nom de personne"|"Statut « Élagué »" |
150 |
$csv_content = q(Titre=245a|Nom de personne=100a|Statut « Élagué »=9520); |
151 |
"The art of computer programming,The art of another title"|"Knuth, Donald Ervin"|Withdrawn;Withdrawn |
151 |
my $csv_profile_id_10 = insert_csv_profile( { csv_content => $csv_content } ); |
152 |
], q|subfieldtag 952$0 is not working, should return 'Withdrawn'| |
152 |
$csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_10, 1, $csv ); |
153 |
); |
153 |
is_deeply( |
154 |
|
154 |
[ split "\n", $csv_output ], |
155 |
# End Bug 26414 |
155 |
[ |
156 |
|
156 |
q[Titre|"Nom de personne"|"Statut « Élagué »"], |
|
|
157 |
q["The art of computer programming,The art of another title"|"Knuth, Donald Ervin"|Withdrawn;Withdrawn], |
158 |
], |
159 |
"subfieldtag 952$0 is not working, should return 'Withdrawn'" |
160 |
); |
161 |
}; |
157 |
|
162 |
|
158 |
sub insert_csv_profile { |
163 |
sub insert_csv_profile { |
159 |
my ( $params ) = @_; |
164 |
my ( $params ) = @_; |
160 |
- |
|
|