https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22439

--- Comment #4 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 183766
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183766&action=edit
Bug 22439: Remove C4::Biblio::PrepHostMarcField and consolidate with
Koha::Biblio::generate_marc_host_field

This patch removes the PrepHostMarcField function from C4::Biblio and enhances
the modern
generate_marc_host_field method in Koha::Biblio to handle item-specific data
when needed.

The refactoring eliminates code duplication while maintaining all existing
functionality.
Item-specific subfields (barcode, itemnumber, biblionumber) are now only
included when
EasyAnalyticalRecords is enabled, ensuring the implementation continues to be
compliant
with MARC standards.

Changes:
- Remove PrepHostMarcField function from C4::Biblio
- Enhance generate_marc_host_field to accept optional item parameter
- Update cataloguing/addbiblio.pl to use the modern method
- Update cataloguing/linkitem.pl to use the modern method
- Add EasyAnalyticalRecords preference checking to ensure we only add
  the additional non-standard fields when the preference is enabled.

Test plan:
1. Apply patch
2. Enable EasyAnalyticalRecords system preference
3. Create a parent bibliographic record with items
4. Create a child analytical record:
   - Go to Cataloging > New Record
   - Use "Add child record" option for the parent record
   - Choose a specific item from the parent record
   - Verify the 773 field contains subfields $0 (biblionumber), $9
(itemnumber), $o (barcode)
5. Test the linkitem.pl functionality:
   - Create an analytical record without using "Add child record"
   - Go to cataloguing/linkitem.pl with appropriate parameters
   - Link an item using its barcode
   - Verify the 773 field is properly populated
6. Disable EasyAnalyticalRecords system preference
7. Repeat steps 4-5 and verify that subfields $0, $9, and $o are NOT added to
the 773 field
8. Verify that other 773 subfields (title, author, etc.) are still properly
populated
9. Test with both MARC21 and UNIMARC if available
10. Run tests: prove t/db_dependent/Koha/Biblio.t

-- 
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/

Reply via email to