| Summary: | MARC imports can fail on replacing items when an itemnumber exists in the incoming file, but not in Koha | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Nick Clemens (kidclamp) <nick> |
| Component: | Tools | Assignee: | Bugs List <koha-bugs> |
| Status: | NEW --- | QA Contact: | Testopia <testopia> |
| Severity: | normal | ||
| Priority: | P5 - low | ||
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | --- |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: | ||
| Circulation function: | |||
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