Bug 37550: Move item check after error handling

To test:
1 - Grab the sample file on this bug report
2 - perl misc/migration_tools/bulkmarcimport.pl -b --file=spaceditems.pl -v
3 - An exception for 'Duplicate ID' is thrown and script dies
4 - Apply patch
5 - run script again
6 - The script finishes, no items are added, but record is

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 5e15ede505)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2024-08-01 17:37:35 +00:00 committed by Lucas Gass
parent c8cab29919
commit f7402371c0
1 changed files with 3 additions and 1 deletions

View File

@ -613,7 +613,6 @@ RECORD: foreach my $record ( @{$marc_records} ) {
AddItemBatchFromMarc( $record, $record_id, $biblioitemnumber, $framework );
};
my $error_adding = $@;
$record_has_added_items = @{$itemnumbers_ref};
if ($error_adding) {
warn "ERROR: Adding items to bib $record_id failed: $error_adding";
@ -623,6 +622,9 @@ RECORD: foreach my $record ( @{$marc_records} ) {
# the MARC columns in biblioitems were not set.
next RECORD;
}
$record_has_added_items = @{$itemnumbers_ref};
if ( $dedup_barcode && grep { exists $_->{error_code} && $_->{error_code} eq 'duplicate_barcode' }
@$errors_ref )
{