|
Lines 216-222
my $import_batch = C4::ImportBatch::GetImportBatch( $id_import_batch3 );
Link Here
|
| 216 |
is( $import_batch, undef, "Batch 3 has been deleted"); |
216 |
is( $import_batch, undef, "Batch 3 has been deleted"); |
| 217 |
|
217 |
|
| 218 |
subtest "_batchCommitItems" => sub { |
218 |
subtest "_batchCommitItems" => sub { |
| 219 |
plan tests => 3; |
219 |
plan tests => 6; |
| 220 |
|
220 |
|
| 221 |
my $exist_item = $builder->build_sample_item; |
221 |
my $exist_item = $builder->build_sample_item; |
| 222 |
my $import_item = $builder->build_object({ class => 'Koha::Import::Record::Items', value => { |
222 |
my $import_item = $builder->build_object({ class => 'Koha::Import::Record::Items', value => { |
|
Lines 246-251
subtest "_batchCommitItems" => sub {
Link Here
|
| 246 |
$import_item->discard_changes(); |
246 |
$import_item->discard_changes(); |
| 247 |
is( $import_item->status, 'error', "Import item marked as error when duplicate barcode and action always_add"); |
247 |
is( $import_item->status, 'error', "Import item marked as error when duplicate barcode and action always_add"); |
| 248 |
is( $import_item->import_error, 'duplicate item barcode', 'Error correctly set when import item has duplicate barcode and action always_add' ); |
248 |
is( $import_item->import_error, 'duplicate item barcode', 'Error correctly set when import item has duplicate barcode and action always_add' ); |
|
|
249 |
|
| 250 |
$import_item = $builder->build_object({ class => 'Koha::Import::Record::Items', value => { |
| 251 |
marcxml => q{<?xml version="1.0" encoding="UTF-8"?> |
| 252 |
<collection |
| 253 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 254 |
xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" |
| 255 |
xmlns="http://www.loc.gov/MARC21/slim"> |
| 256 |
|
| 257 |
<record> |
| 258 |
<leader>00000 a </leader> |
| 259 |
<datafield tag="952" ind1=" " ind2=" "> |
| 260 |
<subfield code="a">WBRC</subfield> |
| 261 |
<subfield code="b">WBRC</subfield> |
| 262 |
<subfield code="c">GEN</subfield> |
| 263 |
<subfield code="p">BCDETEST</subfield> |
| 264 |
<subfield code="y">BK</subfield> |
| 265 |
</datafield> |
| 266 |
</record> |
| 267 |
</collection> |
| 268 |
}, |
| 269 |
}}); |
| 270 |
|
| 271 |
( $num_items_added, $num_items_replaced, $num_items_errored ) = |
| 272 |
C4::ImportBatch::_batchCommitItems( $import_item->import_record_id, 32, 'always_add',64 ); |
| 273 |
is( $num_items_errored, 1, "Item with wrong branchcode fails when action always_add" ); |
| 274 |
$import_item->discard_changes(); |
| 275 |
is( $import_item->status, 'error', "Import item marked as error when wrong branchcode detected and action always_add"); |
| 276 |
is( $import_item->import_error, 'Branch code WBRC missing', 'Error correctly set when import item has a wrong branchcode detected and action always_add' ); |
| 249 |
}; |
277 |
}; |
| 250 |
|
278 |
|
| 251 |
subtest "RecordsFromMarcPlugin" => sub { |
279 |
subtest "RecordsFromMarcPlugin" => sub { |
| 252 |
- |
|
|