Summary: | Remove the marc link when removing an item from a bundle | ||
---|---|---|---|
Product: | Koha | Reporter: | Baptiste Wojtkowski (bwoj) <baptiste.wojtkowski> |
Component: | Cataloging | Assignee: | Baptiste Wojtkowski (bwoj) <baptiste.wojtkowski> |
Status: | BLOCKED --- | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | jonathan.druart, lucas, m.de.rooy, thibault.keromnes |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Small patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: | ||
Bug Depends on: | 37996 | ||
Bug Blocks: | 38093 | ||
Attachments: |
Bug 37710: Remove the marc link when removing an item from a bundle
Bug 37710: Add unit tests Bug 37710: Remove the marc link when removing an item from a bundle Bug 37710: Add unit tests Bug 37710: Remove the marc link when removing an item from a bundle |
Description
Baptiste Wojtkowski (bwoj)
2024-08-22 14:09:25 UTC
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 Created attachment 176427 [details] [review] Bug 37710: Add unit tests Signed-off-by: Thibault Keromnes <thibault.keromnes@univ-paris8.fr> Created attachment 176428 [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 Signed-off-by: Thibault Keromnes <thibault.keromnes@univ-paris8.fr> Should not we unlink from remove_from_bundle? Should not we unlink from Koha::Item->remove_from_bundle? (In reply to Jonathan Druart from comment #9) > Should not we unlink from Koha::Item->remove_from_bundle? In my opinion, here we want that add_to_bundle and remove_from_bundle work the same way. Since add_to_bundle requires calling link_marc_host aside, I would say that we want to build remove_from_bundle the same way, don't you think ? Hereafter a call to add_to_bundle in Koha/REST/V1/Items.pm 327 my $link = $item->add_to_bundle( $bundle_item, $options ); 328 if ($add_link) { 329 $bundle_item->biblio->link_marc_host( { host => $item->biblio } ); 330 } I will ask the question differently. We have other remove_from_bundle calls: circ/returns.pl: $verify_item->remove_from_bundle; Do we want to unlink there? Since the dependency is FQA I will set this one to BLOCKED for now. |