|
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 => 20; |
| 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 360-367
subtest "BatchCommitRecords overlay into framework" => sub {
Link Here
|
| 360 |
is( $biblio->frameworkcode, "QQ", "Framework set on overlay" ); |
360 |
is( $biblio->frameworkcode, "QQ", "Framework set on overlay" ); |
| 361 |
}; |
361 |
}; |
| 362 |
|
362 |
|
|
|
363 |
subtest "Do not adjust biblionumber when replacing items during import" => sub { |
| 364 |
plan tests => 6; |
| 363 |
|
365 |
|
|
|
366 |
my $item1 = $builder->build_sample_item; |
| 367 |
my $item2 = $builder->build_sample_item; |
| 364 |
|
368 |
|
|
|
369 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
| 370 |
|
| 371 |
my $import_item = $builder->build_object({ class => 'Koha::Import::Record::Items', value => { |
| 372 |
marcxml => qq{<?xml version="1.0" encoding="UTF-8"?> |
| 373 |
<collection |
| 374 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 375 |
xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" |
| 376 |
xmlns="http://www.loc.gov/MARC21/slim"> |
| 377 |
|
| 378 |
<record> |
| 379 |
<leader>00000 a </leader> |
| 380 |
<datafield tag="952" ind1=" " ind2=" "> |
| 381 |
<subfield code="a">${\($library->branchcode)}</subfield> |
| 382 |
<subfield code="b">${\($library->branchcode)}</subfield> |
| 383 |
<subfield code="c">GEN</subfield> |
| 384 |
<subfield code="p">${\($item1->barcode)}</subfield> |
| 385 |
<subfield code="y">BK</subfield> |
| 386 |
</datafield> |
| 387 |
</record> |
| 388 |
</collection> |
| 389 |
}, |
| 390 |
}}); |
| 391 |
|
| 392 |
isnt( $item1->homebranch, $library->branchcode, "Item's homebranch is currently not the same as our created branch's branchcode" ); |
| 393 |
|
| 394 |
my ( $num_items_added, $num_items_replaced, $num_items_errored ) = |
| 395 |
C4::ImportBatch::_batchCommitItems( $import_item->import_record_id, $item2->biblionumber, 'replace' ); |
| 396 |
|
| 397 |
$item1->discard_changes(); |
| 398 |
|
| 399 |
is( $num_items_errored, 0, 'Item was replaced' ); |
| 400 |
$import_item->discard_changes(); |
| 401 |
is( $import_item->status, 'imported', 'Import was successful'); |
| 402 |
is( $import_item->import_error, undef, 'No error was reported' ); |
| 403 |
|
| 404 |
is( $item1->biblionumber, $item1->biblioitemnumber, "Item's biblionumber and biblioitemnumber match" ); |
| 405 |
is( $item1->homebranch, $library->branchcode, "Item was overlayed succesfully" ); |
| 406 |
}; |
| 365 |
|
407 |
|
| 366 |
sub get_import_record { |
408 |
sub get_import_record { |
| 367 |
my $id_import_batch = shift; |
409 |
my $id_import_batch = shift; |
| 368 |
- |
|
|