|
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 => 12; |
4 |
use Test::More tests => 13; |
| 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 12-17
use C4::Context;
Link Here
|
| 12 |
use C4::Record; |
12 |
use C4::Record; |
| 13 |
use Koha::Database; |
13 |
use Koha::Database; |
| 14 |
|
14 |
|
|
|
15 |
use C4::Items; |
| 16 |
|
| 15 |
use t::lib::TestBuilder; |
17 |
use t::lib::TestBuilder; |
| 16 |
|
18 |
|
| 17 |
my $schema = Koha::Database->new->schema; |
19 |
my $schema = Koha::Database->new->schema; |
|
Lines 48-54
$csv_content = q(245|650);
Link Here
|
| 48 |
my $csv_profile_id_2 = insert_csv_profile({ csv_content => $csv_content }); |
50 |
my $csv_profile_id_2 = insert_csv_profile({ csv_content => $csv_content }); |
| 49 |
|
51 |
|
| 50 |
$csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_2, 1, $csv ); |
52 |
$csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_2, 1, $csv ); |
| 51 |
is( $csv_output, q["TITLE STATEMENT"|"SUBJECT ADDED ENTRY--TOPICAL TERM" |
53 |
is( $csv_output, q["Mention du titre"|Vedette-matière--Sujet |
| 52 |
"The art of computer programming,Donald E. Knuth.,0;The art of another title,Donald E. Knuth. II,1"|"Computer programming.,462;Computer algorithms.,499" |
54 |
"The art of computer programming,Donald E. Knuth.,0;The art of another title,Donald E. Knuth. II,1"|"Computer programming.,462;Computer algorithms.,499" |
| 53 |
], q|normal way: headers retrieved from the DB| ); |
55 |
], q|normal way: headers retrieved from the DB| ); |
| 54 |
|
56 |
|
|
Lines 126-131
is( $csv_output, q[Title|AVs
Link Here
|
| 126 |
|
128 |
|
| 127 |
|
129 |
|
| 128 |
|
130 |
|
|
|
131 |
# Bug 26414 - Unable to export Withdrawn status using CSV profile |
| 132 |
# Test that subfieldtag '0' works in the fieldtag '952' |
| 133 |
my $record2 = new_record(); |
| 134 |
my $frameworkcode2 = q||; |
| 135 |
# We change the barcode of the second item record to prevent an error "duplicate entry" |
| 136 |
my $field = $record->field('952'); |
| 137 |
my $new_field = new MARC::Field('952', ' ', ' ', |
| 138 |
0 => '1', |
| 139 |
p => '3010023918', |
| 140 |
); |
| 141 |
$field->replace_with($new_field); |
| 142 |
# We create another record |
| 143 |
my ( $biblionumber2, $biblioitemnumber2 ) = AddBiblio( $record2, $frameworkcode2 ); |
| 144 |
# We add two item to two record to test fieldtag 952 and subfieldtag 9520 |
| 145 |
my (undef, undef, $itemnumber2) = AddItemFromMarc($record2, $biblionumber); |
| 146 |
my (undef, undef, $itemnumber) = AddItemFromMarc($record, $biblionumber); |
| 147 |
$csv_content = q(Titre=245a|Nom de personne=100a|Statut « Élagué »=9520); |
| 148 |
my $csv_profile_id_10 = insert_csv_profile( {csv_content => $csv_content } ); |
| 149 |
$csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_10, 1, $csv); |
| 150 |
is($csv_output, q[Titre|"Nom de personne"|"Statut « Élagué »" |
| 151 |
"The art of computer programming,The art of another title"|"Knuth, Donald Ervin"|Withdrawn;Withdrawn |
| 152 |
], q|subfieldtag 952$0 is not working, should return 'Withdrawn'| |
| 153 |
); |
| 154 |
|
| 155 |
# End Bug 26414 |
| 156 |
|
| 157 |
|
| 129 |
sub insert_csv_profile { |
158 |
sub insert_csv_profile { |
| 130 |
my ( $params ) = @_; |
159 |
my ( $params ) = @_; |
| 131 |
my $csv_content = $params->{csv_content}; |
160 |
my $csv_content = $params->{csv_content}; |
|
Lines 172-177
sub new_record {
Link Here
|
| 172 |
), |
201 |
), |
| 173 |
MARC::Field->new( |
202 |
MARC::Field->new( |
| 174 |
952, ' ', ' ', |
203 |
952, ' ', ' ', |
|
|
204 |
0 => '1', |
| 175 |
p => '3010023917', |
205 |
p => '3010023917', |
| 176 |
y => 'BK', |
206 |
y => 'BK', |
| 177 |
c => 'GEN', |
207 |
c => 'GEN', |
| 178 |
- |
|
|