https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32471 Bug ID: 32471 Summary: Marc imports can fail on replacing items when an itemnumber exists in the incoming file, but not in koha Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Tools Assignee: koha-bugs@lists.koha-community.org Reporter: nick@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org The 'replace' option for items checks whether the item can be found for barcodes - it does not do so for itemnumbers: sub _batchCommitItems { ... my $duplicate_barcode = exists( $item->{'barcode'} ) && Koha::Items->find({ barcode => $item->{'barcode'} }); my $duplicate_itemnumber = exists( $item->{'itemnumber'} ); ... if ( $action eq "replace" && $duplicate_itemnumber ) { # Duplicate itemnumbers have precedence, that way we can update barcodes by overlaying ModItemFromMarc( $item_marc, $biblionumber, $item->{itemnumber}, { skip_record_index => 1 } ); The call to ModItemFromMarc fails when the item isn't there - this can happen for orders when importing final records form the vendor, but a cop has been removed etc. To recreate: 1 - Export a record containing items as MARCXML 2 - Edit an item record and add/update the 952$9 to a number not in the db 1234567890 2 - Stage the record for import, matching on kohabiblio and replacing items 3 - Import the batch 4 - It fails -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.