View | Details | Raw Unified | Return to bug 29440
Collapse All | Expand All

(-)a/misc/migration_tools/bulkmarcimport.pl (-9 / +10 lines)
Lines 578-586 RECORD: foreach my $record (@{$marc_records}) { Link Here
578
                    # the MARC columns in biblioitems were not set.
578
                    # the MARC columns in biblioitems were not set.
579
                    next RECORD;
579
                    next RECORD;
580
                }
580
                }
581
                else {
582
                    printlog({ id => $record_id, op => "insert items", status => "ok" }) if ($logfile);
583
                }
584
                if ($dedup_barcode && grep { exists $_->{error_code} && $_->{error_code} eq 'duplicate_barcode' } @$errors_ref) {
581
                if ($dedup_barcode && grep { exists $_->{error_code} && $_->{error_code} eq 'duplicate_barcode' } @$errors_ref) {
585
                    # Find the record called 'barcode'
582
                    # Find the record called 'barcode'
586
                    my ($tag, $sub) = C4::Biblio::GetMarcFromKohaField('items.barcode');
583
                    my ($tag, $sub) = C4::Biblio::GetMarcFromKohaField('items.barcode');
Lines 611-618 RECORD: foreach my $record (@{$marc_records}) { Link Here
611
                    }
608
                    }
612
                    # Now re-add the record as before, adding errors to the prev list
609
                    # Now re-add the record as before, adding errors to the prev list
613
                    my $more_errors;
610
                    my $more_errors;
614
                    eval { ($itemnumbers_ref, $more_errors) = AddItemBatchFromMarc($record, $record_id, $biblioitemnumber, ''); };
611
                    eval { ($itemnumbers_ref, $more_errors) =
615
                    $record_has_added_items ||= @{$itemnumbers_ref};
612
                        AddItemBatchFromMarc($record, $record_id, $biblioitemnumber, ''); };
616
                    if ($@) {
613
                    if ($@) {
617
                        warn "ERROR: Adding items to bib $record_id failed: $@\n";
614
                        warn "ERROR: Adding items to bib $record_id failed: $@\n";
618
                        printlog({ id => $record_id, op => "insert items", status => "ERROR" }) if ($logfile);
615
                        printlog({ id => $record_id, op => "insert items", status => "ERROR" }) if ($logfile);
Lines 624-634 RECORD: foreach my $record (@{$marc_records}) { Link Here
624
                        ModBiblioMarc($record, $record_id, $mod_biblio_options);
621
                        ModBiblioMarc($record, $record_id, $mod_biblio_options);
625
                        next RECORD;
622
                        next RECORD;
626
                    }
623
                    }
627
                    else {
624
                    $record_has_added_items ||= @{$itemnumbers_ref};
628
                        printlog({ id => $record_id, op => "insert", status => "ok" }) if ($logfile);
625
                    if (@{$more_errors}) {
626
                        push @$errors_ref, @{$more_errors};
629
                    }
627
                    }
630
                    push @$errors_ref, @{$more_errors};
631
                }
628
                }
629
630
                if ($record_has_added_items)  {
631
                    printlog({ id => $record_id, op => "insert items", status => "ok" }) if ($logfile);
632
                }
633
632
                if (@{$errors_ref}) {
634
                if (@{$errors_ref}) {
633
                    report_item_errors($record_id, $errors_ref);
635
                    report_item_errors($record_id, $errors_ref);
634
                }
636
                }
635
- 

Return to bug 29440