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