|
Lines 232-238
my $import_batch = C4::ImportBatch::GetImportBatch($id_import_batch3);
Link Here
|
| 232 |
is( $import_batch, undef, "Batch 3 has been deleted" ); |
232 |
is( $import_batch, undef, "Batch 3 has been deleted" ); |
| 233 |
|
233 |
|
| 234 |
subtest "_batchCommitItems" => sub { |
234 |
subtest "_batchCommitItems" => sub { |
| 235 |
plan tests => 3; |
235 |
plan tests => 6; |
| 236 |
|
236 |
|
| 237 |
my $exist_item = $builder->build_sample_item; |
237 |
my $exist_item = $builder->build_sample_item; |
| 238 |
my $import_item = $builder->build_object( |
238 |
my $import_item = $builder->build_object( |
|
Lines 270-275
subtest "_batchCommitItems" => sub {
Link Here
|
| 270 |
$import_item->import_error, 'duplicate item barcode', |
270 |
$import_item->import_error, 'duplicate item barcode', |
| 271 |
'Error correctly set when import item has duplicate barcode and action always_add' |
271 |
'Error correctly set when import item has duplicate barcode and action always_add' |
| 272 |
); |
272 |
); |
|
|
273 |
|
| 274 |
$import_item = $builder->build_object({ class => 'Koha::Import::Record::Items', value => { |
| 275 |
marcxml => q{<?xml version="1.0" encoding="UTF-8"?> |
| 276 |
<collection |
| 277 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 278 |
xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" |
| 279 |
xmlns="http://www.loc.gov/MARC21/slim"> |
| 280 |
|
| 281 |
<record> |
| 282 |
<leader>00000 a </leader> |
| 283 |
<datafield tag="952" ind1=" " ind2=" "> |
| 284 |
<subfield code="a">WBRC</subfield> |
| 285 |
<subfield code="b">WBRC</subfield> |
| 286 |
<subfield code="c">GEN</subfield> |
| 287 |
<subfield code="p">BCDETEST</subfield> |
| 288 |
<subfield code="y">BK</subfield> |
| 289 |
</datafield> |
| 290 |
</record> |
| 291 |
</collection> |
| 292 |
}, |
| 293 |
}}); |
| 294 |
|
| 295 |
( $num_items_added, $num_items_replaced, $num_items_errored ) = |
| 296 |
C4::ImportBatch::_batchCommitItems( $import_item->import_record_id, 32, 'always_add',64 ); |
| 297 |
is( $num_items_errored, 1, "Item with wrong branchcode fails when action always_add" ); |
| 298 |
$import_item->discard_changes(); |
| 299 |
is( $import_item->status, 'error', "Import item marked as error when wrong branchcode detected and action always_add"); |
| 300 |
is( $import_item->import_error, 'Branch code WBRC missing', 'Error correctly set when import item has a wrong branchcode detected and action always_add' ); |
| 273 |
}; |
301 |
}; |
| 274 |
|
302 |
|
| 275 |
subtest "RecordsFromMarcPlugin" => sub { |
303 |
subtest "RecordsFromMarcPlugin" => sub { |
| 276 |
- |
|
|