A new functionality to automatically add a new MARC link has been added in Bug 29560 (Add option to create MARC links when adding items to bundles). There should also be a way to remove this link when removing the item from the bundle. Moreover I don't know if this should be a second bug but since the link is not removed, there can be multiple links if the item is added to a new bundle.
Created attachment 171832 [details] [review] Bug 37710: Remove the marc link when removing an item from a bundle A new functionality to automatically add a new MARC link has been added in Bug 29560 (Add option to create MARC links when adding items to bundles). There should also be a way to remove this link when removing the item from the bundle. Moreover I don't know if this should be a second bug but since the link is not removed, there can be multiple links if the item is added to a new bundle. TEST PLAN: 1 - Create a bundle on an item by changing the 7th character of the leader to c (go to the marc, click on the button at the right of the field 000 and change the bibliographical level to collection). 2 - Add an item to the bundle (on the biblio, exemplars will have a button "manage bundle"->add_to_bundle, fill in a barcode and check "add MARC link") 3 - Check on the MARC that field 461 (UNIMARC) or 773 (MARC21) is propperly filled 4 - Remove the item from the bundle 5 - Check that the marc field is still there and remove it manually 6 - APPLY PATCH 7 - Repeat 2-5 -> the field should have been automatically removed
Can we get some unit tests to cover unlink_marc_host?
Created attachment 171933 [details] [review] Bug 37710: Add unit tests
Created attachment 171934 [details] [review] Bug 37710: Remove the marc link when removing an item from a bundle A new functionality to automatically add a new MARC link has been added in Bug 29560 (Add option to create MARC links when adding items to bundles). There should also be a way to remove this link when removing the item from the bundle. Moreover I don't know if this should be a second bug but since the link is not removed, there can be multiple links if the item is added to a new bundle. TEST PLAN: 1 - Apply tests and prove t/db_dependent/Koha/Biblio.t -> should fail 2 - Create a bundle on an item by changing the 7th character of the leader to c (go to the marc, click on the button at the right of the field 000 and change the bibliographical level to collection). 3 - Add an item to the bundle (on the biblio, exemplars will have a button "manage bundle"->add_to_bundle, fill in a barcode and check "add MARC link") 4 - Check on the MARC that field 461 (UNIMARC) or 773 (MARC21) is propperly filled 5 - Remove the item from the bundle 6 - Check that the marc field is still there and remove it manually 7 - APPLY PATCH 8 - Repeat 2-5 -> the field should have been automatically removed 9 - Run tests -> should pass Note: as for link_marc_host, tests assume you are using MARC21
Note : In order to prove the behavior properly, I had to create Bug 37996