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 => 19; |
4 |
use Test::More tests => 18; |
5 |
use utf8; |
5 |
use utf8; |
6 |
use File::Basename; |
6 |
use File::Basename; |
7 |
use File::Temp qw/tempfile/; |
7 |
use File::Temp qw/tempfile/; |
Lines 88-95
is_deeply( $importbatch1, $sample_import_batch1,
Link Here
|
88 |
"GetImportBatch returns the right informations about $sample_import_batch1" ); |
88 |
"GetImportBatch returns the right informations about $sample_import_batch1" ); |
89 |
|
89 |
|
90 |
my $record = MARC::Record->new; |
90 |
my $record = MARC::Record->new; |
91 |
# FIXME Create another MARC::Record which won't be modified |
|
|
92 |
# AddItemsToImportBiblio will remove the items field from the record passed in parameter. |
93 |
my $original_record = MARC::Record->new; |
91 |
my $original_record = MARC::Record->new; |
94 |
$record->leader('03174nam a2200445 a 4500'); |
92 |
$record->leader('03174nam a2200445 a 4500'); |
95 |
$original_record->leader('03174nam a2200445 a 4500'); |
93 |
$original_record->leader('03174nam a2200445 a 4500'); |
Lines 162-176
my $import_record_id = AddBiblioToBatch( $id_import_batch1, 0, $record, 'utf8',
Link Here
|
162 |
AddItemsToImportBiblio( $id_import_batch1, $import_record_id, $record, 0 ); |
160 |
AddItemsToImportBiblio( $id_import_batch1, $import_record_id, $record, 0 ); |
163 |
|
161 |
|
164 |
my $import_record = Koha::Import::Records->find($import_record_id); |
162 |
my $import_record = Koha::Import::Records->find($import_record_id); |
165 |
my $record_from_import_biblio_with_items = $import_record->get_marc_record({ embed_items => 1 }); |
163 |
my $record_from_import_biblio = $import_record->get_marc_record(); |
166 |
$original_record->leader($record_from_import_biblio_with_items->leader()); |
164 |
|
167 |
is_deeply( $record_from_import_biblio_with_items, $original_record, 'Koha::Import::Record::get_marc_record should return the record with items if specified' ); |
165 |
$original_record->leader($record_from_import_biblio->leader()); |
168 |
my $utf8_field = $record_from_import_biblio_with_items->subfield($item_tag, 'e'); |
166 |
is_deeply( $record_from_import_biblio, $original_record, 'Koha::Import::Record::get_marc_record should return the record in original state' ); |
|
|
167 |
my $utf8_field = $record_from_import_biblio->subfield($item_tag, 'e'); |
169 |
is($utf8_field, 'my edition ❤'); |
168 |
is($utf8_field, 'my edition ❤'); |
170 |
$original_record->delete_fields($original_record->field($item_tag)); #Remove items fields |
|
|
171 |
my $record_from_import_biblio_without_items = $import_record->get_marc_record(); |
172 |
$original_record->leader($record_from_import_biblio_without_items->leader()); |
173 |
is_deeply( $record_from_import_biblio_without_items, $original_record, 'Koha::Import::Record::get_marc_record should return the record without items by default' ); |
174 |
|
169 |
|
175 |
my $another_biblio = $builder->build_sample_biblio; |
170 |
my $another_biblio = $builder->build_sample_biblio; |
176 |
C4::ImportBatch::SetMatchedBiblionumber( $import_record_id, $another_biblio->biblionumber ); |
171 |
C4::ImportBatch::SetMatchedBiblionumber( $import_record_id, $another_biblio->biblionumber ); |
177 |
- |
|
|