https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41714
--- Comment #7 from Tomás Cohen Arazi (tcohen) <[email protected]> --- Created attachment 192103 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=192103&action=edit Bug 41714: Add a way to let the authority linker honor frameworks (MARC21) This patchset implements a way to make the authority linker follow the cataloguing frameworks when it comes to linked authority type. The current behavior is this for UNIMARC, but in the MARC21 case it just has hardcoded links (e.g. 650 is always linked to `TOPIC_TERM`). This is accomplished by: * Replicating what UNIMARC does, in MARC21 * Moving the code around so both use the same codebase * Adding tests * Adding the `LinkerUseFrameworkAuthTypes` system preference for opting into this new behavior. To test: 1. Launch a fresh KTD instance: $ ktd --proxy --name authorities --search-engine es9 up -d $ ktd --name authorities --wait-ready 120 2. On the staff interface (http://authorities-admin.localhost) open record 344 3. Change the cataloguing framework to the `Default` one and adjust the details so it can be saved. 4. Edit the `Default` framework to unlink the subfield `650$a` from the `TOPIC_TERM` thesaurus. 5. Go back to editing the record => SUCCESS: Field 650$a can be edited freely (normal behavior for unlinked subfields) 6. Add the following headings to repeatable `650$a`: * YERBA * MATE * BOMBILLA * AGUA CALIENTE 7. Create a new Authority type called `CUST_TERM` in `Admin > Authority types` * Make the 'field to copy' be 150 * Export the `TOPIC_TERM` authority type structure into CSV * Import the exported authority type onto `CUST_TERM` => SUCCESS: `TOPIC_TERM` and `CUST_TERM` are the same thing. 8. Add the following authorities of type `CUST_TERM` * YERBA * MATE * BOMBILLA 9. Edit the `Default` framework so `650$a` is now linked to `CUST_TERM` 10. Run: $ ktd --name authorities --shell k$ perl misc/link_bibs_to_authorities.pl --bib-limit "biblionumber=344" --auth-limit "authtypecode='CUST_TERM'" -l -g 650 => FAIL: You see: ``` Bib authority heading linking report ======================================================= Linker module: C4::Linker::Default Run started at: 01/27/26 14:40:42 Run ended at: 01/27/26 14:40:43 Total run time: 276 ms Number of bibs checked: 1 Number of bibs modified: 0 Number of bibs with errors: 0 Number of headings linked: 1 Number of headings unlinked: 4 Number of headings fuzzily linked: 0 ``` This means it kept the currently linked heading, and the other 4 were kept unliked even though they exist on the `CUST_TERM` thesaurus. 11. Apply this patchset 12. Run: k$ updatedatabase k$ restart_all # just in case => SUCCESS: You see a syspref has been added 13. Repeat 10 => SUCCESS: Same result! 14. Set the `LinkerUseFrameworkAuthTypes` system preference to `Do` 15. Repeat 10: => SUCCESS: Yay! You see: ``` Bib authority heading linking report ======================================================= Linker module: C4::Linker::Default Run started at: 01/27/26 14:41:15 Run ended at: 01/27/26 14:41:16 Total run time: 302 ms Number of bibs checked: 1 Number of bibs modified: 1 Number of bibs with errors: 0 Number of headings linked: 4 Number of headings unlinked: 1 Number of headings fuzzily linked: 0 ``` This means *YERBA*, *MATE* and *BOMBILLA* where linked, the existing link was kept [1] and *AGUA CALIENTE* didn't get linked (of course, as it doesn't exist in `CUST_TERM`. 16. Run the tests: k$ prove t/db_dependent/Headin* => SUCCESS: Tests pass! 17. Sign off :-D [1] This really depends on how `LinkerKeepStale` is set, but what I describe is the default behavior. Signed-off-by: Tomás Cohen Arazi <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
