To test, stage MARC records and import with items created. Next, check out one or more items. Then undo import into catalog, and you'll see that record and item(s) will be deleted. I have made a patch that checks the "on loan" status before deleting item, and do noting in this case, so the record can't be deleted due to existing item.
Created attachment 6635 [details] [review] new proposed patch thx for testing
I noticed 2 some problems for this patch: 1) I had one item checked out and 1 available item with missing home and holding branch (not sure that was the reason). Both were not removed from the catalog. 2) After 'undoing' the import the bib# for the 2 records remaining in the catalog due to errors were gone from the list. 3) I reimported and the bib# were still missing. 4) I undid the import again and now it reports to have removed all records. My 2 problematic records show up in the list as reverted, but they are still available in my catalog. I think 3) and 4) are perhaps side effects of 2)?
Created attachment 6829 [details] screenshot after step 1)
Created attachment 10070 [details] [review] Bug 7329 [Followup] : when reverting an import, keep matching biblionumber in batch table, if items are not deleted beacause on loan.
First patch was ok but uncomplete. This follow-up keep tracks in import tool itself, that some biblios remain in the catalog because corresponding items are issued and can't be deleted.
Created attachment 10125 [details] [review] Bug 7329 [Followup] : when reverting an import, keep matching biblionumber in batch table, if items are not deleted because they are issued.
Followup corrected to take care of biblios with several items
I am ready to sign-off on the first three patches, but there is a small thing I have to note. If you have a record with more than one item and one of the items is checked out, undoing the import will delete all items except for the checked out one. So this is perfectly correct. However, if you repeat the import after that, the additional items do not get readded to the record. I think this is only a very small issue and the import works a lot nicer with the patches. so signing off.
Created attachment 10155 [details] [review] [SIGNED-OFF] Bug 7329: Items onloan are deleted when undoing import into catalog this patch checks the "on loan" and "reserved" status before deleting item, and do noting in this case, so the record can't be deleted due to existing item. Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Created attachment 10156 [details] [review] [SIGNED-OFF] Bug 7329 [Followup] : when reverting an import, keep matching biblionumber in batch table, if items are not deleted beacause on loan. Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Created attachment 10157 [details] [review] [SIGNED-OFF] Bug 7329 [Followup] : when reverting an import, keep matching biblionumber in batch table, if items are not deleted because they are issued. Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Katrin ; the problem is that the record is not totally reverted (one item left) and not totally imported (some items have been deleted). Should we add a status for this situation ("partially reverted" or "partially imported" ) ?
I think it would be nice, but perhaps could be a different bug and enhancement :)
Patch 1: uses DelItemCheck instead of DelItem, with logic to handle when an item cannot be deleted. Good use of existing subroutine. Passed QA. Patch 2 + 3: Work together to prevent the biblio from being NULLifed if the item isn't deleted. SQL only change, with a comment, marking Passed QA.
No string changes, pushed to 3.8.x will be in 3.8.2